Skip to content

verifier: side-by-side renderer↔gateway prompt comparison#409

Open
Hecate0821 wants to merge 1 commit intomainfrom
chengxi/verifier-prompt-compare
Open

verifier: side-by-side renderer↔gateway prompt comparison#409
Hecate0821 wants to merge 1 commit intomainfrom
chengxi/verifier-prompt-compare

Conversation

@Hecate0821
Copy link
Copy Markdown
Collaborator

Summary

When the renderer's prompt diverges from the live Fireworks gateway's tokenisation — the load-bearing condition for SFT correctness on Fireworks — the GUI now shows the two prompts in adjacent columns with the divergent suffix highlighted. This makes the training-inference distribution shift visible inside the verifier instead of buried in JSON.

  • probe.py — persists the gateway's prompt tokens (+ decoded form) under artifact.api.prompt.{tokens,decoded}. Previously computed and discarded.
  • viewer/index.html — new PromptComparison component, slotted above the token stream in each case. Only renders when sanity.renderer_prompt_matches_api_prompt is false AND the artifact has the new block. Older artifacts skip cleanly.

End-to-end demo (kimi_k25_disable_thinking)

export FIREWORKS_API_KEY=fw_...
./run.sh

In the GUI:

  • Renderer: kimi_k25_disable_thinking (tokenizer auto-fills to moonshotai/Kimi-K2.5)
  • Model: accounts/fireworks/models/kimi-k2p5
  • Type any prompt → Run probe

The amber Prompt comparison panel appears above the token stream, showing renderer's <think></think>\n\n block (matching HF) vs gateway's open <think>\n (the gateway doesn't honour enable_thinking=false for this serverless model). Divergent positions are red.

Test plan

  • pytest -q training/tests/unit/test_verifier_probe.py (3 passed; artifact now has api.prompt)
  • Live smoke: run a kimi_k25_disable_thinking probe via ./run.sh, confirm the comparison panel appears with the structural divergence highlighted
  • Live smoke: run a glm5 probe (renderer matches gateway), confirm the panel doesn't appear

🤖 Generated with Claude Code

When the renderer's prompt diverges from the live gateway's
prompt_token_ids — the load-bearing condition for SFT correctness on
Fireworks — the GUI now shows the two prompts in adjacent columns,
with the divergent suffix highlighted in rose. This makes the
training-inference distribution shift visible without leaving the
verifier.

probe.py: write the gateway's prompt tokens (+ decoded form) into
artifact.api.prompt. Used to be computed and discarded; now persisted
under api.prompt.{tokens,decoded} so the viewer (and offline tooling)
can show it.

viewer/index.html:
- New PromptComparison component, slotted at the top of each case
  view above the token stream.
- Only renders when sanity.renderer_prompt_matches_api_prompt is
  false AND the artifact has the new api.prompt block (older
  artifacts skip cleanly).
- Computes the first divergent position by linear scan; tokens at or
  beyond that position are shown with a fail-color background.
- Two-column layout collapses to one column under 900px viewport.
- Amber container border so the panel reads as "warning, this is
  the train-vs-inference shift you should care about" without
  shouting.

Try it: pick `kimi_k25_disable_thinking` + tokenizer
`moonshotai/Kimi-K2.5` + model `accounts/fireworks/models/kimi-k2p5`,
type any prompt, hit Run probe. The new panel surfaces the gateway's
"open <think>" vs the renderer's "<think></think>" structural
divergence directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant