trifero.ai Technical report
DistillationOctober 2026

Show your work

We trained Elroy, our 360M-parameter code model, on worked solutions from four Qwen3.5 reasoning models to see whether a model this small can learn to reason by imitation.

Abstract

Large reasoning models pass their skill to smaller ones when the smaller model is trained on their written reasoning, and distilled models from 1.5B parameters up have shown large gains. We asked whether the same works far below that size. Elroy is a 360M-parameter code model we trained from scratch, which means we know every token it has seen. We had Qwen3.5 0.8B, 2B, 4B and 9B solve 26,681 Python problems in thinking mode, kept only solutions that passed their unit tests, and fine-tuned Elroy three ways on the same verified code: code alone, code after a short explanation, and code after the teacher’s full reasoning. Code alone raised Elroy’s held-out accuracy from 32.9% to as much as 42.9%, 10 to 13 points above a matched control, but GPT-4o reference solutions to the same problems did just as well (42.4%). Adding a short explanation cut the gain by more than half. Adding the full reasoning erased it, and with less data it fell below the control. The size of the teacher made no difference to that pattern, and no training set raised HumanEval or MBPP above Elroy’s starting score. At this scale, Elroy copied the form of reasoning without its substance.

+10 to +13 points

Held-out gain from training on the teachers’ verified code alone, against a control with the same training schedule. The three teachers land within about three points of each other.

42.9% vs 42.4%

Code from the 9B reasoning teacher against the dataset’s own GPT-4o reference solutions. The teacher’s value was correct code, which the dataset already had.

−5 to −1 points

Effect of the full reasoning traces at 1,200 problems, against the same control. At 3,800 problems they were neutral. They never helped.

182 of 26,681

Problems that all four teachers solved with reasoning short enough for Elroy’s 2,048-token context. Each teacher stays short on different problems.

1The question

DeepSeek showed in early 2025 that a model as small as 1.5B parameters gains sharply on math when fine-tuned on the written reasoning of a much larger model. Li and colleagues then found that models of 3B parameters and below learn poorly from long reasoning by strong teachers, and better from short reasoning or from smaller teachers. Below 1B parameters there is little evidence either way.

Elroy, documented in our earlier report, is a 360M-parameter Llama-style model we wrote and pretrained ourselves on about 20B tokens of educational Python and English. Because we built its corpus and its instruction data, we know what it saw before this study, and its instruction data was already filtered against the benchmarks we use. We asked three questions: does reasoning from a teacher raise a model this small above what correct answers alone give; does a short explanation work better than full reasoning; and does a teacher closer to Elroy’s size teach better.

2Setup

Problems

KodCode-V1 contains about 484,000 synthetic Python problems, each with a function signature, a reference solution and pytest tests; the solutions and tests were generated by GPT-4o and checked against each other. We kept instruction-style problems from five function-level subsets (Prefill, LeetCode, Algorithm, Data_Structure, Evol), rated easy or medium, with exactly one target function and a statement under 1,200 characters. We dropped 810 problems that KodCode flags as close to a public benchmark and 79 more that Elroy’s own filter matched to HumanEval or MBPP text or solutions. That left 26,681 problems for the teachers and 500 held out for evaluation.

Teachers and traces

Qwen3.5 0.8B, 2B, 4B and 9B share a tokenizer, a training recipe and a thinking mode, so they differ mainly in size. Each solved every problem once in thinking mode (temperature 0.6, top-p 0.95, top-k 20) with a 2,048-token limit, because longer reasoning cannot fit in Elroy’s context next to a problem and a solution. We ran every solution against its tests and kept only those that passed. Passing reasoning was screened again for benchmark text, which removed 4 to 15 traces per teacher.

Three training formats, one set of code

Every kept problem became three training examples with the same verified function at the end:

So the formats differ only in how much reasoning comes before identical code. For comparisons between teachers we drew equal-size sets from each teacher’s own solved problems: 3,800 problems for the 2B, 4B and 9B, and 1,200 for all four teachers. A fifth condition used KodCode’s GPT-4o reference solutions for the 4B teacher’s problems, as code only.

Training and controls

Each run fine-tuned Elroy’s decontaminated chat model for two epochs at learning rate 5e-5, the settings of its original instruction tuning. Every set was mixed one to one with examples from Elroy’s original instruction data, which kept the narrow new data from overwriting what it already knew. The control is that replay data alone, at the same size, so every comparison below holds the training schedule fixed. Every condition ran with two seeds.

Evaluation

We converted Elroy to the standard Llama layout so vLLM could serve it, and checked the conversion against the original code: greedy decoding reproduced the published scores (HumanEval 22.0% against 22.6% published, HumanEval+ 21.3% against 21.3%, MBPP 35.4% against 35.0%). Results below use temperature 0.6 with four samples per problem, averaged over both seeds, on the 500 held-out KodCode problems, HumanEval and HumanEval+ (164 each) and MBPP (257). Intervals are 95% paired bootstrap intervals over problems.

3What the teachers produced

Every teacher thought past the 2,048-token limit on most problems. The 4B was the most accurate when it finished; the 9B finished fewer problems than the 2B or 4B because it reasons longer.

Table 1. Teacher output on 26,681 problems. Finished: the reasoning ended within the limit. Pass rate: share of finished solutions that passed their tests. Removed: passing traces that matched benchmark text. Kept: also fit Elroy’s context. Median tokens: length of passing traces.
TeacherFinishedPassedPass rateRemovedKeptMedian tokens
Qwen3.5-0.8B3,6971,28435%41,275824
Qwen3.5-2B10,3896,46162%156,390769
Qwen3.5-4B9,5887,00473%146,9811,044
Qwen3.5-9B6,3663,90861%93,8921,089

The teachers stayed short on different problems. Only 182 problems had usable reasoning from all four, so a shared problem set was not possible. Each teacher’s set reflects the problems it found easy enough to solve briefly, which is what any distillation run under a length limit would get.

4Results

Qwen3.5-2B teacherQwen3.5-4B teacherQwen3.5-9B teacherGPT-4o reference solutionsReplay onlyBefore
20% 25% 30% 35% 40% 45% Code only, Qwen3.5-2B teacher: 39.8% Code only, Qwen3.5-4B teacher: 40.1% Code only, Qwen3.5-9B teacher: 42.9% Code only Short reasoning, Qwen3.5-2B teacher: 32.5% Short reasoning, Qwen3.5-4B teacher: 34.2% Short reasoning, Qwen3.5-9B teacher: 34.4% Short reasoning Long reasoning, Qwen3.5-2B teacher: 29.8% Long reasoning, Qwen3.5-4B teacher: 27.4% Long reasoning, Qwen3.5-9B teacher: 28.6% Long reasoning Elroy before distillation: 32.9% Same training with replay only: 29.4% GPT-4o reference solutions, code only: 42.4%
Figure 1. Accuracy on the 500 held-out KodCode problems after training on 3,800 problems per teacher. The lines mark Elroy before distillation (32.9%), the replay-only control (29.4%) and the GPT-4o reference solutions (42.4%).
Qwen3.5-0.8B teacherQwen3.5-2B teacherQwen3.5-4B teacherQwen3.5-9B teacherGPT-4o reference solutionsReplay onlyBefore
20% 25% 30% 35% 40% 45% Code only, Qwen3.5-0.8B teacher: 35.3% Code only, Qwen3.5-2B teacher: 36.6% Code only, Qwen3.5-4B teacher: 35.0% Code only, Qwen3.5-9B teacher: 36.8% Code only Short reasoning, Qwen3.5-0.8B teacher: 32.0% Short reasoning, Qwen3.5-2B teacher: 30.9% Short reasoning, Qwen3.5-4B teacher: 30.7% Short reasoning, Qwen3.5-9B teacher: 31.0% Short reasoning Long reasoning, Qwen3.5-0.8B teacher: 25.9% Long reasoning, Qwen3.5-2B teacher: 29.0% Long reasoning, Qwen3.5-4B teacher: 24.7% Long reasoning, Qwen3.5-9B teacher: 25.4% Long reasoning Elroy before distillation: 32.9% Same training with replay only: 30.0% GPT-4o reference solutions, code only: 36.4%
Figure 2. The same comparison with 1,200 problems per teacher, which includes the 0.8B. Code beats short reasoning beats long reasoning for every teacher, and long reasoning falls below the replay-only control for every teacher, significantly for all but the 2B.

The teacher closest to Elroy’s size did not teach better. With 1,200 problems, code from the 0.8B gave 35.3% against 36.8% from the 9B, and its full reasoning cost 4.2 points against the control, in line with the 4B and 9B.

Table 2. All conditions at 3,800 problems. Accuracy at temperature 0.6, four samples, mean of two seeds. The last column is the held-out KodCode difference from the replay-only control, with a 95% interval, in points.
Training dataHumanEvalHumanEval+MBPPKodCode held-outKodCode vs control
Elroy before distillation18.9%16.8%29.5%32.9%
Replay only (control)17.5%16.1%25.0%29.4%
Code only
Qwen3.5-2B teacher17.8%16.8%27.4%39.8%+10.3 [+7.6, +13.0]
Qwen3.5-4B teacher18.1%17.4%26.7%40.1%+10.6 [+7.8, +13.5]
Qwen3.5-9B teacher18.4%17.3%27.8%42.9%+13.4 [+10.7, +16.2]
Short reasoning
Qwen3.5-2B teacher16.8%15.9%27.9%32.5%+3.1 [+0.6, +5.5]
Qwen3.5-4B teacher16.2%14.4%25.7%34.2%+4.8 [+2.2, +7.3]
Qwen3.5-9B teacher16.0%14.0%25.0%34.4%+5.0 [+2.5, +7.5]
Long reasoning
Qwen3.5-2B teacher18.4%17.8%26.2%29.8%+0.4 [−2.0, +2.8]
Qwen3.5-4B teacher17.5%16.5%25.0%27.4%−2.0 [−4.3, +0.3]
Qwen3.5-9B teacher18.3%17.2%25.6%28.6%−0.9 [−3.0, +1.3]
No teacher
GPT-4o reference solutions, code only19.2%18.4%27.0%42.4%+12.9 [+10.0, +16.0]
Table 3. All conditions at 1,200 problems, including the 0.8B teacher.
Training dataHumanEvalHumanEval+MBPPKodCode held-outKodCode vs control
Elroy before distillation18.9%16.8%29.5%32.9%
Replay only (control)16.2%14.2%25.9%30.0%
Code only
Qwen3.5-0.8B teacher18.3%16.6%25.7%35.3%+5.3 [+2.6, +8.0]
Qwen3.5-2B teacher18.4%16.6%26.8%36.6%+6.6 [+4.1, +9.2]
Qwen3.5-4B teacher18.5%17.1%24.3%35.0%+5.0 [+2.2, +7.8]
Qwen3.5-9B teacher17.9%16.8%27.5%36.8%+6.8 [+4.2, +9.5]
Short reasoning
Qwen3.5-0.8B teacher16.2%15.1%24.6%32.0%+1.9 [−0.4, +4.3]
Qwen3.5-2B teacher17.5%15.7%24.9%30.9%+0.9 [−1.5, +3.2]
Qwen3.5-4B teacher13.9%12.3%23.7%30.7%+0.7 [−1.7, +3.1]
Qwen3.5-9B teacher16.4%15.4%23.8%31.0%+1.0 [−1.4, +3.4]
Long reasoning
Qwen3.5-0.8B teacher14.5%13.0%25.7%25.9%−4.2 [−6.4, −1.9]
Qwen3.5-2B teacher16.5%15.5%27.0%29.0%−1.0 [−3.1, +1.1]
Qwen3.5-4B teacher16.5%15.5%25.2%24.7%−5.3 [−7.7, −3.0]
Qwen3.5-9B teacher17.1%15.5%26.7%25.4%−4.6 [−6.9, −2.3]
No teacher
GPT-4o reference solutions, code only18.8%17.0%26.8%36.4%+6.4 [+3.8, +9.0]

5What Elroy learned from the reasoning

Our first run had no replay and used greedy decoding, the standard way to score small code models. Elroy trained on the 4B teacher’s full reasoning ran out of context without writing any code on 30% of HumanEval problems, usually by repeating one line:

* I need to handle the case where the string might be empty or contain only spaces. * I need to handle the case where the string might be empty or contain only spaces. * I need to handle the case where the string might be empty or contain only spaces. * I need to handle the case where the string might be empty or contain only spaces. * I need to handle the

Small distilled reasoners are known to loop under greedy decoding, which is why DeepSeek recommends sampling for theirs. With sampling at temperature 0.6, looping fell to 2% or less at 3,800 problems and at most 9% anywhere (the 0.8B teacher’s reasoning), and the results above use sampling throughout. Looping was not the main problem. When the reasoning finished, it read like the teacher’s but did not do the teacher’s work. Here Elroy, asked whether any two numbers in a list are closer than a threshold, reviews its plan, approves it, and writes a function that compares single numbers to the threshold:

*Refining the code:* def has_close_elements(numbers: List[float], threshold: float) -> bool: """ Check if any two numbers in the list are closer to each other than the threshold. """ return any(num < threshold for num in numbers) This looks good. 7. **Final Output Generation:** (Matches the thought process above).ot ```python from typing import List def has_close_elements(numbers: List[float], threshold: float) -> bool: """ Check if in given list of numbers, are any two numbers closer to each other than the threshold. """ return any(num < threshold for num in numbers) ```

The reasoning also cost length. Replies with full reasoning averaged 675 to 881 tokens on held-out problems against 80 to 92 for code alone, eight to ten times the compute per answer for lower accuracy.

Table 4. The first run (4B teacher, 5,880 problems, no replay, greedy decoding). Elroy before distillation scored 22.0% on HumanEval, 35.4% on MBPP and 33.8% on held-out KodCode under the same decoding. Never finished: HumanEval replies that ran out of context.
FormatHumanEvalMBPPKodCode held-outNever finishedMean tokens
Code only18.3%28.4%42.0%1%194
Short reasoning14.0%24.5%40.4%2%296
Long reasoning14.0%19.1%28.0%30%1,060

Without replay, even code alone cost Elroy ground on HumanEval and MBPP while it gained on KodCode, which is why every result above mixes in its original instruction data.

6Nothing reached the other benchmarks

HumanEval and MBPP ask for the same kind of short Python function as KodCode but were written by different people in a different style. No training set raised them above Elroy’s score before distillation. Against the replay-only control a few differences of about three points clear the interval, such as the 9B teacher’s code on MBPP, but the control itself lost ground to the extra training, so those gains only win it back.

Table 5. Difference from the replay-only control at 3,800 problems, in points, with 95% intervals. The control itself scored −1.4, −0.7 and −4.5 points against Elroy before distillation.
Training dataHumanEvalHumanEval+MBPP
Code only, 9B teacher+1.0 [−1.6, +3.5]+1.2 [−1.4, +3.9]+2.8 [+0.1, +5.4]
GPT-4o reference solutions+1.8 [−1.2, +4.8]+2.3 [−0.7, +5.3]+2.0 [−0.7, +4.8]
Short reasoning, 9B teacher−1.4 [−3.9, +1.0]−2.1 [−4.6, +0.5]−0.0 [−2.5, +2.4]
Long reasoning, 9B teacher+0.8 [−1.4, +3.0]+1.1 [−0.8, +3.1]+0.6 [−1.7, +2.8]

7Discussion

Below the size where reasoning transfers

Li and colleagues found that models of 3B parameters and below learn better from short reasoning than from long. At 360M we found the next step down: short reasoning still costs accuracy and long reasoning removes the whole benefit of the correct code it comes with. The teacher’s reasoning is not information Elroy can use. It is text to imitate, and imitating it takes the capacity and context the code needs.

The teacher was worth its answers

Code from a 9B reasoning model and code from the dataset’s own GPT-4o solutions gave the same gain. For a model this small, a reasoning teacher is useful as a source of correct, tested answers, and only to the extent that such answers are not already available.

Length limits shape the data

A student with a short context only ever sees the problems its teacher can solve briefly, and different teachers are brief on different problems. Of 26,681 problems, 182 had usable reasoning from all four teachers. Any distillation run into a small model is selecting its training problems this way, whether or not it reports it.

8Limitations

9What we release

We publish the method, the generation, training and evaluation code, and all aggregate results. KodCode is licensed CC BY-NC 4.0, so models trained on it inherit a non-commercial restriction; we do not release the fine-tuned Elroy weights from this study. The original Elroy weights remain available as before.

10Reproducibility

Everything ran on 21 and 22 October 2026 on two NVIDIA RTX A4500 GPUs (20 GB each) in the trifero lab; training and evaluation were scheduled through Slurm. Teacher generation used vLLM 0.31.0 and took about 13.5 hours of wall time across both cards (the 9B with tensor parallelism). Elroy fine-tuning used Elroy’s own training code with bf16 autocast, batch 4 with 8-step accumulation; training took 2 to 12 minutes per run, and all 50 runs with their evaluations took under five hours of wall time on the two cards. The replay pool was Elroy’s original instruction set rebuilt with its decontamination filter (82,191 examples). Evaluation ran Elroy through vLLM after converting it to the Llama layout, with tests executed in sandboxed subprocesses. Per-sample outputs for every condition are stored in the study repository.

11References

  1. DeepSeek-AI. DeepSeek-R1: incentivizing reasoning capability in LLMs via reinforcement learning. 2025. arxiv.org/abs/2501.12948
  2. Li, Y., Yue, X., Xu, Z., et al. Small models struggle to learn from strong reasoners. 2025. arxiv.org/abs/2502.12143
  3. Xu, Z., Liu, Y., Yin, Y., Zhou, M., and Poovendran, R. KodCode: a diverse, challenging, and verifiable synthetic dataset for coding. 2025. arxiv.org/abs/2503.02951
  4. Hinton, G., Vinyals, O., and Dean, J. Distilling the knowledge in a neural network. 2015. arxiv.org/abs/1503.02531
  5. Kim, Y., and Rush, A. M. Sequence-level knowledge distillation. EMNLP 2016. arxiv.org/abs/1606.07947
  6. Chen, M., et al. Evaluating large language models trained on code (HumanEval). 2021. arxiv.org/abs/2107.03374
  7. Austin, J., et al. Program synthesis with large language models (MBPP). 2021. arxiv.org/abs/2108.07732
  8. Liu, J., et al. Is your code generated by ChatGPT really correct? (HumanEval+). NeurIPS 2023. arxiv.org/abs/2305.01210
  9. Qwen Team. Qwen3.5 small model cards. huggingface.co/Qwen/Qwen3.5-4B
  10. trifero lab. Elroy, from scratch. 2026. trifero.ai/research/elroy