LearnQuestion bank

Training loss looks great, but in the serving stack the fine-tuned model emits malformed tool calls and doesn’t stop properly. What do you check?

Applied LLMTechnicalHard

Answer it yourself first, out loud or on paper, then compare.

Answer

Model answer, written in a candidate's voice

In short

  • Replay exact serving request vs training setup: tokenizer/version, chat template, special tokens, BOS/EOS, system placement, reasoning tags, EOS present in labels not masked
  • Diff tool names, JSON schema, argument types/order, delimiters and tags between training data and production definitions
  • Verify runtime path: correct base model, adapter loaded, merge/quantisation, sampling/stop tokens/max tokens
  • Compare train vs eval loss and held-out task metrics such as valid tool-call rate and stop rate
  • Add preflight data-vs-contract checks and a smoke test through the real serving path before rollout

In full

I would treat the training loss as a weak signal and first replay the exact serving request against the training setup: same tokenizer and version, chat template, special tokens, BOS/EOS, system-prompt placement and reasoning tags, and confirm EOS is actually present in the labels rather than masked out. Then I would diff the tool contract between training data and production—names, JSON schema, argument types and order, delimiters and any tool/reasoning tags—because small schema drift can look like a model failure. Next I would verify the runtime path: correct base model, adapter actually loaded, merge and quantisation applied as intended, and sampling, stop-token and max-token settings. I would also compare train vs eval loss and held-out task metrics such as valid tool-call rate and stop rate to separate overfitting from mismatch. Prevention is a preflight check of the dataset against the serving contract plus a smoke test through the real serving path before rollout.

Checked against sources by an independent AI reviewer.

What a strong answer covers

  • Chat-template mismatch (special tokens, BOS/EOS, system-prompt placement, reasoning tags); tokenizer version; EOS masked out of the loss so the model never learned to stop
  • Tool names/schema/format in training data differ from production definitions
  • Sampling parameters, wrong base model, adapter not loaded, quantisation after merge
  • Overfitting: compare train vs eval loss and held-out task metrics
  • Prevention: a preflight check of data against the serving contract and a smoke test through the real serving path

Common mistakes

  • Trusting training loss
  • testing in a notebook with a different prompt format from production