File size: 4,121 Bytes
05c768b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # Learn CPT, SFT and RL on native Slayer1B
Use [SlayerLab/Slayer1B-1.09](https://huggingface.co/SlayerLab/Slayer1B-1.09) as a common starting point and compare what each objective changes. All three training lessons freeze the parent and train native LoRA adapters. They run independently by default; this is not a claim that the released poetry model underwent SFT or RL.
| Notebook | What you learn | GPU needed? |
| --- | --- | --- |
| [00 · Generation comparison](00_generation_comparison.ipynb) | Inspect all three real parent/poetry pairs; design a fair quality evaluation | No |
| [01 · CPT](01_cpt.ipynb) | Next-token prediction on raw verse, EOS boundaries, before/after samples | Recommended |
| [02 · SFT](02_sft.ipynb) | Prompt/response template, response-only label masking, EOS supervision | Recommended |
| [03 · RL](03_rl.ipynb) | On-policy samples, reward, REINFORCE, reference KL, reward hacking | Recommended |
| [04 · Checkpoint averaging](04_checkpoint_averaging.ipynb) | Average N full checkpoints with checksums, validate and compare generations | No for averaging; recommended for evaluation |
## Open a notebook
Download an `.ipynb` above and open it in JupyterLab, VS Code, or use **File → Upload notebook** in Google Colab. Select a CUDA GPU runtime for training. The first cells install dependencies and download the small tutorial files. Loading a training lesson separately downloads and SHA256-checks the pinned parent checkpoint (about 4.3 GB).
For local use:
```bash
hf download SlayerLab/Slayer1B-Poetry --local-dir Slayer1B-Poetry
python -m pip install jupyterlab -r Slayer1B-Poetry/requirements.txt 'pydantic>=2'
jupyter lab Slayer1B-Poetry/tutorials
```
Start with notebook 00. In training notebooks, inspect the toy data and code, then set `RUN_TRAINING=True`. Use a fresh kernel for each lesson so one model does not remain in memory while another loads. CUDA BF16 is used; memory depends on GPU, runtime and context. No universal GPU-memory fit guarantee is made. Reduce context/rollout length if needed. No notebook provisions paid infrastructure.
## Keep the objectives distinct
**CPT:** raw document → next token, loss on every target. **SFT:** request + response → next token, loss on response targets only. **RL:** sample response → score it → update its log probability, with a frozen-parent KL penalty. LoRA is the shared parameter-update mechanism, not a fourth objective.
The small original teaching datasets show the mechanics. They do not reproduce the 37.66M-token poetry run or establish instruction-following or literary-quality gains. The RL reward checks simple form and can reward nonsense. Use held-out generations and blinded human judgments to assess poetry quality; log failures as well as improvements.
## Implementation and validation
Read [slayer_training.py](slayer_training.py). It contains the actual training loops, strict Pydantic input/config models, native parent loading, adapter saving, and the toy reward. It does not use Transformers/PEFT or a chat template. The original parent architecture, archive and tokenizer revisions are pinned by the release's `recipe.json` and checksum checks.
The teaching loops use microbatch 1 and short contexts for readability. They are not production-scale trainers: no distributed training, exact optimizer resume, validation scheduler, or large-corpus memory mapping is provided. Saved files are inference adapters accepted by the repository's generation CLI:
```bash
python generate.py --adapter outputs/sft_adapter.pt --opening $'Request: Write two lines about the moon.\nPoem:\n' --tokens 64
```
That CLI uses its documented top-k/repetition defaults; the tutorial sampler instead uses unfiltered temperature-1 sampling so RL sampling and log-probability scoring match. Use one identical sampler across compared checkpoints for a given evaluation.
See [VALIDATION.md](VALIDATION.md) for checks actually run. Published poetry results apply only to the CPT adapter in the model card. Tutorial checkpoints are separate experiments; training cells ship without fabricated outputs.
|