Write the Prefix preservation section (§6)

#3
by kashif HF Staff - opened

Fills in the §6 "Prefix preservation" TODO that the merged comparison section forward-references.

  • States the property precisely: rendering a conversation with appended tool messages must
    extend the render without them, token-for-token — and only for tool messages. User /
    assistant / system turns are under no such obligation.
  • Includes the 12-line is_prefix_preserving property test.
  • Adds a real audit table run fresh across nine open-weights families: Qwen2.5, Qwen3,
    Qwen3-VL, Llama 3.1, Llama 3.2, DeepSeek-V3, GLM-4.5, GPT-OSS, SmolLM3. Eight of nine pass
    out of the box; Qwen3 is the lone failure.
  • Explains the Qwen3 cause ({%- if loop.last or (not loop.last and reasoning_content) %} flips
    a prior assistant turn's rendering once a tool message makes it non-last) and gives the verified
    one-line Jinja patch. Confirmed: with the patch the property holds, and ordinary chat
    rendering stays byte-identical (the conditional only governs assistant turns after the last
    user message).
  • Adds scripts/audit_prefix.py to reproduce the table.

No people or organisations are named in the prose. Remaining TODOs (History rewriting, The honest
edges, The right primitive) are unchanged.

qgallouedec changed pull request status to merged

Sign up or log in to comment