DeepSeek R1 Evaluation: Six Key Steps to Building a Trustworthy Model Evaluation
This article explains why casual, hands-on impressions of large language models rarely hold up as evidence, and lays out a reproducible framework for evaluating models such as DeepSeek R1. It covers tiering capabilities by difficulty (L1–L4), designing math-reasoning benchmarks with private question sets and unified conditions, using multiple sampling with pass@k and majority-vote metrics, extracting and normalizing verifiable answers, a minimal working evaluator in Python, assessing open-ended problems that have no standard answer, measuring subjective qualities like reasoning conciseness and writing naturalness through blind pairwise tests, translating capability into cost and latency, and closing the loop from offline evaluation to online selection. A final checklist helps turn "which model is stronger" debates into defensible engineering decisions.
1. The Problem: Why “Model Strength Rankings” Rarely Convince Anyone
In technical communities, ranking different large language models against each other is one of the most common discussions, and mathematical reasoning ability is often treated as the core dimension that separates models by “tier.” Three types of judgments commonly appear:
- Tiering judgment: There are clear gaps in math and complex reasoning ability between models, and only a few can reliably handle hard, open-ended problems;
- Generation judgment: Within the same model family, different generations and specification variants show a continuous transition in capability, so you should not infer strength from the version number alone;
- Style judgment: Whether the chain of thought is verbose and whether the output reads naturally directly affect the real-world experience.
These judgments have observational value, but most come from personal experience and are hard for others to reproduce. More importantly, evaluating a model purely by conversational “feel” faces at least four kinds of bias:
- Question bias: The tester happens to be familiar with a certain type of question, or the question itself is relatively easy and fails to separate the models;
- Prompt bias: How the prompt is written, whether examples are given, and whether the model is asked to “think step by step” can all significantly change the results;
- Parameter bias: Different sampling temperature, maximum output length, thinking budget, and other settings naturally make results incomparable;
- Version bias: Cloud-hosted models may be updated or have their default parameters adjusted without the user noticing, so conclusions from a few months ago may no longer hold.
Therefore, scientifically evaluating a large model should follow one principle: replace scattered subjective impressions with a reproducible question set, unified evaluation conditions, and verifiable answers. The goal of evaluation is to answer three engineering questions: Can the model get it right? How stable is it? Is it worth using?
2. Tier Model Capabilities First: Different Difficulty, Different Tests
Asking directly “who is stronger” often fails to produce a useful conclusion, because the gaps between models are not consistent across capability levels. Tasks can be divided into four tiers by difficulty:
| Tier | Typical tasks | Main focus | Common evaluation methods |
|---|---|---|---|
| L1 Basic | Factual Q&A, information extraction, text summarization | Accuracy and instruction following | Exact match, field validation |
| L2 Intermediate | Multi-step word problems, routine code writing and modification | Multi-step reasoning and correctness | Verifiable answers, unit tests |
| L3 Hard | Competition-level math, complex system design and refactoring | Deep reasoning and long-chain stability | Verifiable answers plus human review |
| L4 Frontier | Open math problems, research-level problems | Exploration depth and result correctness | Expert review, formal verification |
Tiering offers two takeaways:
- When choosing a model, first clarify which tier your needs fall into. Most business scenarios sit at L1 and L2, and there is no need to pay a disproportionate cost for L4 capability;
- Tiered question sets should report accuracy per tier. A single aggregate score can easily mask weaknesses — for example, a model may excel at basic tasks but see a sharp drop in accuracy on hard questions.
3. Math Reasoning Evaluation: Key Design for Scoring Correctly
3.1 Difficulty Tiering and Private Question Sets
Build the question set in tiers from L1 to L4, keeping the number of questions per tier as balanced as possible to enable fair horizontal comparison.
The weakness of public benchmarks is that training data may contain the questions or their variants, so a model may “recall answers” rather than truly reason. It is recommended to maintain a private, held-out question set:
- Questions come from real enterprise business, or are written or adapted by the team and never made public;
- Periodically rotate some questions to prevent the set itself from being “gamed” for the leaderboard;
- For questions whose sources can be publicly verified, you can require the model to first reproduce the reasoning approach and then give the answer, reducing the chance of scoring purely from memorization.
3.2 Unified Evaluation Conditions
All objects being compared must run under the same conditions:
- The same prompt template, temperature, maximum output length, and thinking budget;
- The same call time window, to avoid mixing old and new versions;
- Obtain and record the model identifier and version information through the API, and note the collection date in the report.
3.3 Multiple Sampling and Statistical Significance
A single evaluation run has strong randomness. It is recommended to sample each question n times (n ≥ 3; 5 balances cost and stability well) and report the following metrics:
- pass@k: the proportion of questions answered correctly at least once across n samples, measuring the upper bound of capability;
- Majority-vote accuracy (self-consistency): take the majority answer across multiple samples, then judge correctness, measuring the ability to stably produce correct results;
- Format compliance rate: the proportion of answers output in the agreed format, reflecting instruction-following ability.
When single-pass accuracy and majority-vote accuracy differ greatly, the model “can do it but is not stable,” which can be compensated for by improving prompts, constraining output format, or increasing the number of samples.
When the number of questions is small, a gap of a few percentage points may just be random fluctuation. Report sample size and confidence intervals to avoid mistaking noise for conclusions.
3.4 Final Answer Extraction and Equivalence Judgment
The following conventions must be clearly defined:
- Require the model to output the final answer with a fixed marker, such as
Final answer: <answer>; - When extracting, take only the content after the last marker, to avoid misclassifying intermediate values that appear during reasoning as the answer;
- Normalize during judgment, such as unifying full-width and half-width characters, removing thousands separators, and stripping LaTeX wrappers;
- Compare numeric answers by relative error, and use a symbolic computation library to judge equivalence between fractions, decimals, and radicals.
3.5 Process Quality
A correct answer does not mean reliable reasoning. It is recommended to record the following process metrics to provide a basis for later analysis:
- Reasoning length (number of chain-of-thought tokens);
- Whether the model fails to self-correct after a calculation error;
- Whether it introduces assumptions not given in the question.
4. Sample Code: A Minimal Working Evaluator
The example below uses a custom DSL to simulate fraction arithmetic, demonstrating an evaluation flow of “tiered question set + multiple sampling + verifiable answers.”
Step 1: Define the domain language and evaluator. This kind of specialized language has simple syntax and clear rules, making it suitable for precisely verifying reasoning ability.
# ===== Step 1: Define the domain language and evaluator =====# Grammar example (custom DSL):# expr := term (('+' | '-') term)*# term := factor (('*' | '/') factor)*# factor := INT | '(' expr ')'# Task: compute the expression and output "Final answer: <simplest fraction>"from fractions import Fractiondef tokenize(s: str):tokens, i = [], 0while i < len(s):if s[i].isspace():i += 1elif s[i] in "+-*/()":tokens.append(s[i])i += 1elif s[i].isdigit():j = iwhile j < len(s) and s[j].isdigit():j += 1tokens.append(s[j - j + i:j]) # equivalent to s[i:j]i = jelse:raise ValueError(f"Invalid character: {s[i]}")tokens.append("#") # end markerreturn tokensclass Parser:def __init__(self, tokens):self.tokens, self.pos = tokens, 0def peek(self):return self.tokens[self.pos]def eat(self):tok = self.peek()self.pos += 1return tokdef parse(self):value = self.expr()assert self.peek() == "#", "extra unparsable content"return valuedef expr(self):value = self.term()while self.peek() in ("+", "-"):op, rhs = self.eat(), self.term()value = value + rhs if op == "+" else value - rhsreturn valuedef term(self):value = self.factor()while self.peek() in ("*", "/"):op, rhs = self.eat(), self.factor()value = value * rhs if op == "*" else value / rhsreturn valuedef factor(self):tok = self.eat()if tok.isdigit():return Fraction(int(tok))if tok == "(":value = self.expr()assert self.eat() == ")", "unmatched parenthesis"return valueraise ValueError(f"Cannot parse token: {tok}")def evaluate(text: str) -> Fraction:"""Evaluator: takes expression text as input and returns the exact result"""return Parser(tokenize(text)).parse()
Step 2: Wrap model invocation in a unified interface. The example uses a cloud-service-style general conversation API; for locally deployed models, switch to the equivalent interface exposed by the local service — only replace this layer and the rest of the code needs no changes.
# ===== Step 2: Wrap model invocation in a unified interface =====import jsonimport osimport timeimport urllib.requestAPI_BASE = os.environ["LLM_API_BASE"] # endpoint URL from the cloud consoleAPI_KEY = os.environ["LLM_API_KEY"] # API key from the cloud consoleMODEL = os.environ.get("LLM_MODEL", "your-model-name")def chat(prompt: str, temperature: float = 0.0,max_tokens: int = 2048, timeout: int = 120) -> dict:"""Call a chat/completions-style general conversation API and return the raw response"""url = f"{API_BASE.rstrip('/')}/chat/completions"body = {"model": MODEL,"messages": [{"role": "user", "content": prompt}],"temperature": temperature,"max_tokens": max_tokens,}req = urllib.request.Request(url,data=json.dumps(body).encode("utf-8"),headers={"Content-Type": "application/json", "Authorization": f"Bearer {API_KEY}"},method="POST",)t0 = time.perf_counter()with urllib.request.urlopen(req, timeout=timeout) as resp:data = json.loads(resp.read().decode("utf-8"))data["latency_ms"] = round((time.perf_counter() - t0) * 1000)return data
Step 3: Complete judgment, sampling, and aggregation to form a per-difficulty report. The main logic is as follows, and can be further extended in real use:
- Error classification (calculation errors, format errors, timeouts, etc.);
- Save each question’s raw model output for later review.
# ===== Step 3: Run the main evaluation loop =====import randomimport reimport statisticsimport unicodedatafrom collections import defaultdictSYSTEM_PROMPT = ("You are a rigorous calculation assistant. Compute the given arithmetic expression step by step, ""using exact fractions for all intermediate steps and reducing the result to its simplest fraction. ""On the last line output only: Final answer: <simplest fraction> (form a/b, integers written directly)")def generate_cases(n_basic: int = 40, n_hard: int = 30, seed: int = 0):"""Generate questions by difficulty level; each is (id, question, executable-checkable answer, level)"""rng = random.Random(seed)cases, cid = [], 0# L2 basic: two-level operations, testing exact fraction arithmetic and operator precedencefor _ in range(n_basic):a, b = rng.randint(1, 20), rng.randint(2, 9)c = rng.randint(1, 20)d, e = rng.randint(2, 9), rng.randint(2, 9)g = rng.randint(1, 20)h = rng.randint(1, 20)i = rng.randint(1, 9)j = rng.randint(1, 9)expr = (f"{a}/{b} + {c} * {d}/{e} - ({g} - {h}) / {i * j}")cases.append((cid, expr, evaluate(expr), "L2"))cid += 1# L3 hard: randomly and recursively generate nested-parenthesis expressions, testing long-chain computation stabilitydef gen(depth: int) -> str:if depth == 0 or rng.random() < 0.25:return str(rng.randint(1, 12))op = rng.choice(["+", "-", "*", "/"])left, right = gen(depth - 1), gen(depth - 1)if op == "/" and right == "0":right = "1"return f"({left}{op}{right})"for _ in range(n_hard):expr = gen(3)cases.append((cid, expr, evaluate(expr), "L3"))cid += 1return casesdef normalize_answer(text: str):"""Normalization: full-width to half-width, remove whitespace and thousands separators"""s = unicodedata.normalize("NFKC", text or "").strip()s = re.sub(r"[\s,]", "", s)return sdef extract_final_answer(output: str):"""Extract the content after the last 'Final answer:' marker"""parts = (output or "").split("Final answer:")return normalize_answer(parts[-1]) if len(parts) > 1 else Nonedef is_correct(pred, gold: Fraction, rel_tol: float = 1e-6) -> bool:"""Numeric equivalence check: fractions and decimals are both accepted; correct if relative error is within tolerance"""if pred is None:return Falsetry:return abs(float(Fraction(pred)) - float(gold)) <= rel_tol * abs(float(gold))except (ValueError, ZeroDivisionError):return False # unparseable answers count as wrong and can be categorized separately in the reportdef evaluate_model(n: int = 5, temperature: float = 0.7, limit: int | None = None):cases = generate_cases()if limit:cases = cases[:limit]stats = defaultdict(lambda: {"pass": 0, "vote": 0, "tokens": [], "latency": []})for cid, expr, gold, level in cases:prompt = f"Please compute: {expr}"samples = []for _ in range(n):try:resp = chat(prompt, temperature=temperature)choice = (resp.get("choices") or [{}])[0]usage = resp.get("usage") or {}samples.append({"ok": is_correct(extract_final_answer(choice.get("message", {}).get("content")), gold),"tokens": usage.get("completion_tokens", 0),"latency": resp["latency_ms"],})except Exception:samples.append({"ok": False, "tokens": 0, "latency": 0}) # timeouts, rate limits, etc. count as failuress = stats[level]s["pass"] += any(x["ok"] for x in samples) # pass@ns["vote"] += sum(x["ok"] for x in samples) * 2 > n # majority votes["tokens"].append(sum(x["tokens"] for x in samples) / n)s["latency"].append(statistics.mean(x["latency"] for x in samples))report = []for level in sorted(stats):s, k = stats[level], len(cases) // 2 if level == "L2" else len(cases) - len(cases) // 2report.append({"level": level,"count": k,"pass@n": round(s["pass"] / k, 3),"majority_vote_accuracy": round(s["vote"] / k, 3),"avg_output_tokens": round(statistics.mean(s["tokens"]), 1),"avg_latency_ms": round(statistics.mean(s["latency"])),})return reportif __name__ == "__main__":print(json.dumps(evaluate_model(), ensure_ascii=False, indent=2))
The example output structure is as follows:
[{"level": "L2", "count": 40, "pass@n": 0.95, "majority_vote_accuracy": 0.93,"avg_output_tokens": 268.4, "avg_latency_ms": 2145},{"level": "L3", "count": 30, "pass@n": 0.67, "majority_vote_accuracy": 0.57,"avg_output_tokens": 912.7, "avg_latency_ms": 6380}]
As the example shows, the higher the difficulty tier, the lower the pass rate, the longer the reasoning, and the higher the latency. Therefore, evaluation conclusions should be interpreted in combination with accuracy, stability, cost, and latency, not from a single score alone.
5. Hard and Open Math Problems: How to Evaluate Questions “Without a Standard Answer”
L4 questions often have no ready-made answer, or verification is extremely costly, and this is also the part where community discussions are most prone to disagreement. Three feasible approaches exist:
- Necessary-condition checks: For problems that yield candidate conclusions, check several necessary conditions such as symmetry, special values, boundary cases, and numerical approximation. If a necessary condition fails, the candidate can be ruled out directly; if it holds, it can only serve as supporting evidence and cannot prove correctness;
- Formal verification assistance: Use theorem-proving tools to formalize key lemmas or conclusions and have a machine check them, which reduces the manual review burden, though formalization itself requires mathematical skill;
- Expert blind review: Have domain experts score without knowing the model’s identity, on correctness, novelty, and rigor, and use cross-review to reduce individual subjective bias.
It must be clear that strong performance on public benchmarks does not mean reliable results on open problems. Judgment of this capability should be based on a reproducible verification process, not on individual cases.
6. Don’t Ignore Subjective Dimensions: Chain-of-Thought Conciseness and Writing Naturalness
In community discussions, a model’s reasoning style and writing are often treated as important evaluation points, such as “whether the chain of thought is verbose” and “whether the writing is natural.” These dimensions matter and likewise require rigorous measurement.
Paired blind test. Give the same prompt to two models to generate results, hide the model identities and randomly swap the presentation order, and have reviewers choose one as “overall better.” A setup could be:
- Multiple reviewers, each reviewing many pairs;
- Randomly swapping the presentation order to eliminate position preference;
- Recording each reviewer’s choice and computing win rate and consistency.
Conciseness metrics. Compute the average reasoning length, and combine it with “whether accuracy drops” to judge whether the long reasoning is necessary. Longer reasoning with higher accuracy means the difficulty is genuinely high; verbose reasoning without an accuracy improvement indicates redundant thinking.
Writing quality. Use an explicit rubric (e.g., structure, accuracy, language naturalness, and conciseness, each scored 1–5), have multiple people score, then take the average, and pay attention to inter-rater consistency.
Paired blind-test results can be summarized as follows:
| Comparison | A wins | B wins | Tie | Consistency |
|---|---|---|---|---|
| Writing naturalness (50 pairs) | 14 | 28 | 8 | 78% |
| Reasoning conciseness (50 pairs) | 31 | 9 | 10 | 84% |
This shows that one model can well be “more concise in reasoning and more likeable in writing,” and the two advantages do not always reside in the same model. When choosing, you need to clarify which kind of experience matters more based on business priorities.
7. Cost and Latency: Converting “Capability” into “Cost-Effectiveness”
Capability is only one dimension of selection. A common cost-effectiveness metric is “the added inference cost per 1% improvement in accuracy.” Inference cost can be approximated as the product of the number of output tokens and the unit price, and reasoning tokens are usually far longer than the final answer itself.
Engineering can adopt the following strategies:
- Difficulty routing: Route simple requests to a lightweight model and complex requests to a reasoning-oriented model;
- Length control: Constrain reasoning depth or output structure in the prompt to reduce redundancy;
- Sampling and caching: Trade off between consistency and cost, and cache results for repeated requests;
- Asynchronization: Run offline batch tasks asynchronously to reduce latency pressure on interactive scenarios.
These tasks can be done on a cloud platform:
- Store evaluation question sets and results in object storage for version management;
- Route invocation logs into a logging service for auditing and issue tracing;
- Use monitoring and alerting to track latency and error rates, preventing the evaluation pipeline itself from becoming a bottleneck.
8. From Evaluation to Selection: A Three-Step Loop
- Build an internal evaluation set: Cover real business scenarios, tiered from L1 to L4, and retain private questions;
- Run regular regression evaluations: Trigger automatically after model version updates or prompt adjustments, comparing per-difficulty metrics against the previous version, and alert promptly when there is a significant drop;
- Validate online: Run canary releases or A/B tests in real traffic, using business metrics as the final judge. Available metrics include task completion rate, manual correction rate, average interaction turns, and user feedback.
Offline and online evaluation metrics correspond as follows:
| Offline metric | Corresponding online observation |
|---|---|
| Per-difficulty accuracy | Task completion rate, manual correction rate |
| Format compliance rate | Downstream parsing failure rate |
| Average reasoning length and latency | Response time, invocation cost |
| Blind-test win rate | User adoption rate, satisfaction score |
9. Checklist and Conclusion
To assess a model’s performance, it is recommended to confirm each item:
- Unified evaluation conditions: prompt, temperature, output length, and thinking budget consistent;
- Tiered question set: L1–L4 all covered, with a private held-out set;
- Multiple sampling: at least n ≥ 3, reporting confidence intervals;
- Verifiable answers: clear extraction rules and equivalence judgment;
- Blind-test design: identities hidden, order randomized;
- Visible cost: record tokens and latency, focus on cost-effectiveness;
- Traceable versions: record model identifier and evaluation time;
- Regressable: automatically rerun and compare after version updates;
- Online validation: canary or A/B testing to confirm business gains;
- Bounded conclusions: distinguish “how it performs on this question set” from “generally stronger.”
Back to the original question: rather than arguing over whether one model can “beat” another, first clarify which tier of capability to examine, which question set to use, and by what standard to judge. When evaluation achieves tiered question sets, verifiable answers, unified conditions, traceable versions, and regressable conclusions, “who is stronger” turns from a war of words into a well-grounded engineering decision.
