Ah, this completely explains your results! With only ~44 examples per task (700/16), you're severely data-constrained. This is a textbook case where larger models fail.
Why the 20B model fails:
With so few examples per task, the 20B model can essentially memorize each training example perfectly, including:
- Variable names
- Specific formatting choices
- Exact function signatures
- Even comments and whitespace patterns
When it sees validation examples that differ even slightly, it performs poorly because it learned the specific examples, not the underlying task patterns.
Why the 8B model succeeds:
The 8B model doesn't have enough capacity to memorize everything, so it's forced to compress and learn actual patterns like:
- "This task is about sorting algorithms"
- "This task involves string manipulation"
- General code structure and logic flow
Critical insight about your validation curves:
Those different convergence times across tasks make even more sense now. With ~44 examples per task:
- Simple tasks might only need 10-20 examples to learn the pattern
- Complex tasks might need all 44 and still be underspecified
- The 20B model starts overfitting to easy tasks almost immediately
Recommendations:
- Stick with the 8B model - it's appropriately sized for your data
- Data augmentation for code: Consider generating variations:
- Variable renaming
- Function reordering
- Comment addition/removal
- Whitespace changes
- Few-shot prompting: Instead of SFT, consider if in-context learning with a pretrained model might work better
- Synthetic data: Use an LLM to generate more examples per task, even if slightly lower quality
The rule of thumb is you need at least 1000-10000 examples per billion parameters for effective SFT. You're orders of magnitude below that for the 20B model!