An end-of-sequence (EOS) token marks the conclusion of generated text. During story generation, the model samples tokens until it produces EOS or another stopping condition intervenes. section 5.4.2
Use EOS as one part of a bounded generation loop:
- Retrieve the EOS token ID from the tokenizer, falling back to 0 when the marker is unavailable. section 5.4.2
- Generate tokens inside a loop capped at 100 iterations, preventing unbounded output. section 5.4.2
- Stop when the sampled token equals the EOS ID, or when decoded text contains a paragraph break. section 5.4.2
if generated_text.ends_with("\n\n") {
break;
}
if next_token as u32 == eos_token_id {
break;
}
Inspect the Rust stopping checks that combine paragraph-break detection with EOS-token comparison. section 5.4.2




