Designing a code-assistant SFT mix: how should domain and general data balance?
A team is SFT'ing a strong base instruct model into a code-assistant product. They have access to high-quality code-instruction data (CodeAlpaca, Magicoder, internal code-review pairs) and general chat data (Tulu, UltraChat). Specify the starting mixture ratio, the role each component plays, how to tune the ratio, and what fails at both extremes.
Start at 80% code / 20% general, with the general slice acting as anti-forgetting replay. Interleave at the row level. Tune empirically with pilots at 90/10, 80/20, 70/30 reading both a code metric and a general metric.
Picture training a specialist doctor who also has to talk to patients in plain language. Most of the training is medical cases, that is what makes them good at the speciality. But a small share is conversational practice, because if they spend a year on only technical cases they forget how to explain a diagnosis to a frightened parent. The medical slice teaches the new skill. The conversational slice keeps the old skill from rotting. The right balance is mostly medical with enough conversation to keep the bedside manner, and finding it means watching both their technical scores and their patient-feedback scores. Both extremes fail in opposite ways.
Detailed answer & concept explanation~9 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: name the 80/20 starting ratio, distinguish the two slice roles, describe the row-level interleaving and the pilot protocol, and end with both failure modes.
Real products, models, and research that use this idea.
- DeepSeek V4 Coder, a 2026 code-specialist model, uses a high-domain SFT mix with documented anti-forgetting replay drawn from general chat sources.
- Allen AI's Tulu 3 mixture demonstrates the two-slice structure at open-data scale, with per-slice ablation results showing the trade-off the question describes.
- Anthropic's published guidance on building Claude Opus 4.7 character training discusses general-capability replay as a deliberate component of specialist tuning.
- Llama 4 Maverick fine-tunes for medical and legal verticals in 2026 use the same domain plus replay structure with domain shares typically in the 75 to 85 percent range.
- Hugging Face's TRL examples for code-specialist fine-tunes recommend per-batch row-level interleaving and provide the dataset mixing utilities needed to implement it.
What an interviewer would ask next. Try answering before peeking at the approach.
QWalk through how you would adapt the 80/20 mix for a fine-tune on a low-resource programming language the base model barely knows.
QHow would you measure whether the anti-forgetting replay is actually working, beyond just reading MMLU?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Going 100% domain and discovering at deployment that the model lost its ability to explain code in plain English or hold a multi-turn conversation. The anti-forgetting replay slice is small but load-bearing.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.