Loss Down, Loops Up: Fine-tuning a Gemma 4 31B coding agent on teacher trajectories lowered validation loss and cost solved tasks at both sampling settings we tested
We fine-tuned Gemma 4 31B with a LoRA adapter on 240 successful teacher trajectories converted to the competition's repository-repair harness. Validation loss fell from 0.6375 to 0.2597. On the same 72 solvable FastAPI and Rich tasks, the fine-tuned agent solved fewer tasks than the base model at both sampling settings we ran: 15 versus 29 at temperature 0.2 (exact paired p = 0.00012) and 20 versus 32 at Gemma's recommended sampling of temperature 1.0, top-p 0.95, top-k 64 (p = 0.0075). How it failed depended on sampling. At temperature 0.2 it often submitted nothing (nonempty patches 31 versus 57), and full traces of 20 tasks show repetitive long generations or action loops in 16 fine-tuned runs and no base runs. At temperature 1.0 it submitted as often as the base model (58 versus 58), 11 of the 15 tasks it lost ended with a wrong patch, and the same signatures appeared in 21 of 72 fine-tuned runs versus 3 base runs. At temperature 0.2, instructions, oracle location hints and a doubled budget did not restore patch delivery. We turn these measurements into a pre-deployment check for fine-tuned tool-using agents. Code and data: https://www.kaggle.com/datasets/watermelon696969/gemma4-agent-loss-down-loops-up
Authors
- Chen-Yen Wu
Institutions
- Chung Yuan Christian University (TW)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-17
- DOI
- https://doi.org/10.5281/zenodo.24318927
- Primary Topic
- Software Engineering Research
- Type
- preprint