# nodus.examples.rl

> Reinforcement learning in one file: teach a small model to spell words backwards.

Source: https://nodus-platform-site.pages.dev/docs/reference/python/nodus-examples-rl/
Build revision: 211ad9f836655b1c3a2668c4693e442471f28614

<!-- Generated by scripts/gen-reference.mjs from the SDK docstrings (griffe). Do not edit: run make gen. -->

Reinforcement learning in one file: teach a small model to spell words backwards.

Run it with `python -m nodus.examples.rl`. To train on your own task, copy this file and change `tasks` and `reward`: a task is a prompt and the answer only `reward` sees, and `reward` scores one completion against that answer.

## `main`

```python
main() -> None
```

## `reward`

```python
reward(completion, answer)
```

1.0 for the exact reversed word, 0.0 for a wrong one, None when the completion holds no answer.
