RAG & Agents Engineering

M45 lab, fine-tuning fundamentals

max_length decides what the model learns from.

Three Larkspur Cloud support examples in the lesson 45.4 template, tokenized with the Pythia tokenizer the notebooks use. Move max_length, pick the side to cut and the padding, and read the batch the Trainer receives.

Truncation side
Padding
End-of-text token
Answer tokens cut
Question tokens cut
Padding share of the batch
Rows that end with the end token

The batch the Trainer receives

EleutherAI/pythia-70m tokenizer

What the tensors hold

ExampleTokensKeptPaddingMask onesRow width

The notebook sets pad_token = eos_token, so every padding position holds id 0, the same id as <|endoftext|>. labels is a copy of input_ids, as in lesson 45.4. Checked against transformers 5.17 on every setting of the four controls.