Evaluating Open-Source Reasoning Models: Long-Chain Reasoning and Agentic Programming
The value of open-source reasoning models increasingly depends on their performance in long tasks. When selecting a model, developers must evaluate three key aspects simultaneously: accuracy, token consumption, and the closed-loop capability of agentic programming. This article details how to assess long-chain reasoning efficiency, set tiered token budgets for non-reasoning modes, evaluate agentic programming skills through closed-loop tasks, and implement best practices for caching and cost control.
1. Conclusion First
The value of open-source reasoning models increasingly depends on their performance in long tasks. A high score on a single problem does not mean the model is ready for production. When selecting a model, you must evaluate three things simultaneously: accuracy, token consumption, and the closed-loop capability of agentic programming. Below is an explanation of how to test each of these and how to set budgets.
2. Long-Chain Reasoning: More Thorough Search, But Cost Must Be Calculated
2.1 More Thorough Exploration of the Solution Space
On multi-step logic problems, a common issue with previous generation models was early stopping. The model would find a feasible solution and end its reasoning, missing other solutions. Newer reasoning models actively backtrack, propose hypotheses, and verify them one by one on certain complex problems, thereby reducing the occurrence of missed solutions.
This improvement is significantly influenced by task distribution. In the tests referenced in this article, the effect was notable on certain problem types, but it may not be the same for other types. Conclusions should be based on your own problem sets.
From an engineering perspective, this change is similar to a search algorithm shifting from a greedy strategy to a depth-first search with pruning. The model is no longer satisfied with the first feasible path; instead, it repeatedly tries among multiple branches and uses pruning to reduce ineffective exploration.
2.2 Token Consumption Becomes a New Bottleneck
Under the test conditions referenced in this article, the output token consumption for complex logic problems can increase significantly. As reasoning capabilities improve, the thinking budget also grows, and models tend to use up the given budget.
This makes “thinking efficiency” important. Thinking efficiency refers to how much accuracy improvement can be gained per unit of reasoning tokens. Leading models typically save more tokens at the same accuracy level, but the specific gap needs to be measured under unified conditions and should not simply adopt the multiples provided by others.
For developers, this directly impacts API costs and response latency. The example below shows the metrics that should be recorded simultaneously during evaluation. The data is illustrative and not the actual test result of any specific product.
# Illustrative code: Data is illustrative, not actual test of a specific productevaluation_metrics = {"accuracy": 0.95, # Accuracy"avg_output_tokens": 28000, # Average output tokens"cost_per_correct_answer": 0.76, # Cost per correct answer}
Looking only at accuracy masks the cost issue. If a model needs to spend six times the tokens to achieve the same accuracy, the total cost in high-concurrency scenarios might be unacceptable. It is recommended to also calculate the “accuracy per unit cost,” which is the number of correct answers obtained per unit of cost.
3. Non-Reasoning Mode: Tiered Token Budgets
The behavior of the non-reasoning mode is increasingly like an adaptive model with a smaller thinking budget. Simple problems can usually be completed with a few thousand tokens, while complex tasks might see output lengths grow to tens of thousands of tokens.
This brings up three practical issues:
- The output limit needs to be recalibrated. Keeping the old fixed limit may truncate complex tasks, resulting in incomplete answers. In automated evaluations, truncated results are often mistakenly recorded as answer failures.
- Costs can no longer be estimated directly based on the mode. The assumption that “non-reasoning mode equals low cost” no longer holds and requires dynamic monitoring.
- The reasoning mode can also exceed limits. Long chains of thought may exceed the limit under stricter budgets. Questions that exceed the limit should be counted separately and not confused with a lack of capability.
The recommended tiered invocation parameters are as follows. The values in the table are example starting values and need to be adjusted according to your own task distribution.
| Tier | Applicable Tasks | Output Limit (Starting Value) | Circuit Breaker Condition (Example) | Over-limit Handling |
|---|---|---|---|---|
| Non-reasoning, Simple | Short Q&A, format conversion | 4K | Single output exceeds 8K | Log the event, escalate to the complex tier |
| Non-reasoning, Complex | Multi-step analysis, minor code changes | 32K | Single request takes over 120 seconds, or single request cost exceeds 1% of daily budget | Truncate and alert, manual spot check |
| Reasoning Mode | Long-chain reasoning, hard problems | 80K | Timeout over 300 seconds, or two consecutive truncations | Counted as budget over-limit, not included in capability conclusion |
The entry point for tiered invocation is a lightweight classifier. It can determine which tier a task should go to based on features such as task length, number of files involved, and whether multi-step computation is needed. The classifier might misjudge. If the simple tier fails due to truncation, the system should automatically escalate to a higher-budget tier for a retry. Regardless of which tier is used, a maximum output token count should be set for each request, and an alert should be issued for over-limit requests.
4. Agentic Programming: Testing Capabilities with Closed-Loop Tasks
The early common single-shot generation evaluation involved providing a set of requirements and asking the model to write complete code in one go. This method is increasingly difficult to reflect real-world development. Real engineering is a closed loop: writing code, running tests, analyzing errors, locating root causes, and iterating.
The capability of agentic programming is primarily reflected in this closed loop. Whether the model can call tools to execute code, read error stacks, understand context dependencies, and perform multi-round corrections is the focus of evaluation.
The checklist below can be executed directly. The thresholds are just examples and should be adjusted based on your team’s existing baseline. When testing, fix the repository version, task set, and decoding parameters, and repeat each item several times to take the average or median to reduce randomness.
| Dimension | Metric Definition | Test Steps | Example Pass Threshold |
|---|---|---|---|
| Multi-file Understanding and Modification | Proportion of correctly locating files that need modification | Given a repository with over 30 files and 10 labeled defects, record the number of correct files the model locates | Location accuracy no less than 80% |
| Tool Invocation Robustness | Proportion of correct next-step actions after a command failure | Inject 20 controllable errors (missing dependencies, insufficient permissions, parameter errors), and count whether the model correctly interprets and adjusts | Correct adjustment rate no less than 75% |
| Iterative Convergence Speed | Average number of rounds from first failure to test pass | Select 15 real minor defects, record the number of interaction rounds for each task, and take the median | Median no more than 4 rounds |
| Long-Session Context Retention | Frequency of early constraints being violated in subsequent rounds | Set 5 constraints at the beginning of the session (e.g., do not modify public interfaces), and check for violations after the 20th round | Violation rate below 5% |
Test results should be recorded separately by dimension. If a dimension fails to meet the standard, first troubleshoot whether the problem lies in the prompt, tool configuration, or the model itself, before deciding whether to replace the model.
5. Caching and Cost Control
Caching high-frequency reasoning conclusions can reduce repetitive consumption, which is especially effective for recurring complex problems. However, the cached content may contain user data, source code, or internal information, so the storage method needs careful design.
- Encrypt storage and isolate by tenant or project.
- Set an expiration time to prevent stale conclusions from being reused long-term.
- Include the model version number in the cache key so that old conclusions automatically expire after a model upgrade.
- Verify if the problem is exactly the same before hitting the cache.
