How to Evaluate LLM Intelligence and Coding Capability Scientifically
This article explains how engineering teams should evaluate large language models beyond chasing "the strongest model." It covers decomposing intelligence into measurable dimensions, building reproducible evaluation sets, designing coding-specific benchmarks, embedding evaluation into development workflows, and applying cost, latency, and routing strategies. It concludes with an actionable checklist for establishing a repeatable evaluation system.
Introduction: From “Swapping Models” to “Building Capability”
Many developers have had a similar experience: when they first started using AI coding tools, generated code required repeated rework; as the tools improved, the same problems quickly produced usable solutions. This naturally raises a question: is my improvement coming from my own accumulated skill, or from the tool?
The answer determines where a team should invest. If efficiency gains are attributed entirely to “switching to a stronger model,” capability building degenerates into procurement. If it is decomposed into “model capability × context organization × verification methods × engineering constraints,” there is far more room for optimization. This article presents an evaluation methodology based on the latter perspective.
1. Why “The Strongest Model” Is a False Premise
Model capability is not a scalar; it is a vector over a distribution of tasks. The same model may be stable in structured code generation yet lose constraints during long-chain refactoring; it may be accurate in Chinese semantic understanding yet prone to errors in cross-file dependency reasoning. Therefore, the statement “highest intelligence” lacks a verifiable definition.
A more rigorous formulation is: under a clearly defined task set, explicit constraints, and explicit evaluation metrics, which model has the highest overall benefit? That benefit includes at least four components:
- Effectiveness: task completion rate and result correctness
- Stability: variance of results across repeated runs with the same input
- Cost: resource consumption per task
- Latency: end-to-end response time, especially first-token latency in interactive scenarios
Any ranking detached from the task distribution has no engineering significance.
2. Breaking “Intelligence” into Observable Dimensions
Before evaluating, decompose. In practice, it is advisable to break an LLM’s intelligence into six independently measurable dimensions:
- Reasoning depth: multi-step logic, constraint satisfaction, boundary condition identification
- Code capability: syntactic correctness, semantic correctness, maintainability, test pass rate
- Long-context utilization: locating key information in long documents while maintaining global consistency
- Instruction following: compliance with format, role, and prohibition constraints
- Tool calling: function selection accuracy, parameter-filling correctness, multi-turn error recovery
- Knowledge recency and hallucination rate: tendency to decline to answer uncertain questions and factual consistency
The benefit of decomposition: the conclusion becomes “this model regressed 12% on the long-context dimension” rather than “this model got worse.” The former can be traced to a specific area; the latter only triggers blind replacement.
3. Building a Reproducible Evaluation Set
The biggest enemy of evaluation is non-reproducibility. Build internal evaluation assets as follows:
- Real sources: sample from historical tickets, code review comments, and production defects, rather than public benchmark questions
- Stratified sampling: stratify by business domain, difficulty, and code scale so long-tail tasks are not drowned out
- Fixed inputs: manage prompt versions, contexts, and parameter configurations under version control
- Automated judgment: where unit tests can determine an outcome, do not use manual scoring
A skeleton evaluation harness (the interface shown is an abstract illustration; replace it with the invocation method of your model service in practice):
from dataclasses import dataclassfrom typing import Callable@dataclassclass Case:case_id: strprompt: strcontext: strtests: list[str] # Automatically executable checkstags: list[str] # Business domain / difficultydef run_eval(cases: list[Case],model_call: Callable[[str, str], str],run_tests: Callable[[str, list[str]], bool],repeat: int = 3) -> dict:stats: dict[str, list[bool]] = {}for c in cases:results = []for _ in range(repeat): # Repeated sampling to observe stabilityanswer = model_call(c.prompt, c.context)results.append(run_tests(answer, c.tests))for tag in c.tags:stats.setdefault(tag, []).extend(results)return {tag: sum(v) / len(v) for tag, v in stats.items()}
The repeat parameter is an easily overlooked key point: a single sample reflects luck; repeated samples reflect capability. High variance means the model’s output is uncontrollable, and even a high average is unsuitable for an automated pipeline.
4. Coding-Specific Evaluation Essentials
General-purpose leaderboards cannot replace scenario-based evaluation. For coding scenarios, focus on four task types:
- Snippet generation: given a function signature and comment, generate an implementation and judge it with unit tests
- Defect localization: given an error stack and related code, identify the root-cause file and line
- Refactoring and migration: change structure while preserving behavior, guarded by regression tests
- Cross-file modification: add a new field and propagate it through interfaces, storage, validation, and frontend display
Scoring should not stop at “passed or not”; also record manual rework time. A solution that passes tests but has messy structure will keep generating costs in later iterations. Consider lightweight static checks (complexity, duplication, naming consistency) as auxiliary metrics.
5. From Model Capability to Engineering Capability
Evaluation scores only create value when embedded in development workflows. In practice, four categories of infrastructure are typically needed:
- Context provisioning: generate candidate context via code retrieval and dependency analysis, controlling injection length
- Sandbox execution: run generated code and tests in isolated containers, restricting resources and network permissions
- Logging and monitoring: record prompt versions, model versions, latency, token consumption, and failure reasons; configure alert thresholds
- Artifact and configuration management: bring prompt templates, evaluation sets, and judgment scripts under version control
Engineering constraints often determine the final outcome more than model choice. The same model, in a workflow with complete context and automated test guards, will have a markedly higher usability rate than with raw invocation.
6. Cost, Latency, and Routing Strategy
In practice, a single model rarely wins in all scenarios. A more common approach is tiered routing: simple completions go through a low-latency, low-cost channel; complex refactoring goes through a high-quality channel; high-risk changes require mandatory human review. Routing thresholds should be determined by evaluation data, not set subjectively.
Establish cost observability: track average consumption per task type and the additional overhead from failed retries. Retry rate is the most easily underestimated cost item — a 5% drop in stability can cause 20% more calls.
7. Conclusion and Action Checklist
Returning to the original question: does capability come from yourself or the tool? The more accurate answer is that the tool amplifies engineering capability but cannot replace it. The actionable checklist:
- Spend one week distilling 50–100 internal evaluation samples from real tickets
- Establish automated judgment and repeated sampling, outputting per-dimension metrics instead of a single total score
- Complete sandbox, logging, and monitoring infrastructure before discussing model selection
- Re-run the fixed evaluation set quarterly, focusing on trends rather than absolute values
- Put prompts and evaluation sets under version management so conclusions are traceable and reproducible
Once an evaluation system is in place, “which model is the most intelligent” is no longer a question that needs arguing about — it becomes an experiment you can rerun at any time.
