Skip to main content
Back

Fudan's CODA Cuts Reasoning Model Token Waste by 75% on Easy Math

CODA trains reasoning models to spend fewer tokens on easy problems and more on hard ones, cutting costs by 60%+ without sacrificing accuracy

Pro

  • CODA is a new RL training method from Fudan University that teaches reasoning models to use fewer tokens on easy questions and more on hard ones, without any manual budget setting.
  • On easy tasks like GSM8K and SVAMP, CODA cuts token usage by 60-87% compared to standard GRPO training while maintaining the same accuracy.
  • On hard tasks like AIME24/25, CODA matches or slightly exceeds GRPO accuracy by preserving deep, reflective chain-of-thought reasoning.
  • The key mechanism is a dual-gate reward: an easy-side penalty discourages verbosity when the model already gets most rollouts right, and a hard-side bonus rewards longer correct responses when the model struggles.
  • Unlike competing length-penalty methods (VLP, ASRR), CODA does not sacrifice accuracy on hard problems -- ASRR drops from 22.1% to 18.8% on AIME25 while CODA holds at 22.9%.
  • Code is available on GitHub and the method runs on top of the open-source verl RL framework, tested on Qwen3-4B/8B/14B-Base models.

Large reasoning models like DeepSeek-R1 and OpenAI's o-series have made a compelling case for spending more compute at inference time. The more a model "thinks," the better it tends to do on hard problems. But there is a catch that practitioners hit almost immediately: these models think just as hard about simple arithmetic as they do about competition-level math. Researchers at Fudan University have now published CODA (Compute Allocation by Difficulty Awareness), a training method that teaches a model to match its reasoning depth to how hard a question actually is.

The overthinking tax

The problem has a name in the research community: overthinking. Large reasoning models consume excessive inference tokens and reasoning steps even for simple problems, yielding only marginal performance improvements. Given the substantial resource costs associated with LLM inference (e.g., OpenAI o1 costs $60 per 1M generated tokens), such behavior is highly undesirable.

The pattern is well-documented. Models tend to allocate disproportionately long chains to simple problems while inadequately reasoning through complex ones. Empirical research consistently identifies an inverse U-shaped performance curve: accuracy initially rises with reasoning length, but then peaks and declines as chains become excessively long. In other words, more tokens can actually hurt.

The naive fix is to penalize length during training. But that creates a different problem: the model gets shorter on everything, including the hard questions where long deliberation genuinely helps. Existing methods either apply a uniform length penalty that trades accuracy for brevity, or require the user to manually specify a token budget per query -- which is impractical at scale and sensitive to miscalibration.

Framing it as an economics problem

CODA's key insight is to treat token allocation as a utility maximization problem. The idea: keep spending tokens on a question until the marginal accuracy gain from one more token drops below its cost. Crucially, this break-even point is different for every question. Easy tasks saturate quickly so extra tokens yield marginal gains, whereas hard tasks continue to improve with more compute. This means that instead of a single global length penalty, you need a per-question "token price" that scales with difficulty.

The challenge is that difficulty is not directly observable. CODA solves this with a signal that is already available for free inside group-based reinforcement learning.

How CODA works

CODA builds on top of GRPO (Group Relative Policy Optimization), the RL algorithm behind many modern reasoning models. In GRPO, the model samples a group of responses to each question and uses their correctness to compute a training signal. CODA hijacks that group to estimate difficulty.

The method works in four steps:

  1. Estimate difficulty from rollouts. CODA computes the group success rate s_q -- the fraction of sampled responses that got the right answer. High s_q means the question is easy for the current policy; low s_q means it is hard.
  2. Map difficulty to two gates. s_q is converted into two non-negative weights: an easy-side gate w_easy (active when success rate is high) and a hard-side gate w_hard (active when success rate is low).
  3. Shape the reward. The base correctness reward is multiplied by a length-dependent factor controlled by these gates. For easy questions, longer responses are penalized. For hard questions, longer correct responses get a bonus.
  4. Correctness-gating prevents gaming. The hard-side bonus only applies when the response is correct. This is critical: rewarding length on wrong answers just teaches the model to ramble, not to reason.

The shaped reward looks like this in practice:

# Simplified CODA reward shaping
# r_base: 1 if correct, 0 if wrong
# w_easy, w_hard: difficulty gates from group success rate
# norm_len: sigmoid of group-normalized response length
r_shaped = r_base * (1 + (beta * w_hard - alpha * w_easy) * norm_len)
# Easy question (high s_q): w_easy > 0, penalizes long responses
# Hard question (low s_q): w_hard > 0, bonuses long CORRECT responses
# Wrong answer: r_base = 0, so length bonus is always zero

The gates are controlled by two thresholds: tau_easy = 0.75 (the easy gate activates when the model gets more than 75% of rollouts right) and tau_hard = 0.25 (the hard gate activates when fewer than 25% are correct). These defaults were found to be stable across experiments.

What it was tested on

The team trained on DeepScaleR, a mathematics dataset of 40K problems spanning a wide range of difficulty levels, drawn from AIME (1983-2023), AMC, Omni-Math, and STILL. They selected Qwen3-4B/8B/14B-Base as backbone models.

Evaluation covered a deliberately wide range of difficulty:

  • Easy math: SVAMP, GSM8K (elementary word problems)
  • Medium math: MATH, AMC23
  • Hard math: AIME24, AIME25 (competition-level)
  • General reasoning: CSQA (commonsense), GPQA (graduate-level science)

Baselines included vanilla GRPO, a uniform length penalty (VLP), and ASRR -- an adaptive length-penalty method that also uses group success rate but focuses only on suppressing length rather than reallocating compute.

The numbers

With the 8B backbone, CODA attains the highest overall accuracy (65.6%), outperforming all baselines. Meanwhile, it reduces the average token cost by 16% compared to GRPO (2982 vs. 3546 tokens), primarily by cutting redundant tokens on easier tasks while preserving compute on harder ones.

The per-task breakdown is where the real story is:

  • On SVAMP (easy arithmetic), CODA cuts tokens from 812 to 203 -- a 75% reduction -- with no accuracy loss.
  • On GSM8K, token usage drops 62% while matching GRPO's accuracy exactly.
  • On AIME24 (hard competition math), CODA uses nearly the same token budget as GRPO and matches its accuracy.
  • On AIME25, CODA slightly outperforms GRPO (22.9% vs. 22.1%) while using 2% fewer tokens.

Compare this to ASRR, the closest competitor. On AIME25 with the 8B backbone, ASRR reduces the average token cost from 7389 to 5950, but its accuracy drops from 22.1% to 18.8%. CODA avoids this trade-off because it does not globally suppress length -- it only penalizes length when extra tokens are unlikely to help.

The real breakthrough: preserving reflection on hard problems

The most subtle and important result is about what CODA does to reasoning quality, not just length. The team measured reflection ratio -- the fraction of responses that contain backtracking or verification language (words like "re-evaluate," "double-check," "wait"). Both reflection metrics of CODA are comparable to GRPO, suggesting that the easy-side regularization does not suppress reflection on hard problems, but mainly removes redundant reasoning when it is unhelpful.

Length-penalty baselines like VLP and ASRR, by contrast, reduce reflection ratios and the rate at which reflective responses are correct. They are not just making responses shorter -- they are making the model less likely to catch its own mistakes on hard problems.

The qualitative example in the paper drives this home. Given a simple word problem, GRPO generates hundreds of words restating the problem from multiple angles before arriving at a trivial subtraction. CODA produces a clean four-step solution and stops. Same answer, a fraction of the tokens.

Robustness and limitations

The team stress-tested CODA by training on deliberately skewed datasets: one containing only easy problems (GSM8K + MATH level-1) and one containing only very hard problems (DeepScaleR instances where a solver model succeeded less than 10% of the time). CODA remains effective under distribution shifts, despite being trained on heavily skewed data. The gating weights automatically adjust: easy training drives w_easy to dominate, hard training activates w_hard.

There are real limitations to acknowledge. The difficulty signal relies on sampling G=16 rollouts per prompt, which is noisy when the group is small or rewards are sparse. The experiments were also capped at 16K token context windows on 8B and 14B models -- for extremely hard problems, this caused some productive reasoning chains to be cut off. The authors note that scaling to longer contexts and larger models is left for future work.

What this means in practice

CODA is a training-time intervention, not an inference-time one. You apply it during RL fine-tuning and the resulting model automatically adjusts its reasoning depth at inference without any special prompting or budget specification. The code is available on GitHub and the method is implemented on top of verl, a widely used open-source RL training framework.

The practical use cases are clearest for anyone running reasoning models at scale:

  • Mixed-difficulty workloads -- customer support, coding assistants, or math tutoring systems where query difficulty varies wildly. CODA automatically gives simple queries a fast path.
  • Cost-sensitive deployments -- any setting where token cost matters. A 60%+ reduction on easy queries can meaningfully change the economics of a deployed system.
  • Research on efficient RL -- CODA's dual-gate reward shaping is a clean, modular addition to GRPO that other researchers can build on.

The broader point is that the "think longer = think better" heuristic only holds when the problem actually warrants it. CODA gives models the ability to make that judgment themselves, without needing a human to specify a budget or a separate classifier to route queries. That autonomy is what separates it from prior work -- and it is what makes the efficiency gains hold up even on the hardest benchmarks.