Reasoning evaluation: the same score can hide different failures
推理能力评测
Evaluate original arithmetic variants by slice and by template, with explicit rule baselines.
reasoning-evaluationBoth scored nine out of twelve
Two programs answer twelve arithmetic questions. Each gets nine right. One memorizes the answers to familiar wording and fails when the quantities change. The other performs the arithmetic but also adds an irrelevant shelf number. A single total gives them the same score while hiding different repair needs.
This is an original controlled experiment, not a language-model contest. Transparent rule programs serve as non-AI baselines. The aim is to design an evaluation that distinguishes success on known examples from handling valid task variations. A natural-language explanation can help inspect an answer, but its presence does not establish that the stated steps caused the model’s answer.
GSM8K introduced human-written grade-school math problems with natural-language solutions. Use a pinned version and split when reporting results; the first paper’s rounded dataset counts do not define every later downloaded copy. GSM8K paper
A transformation needs an answer rule
Let x be a question and g(x) its reference answer. A transformation T can preserve the answer, such as renaming a person, or change it in a known way, such as altering a quantity. State that relationship before judging the model:
The second form permits using the original question’s quantities; an old answer alone may not contain enough information to calculate the new one. Check validity constraints too: giving away more tiles than the person owns changes the domain of our nonnegative-count exercise. A fluent rewritten question is not automatically a valid test case.
GSM-Symbolic constructs constrained variants of math templates and examines changes in quantities and irrelevant clauses. Its reported failures concern the tested models, prompts and budgets; they do not prove that all language models are incapable of reasoning. GSM-Symbolic
For n questions, record correctness and whether the system returned an answer. Our scorer treats an abstention as incorrect for overall accuracy and reports coverage separately:
When each template t has a set V_t of variants, count how many templates survive every prescribed variation. This is a deliberately strict robustness measure, and its value depends on which variants you include:
Two systems with the same accuracy can disagree on every error. Compare them on the same cases with paired counts, where c_i is a correctness indicator:
HELM frames evaluation as coverage of scenarios and multiple metrics, including robustness under specified perturbations. A local invariance test is a particular slice of behavior, not a complete measure of general reasoning. HELM
Build a small test whose answers can be audited
Each of three templates has four versions: base, renamed person, changed quantities and an irrelevant shelf label. Base quantities are 4 and 3; changed quantities are 5 and 3. Their addition, subtraction and multiplication answers change from 7,1,12 to 8,2,15. The shelf label 7 changes none of them. Names and tile stories are invented.
Run with Python 3.12; no external package is required. The grammar baseline recognizes three exact sentence patterns and computes the corresponding operation. The memorized baseline returns the base answer from keywords. The sweeper computes the operation but adds any numbers after the first two. All three are explicit mechanisms, not descriptions of a language model’s internals.
"""Metamorphic evaluation of three rule programs on original arithmetic templates."""
import json,re
OPS=('add','subtract','multiply')
def make(op,a,b,name='Rin',extra=None):
if op not in OPS or any(type(x) is not int or not 1<=x<=20 for x in [a,b]) or (op=='subtract' and b>a):raise ValueError('valid bounded arithmetic instance required')
if name not in ['Rin','Sol']:raise ValueError('choose an authored fictional name')
if extra is not None and (type(extra) is not int or not 1<=extra<=20):raise ValueError('bounded shelf label required')
if op=='add':text=f'{name} has {a} red tiles and {b} blue tiles. How many tiles altogether?';answer=a+b
elif op=='subtract':text=f'{name} has {a} tiles and gives away {b} tiles. How many remain?';answer=a-b
else:text=f'{name} packs {a} boxes with {b} tiles each. How many tiles are packed?';answer=a*b
if extra is not None:text+=f' The shelf label is {extra}.'
return dict(template=op,text=text,answer=answer)
def grammar_solver(text):
if not isinstance(text,str) or len(text)>500:raise ValueError('bounded text required')
patterns=[(r'^(?:Rin|Sol) has (\d+) red tiles and (\d+) blue tiles\.',lambda a,b:a+b),(r'^(?:Rin|Sol) has (\d+) tiles and gives away (\d+) tiles\.',lambda a,b:a-b),(r'^(?:Rin|Sol) packs (\d+) boxes with (\d+) tiles each\.',lambda a,b:a*b)]
for pattern,fn in patterns:
match=re.match(pattern,text)
if match:return fn(*map(int,match.groups()))
return None
def sweeper(text):
result=grammar_solver(text)
if result is None:return None
values=list(map(int,re.findall(r'\d+',text)))
return result+sum(values[2:])
def lookup(text):
if 'red tiles' in text:return 7
if 'gives away' in text:return 1
if 'boxes with' in text:return 12
return None
def evaluate(rows,solver):
if not rows:raise ValueError('nonempty evaluation rows required')
outputs=[solver(r['text']) for r in rows];correct=[p==r['answer'] for p,r in zip(outputs,rows)]
variants=sorted({r['variant'] for r in rows});templates=sorted({r['template'] for r in rows})
by_variant={v:sum(c for c,r in zip(correct,rows) if r['variant']==v)/sum(r['variant']==v for r in rows) for v in variants}
all_variants=[all(c for c,r in zip(correct,rows) if r['template']==t) for t in templates]
return dict(accuracy=sum(correct)/len(rows),coverage=sum(p is not None for p in outputs)/len(rows),by_variant=by_variant,all_variants_per_template=sum(all_variants)/len(templates),outputs=outputs,correct=correct,templates=len(templates),rows=len(rows))
def demo():
rows=[]
for op in OPS:
for variant,args in [('base',dict(a=4,b=3)),('rename',dict(a=4,b=3,name='Sol')),('numbers',dict(a=5,b=3)),('irrelevant',dict(a=4,b=3,extra=7))]:
rows.append(dict(variant=variant,**make(op,**args)))
result={name:evaluate(rows,fn) for name,fn in [('grammar',grammar_solver),('memorized',lookup),('sweeper',sweeper)]}
paired={}
for a,b in [('grammar','memorized'),('memorized','sweeper')]:
x=result[a]['correct'];y=result[b]['correct'];paired[a+'_vs_'+b]=dict(first_only=sum(i and not j for i,j in zip(x,y)),second_only=sum(j and not i for i,j in zip(x,y)),both=sum(i and j for i,j in zip(x,y)))
return dict(rows=rows,results=result,paired=paired,unrecognized=grammar_solver('Rin owns four boxes containing three tiles each.'),scope='Twelve authored variants from three templates; programs are transparent baselines, not language models or independent random test draws.')
if __name__=='__main__':print(json.dumps(demo(),indent=2,allow_nan=False))
The grammar program scores 12/12. Both fragile programs score 9/12: memorization fails all three quantity changes, while the sweeper fails all three irrelevant-label cases. Each wins three paired cases against the other, with six shared successes. Their all-variants template robustness is zero; the grammar program’s is one.
The grammar baseline rejects an unrecognized paraphrase about “four boxes containing three tiles each.” Perfect accuracy on its own grammar therefore establishes no broad language understanding. Its parser also recognizes the prescribed prefix rather than validating arbitrary additions. Keep evaluation inputs inside the declared generator contract, and test any extension separately.
For n bounded strings of length L, the fixed simple scans cost O(nL); reporting stores O(n) outputs. There are twelve cases but only three source templates. They are authored correlated variants, not twelve independent random tasks. The program gives exact descriptive counts and makes no statistical confidence claim.
Prevent the evaluation from teaching to its own test
For a real model study, reserve templates and examples before prompt selection; document model version, decoding, demonstrations, tool access, attempts and token budget. Check reference solutions independently, and separate malformed output, wrong arithmetic, invalid transformations and judging ambiguity. A grader’s error is not automatically a solver’s reasoning failure.
Report scores by transformation, template and relevant subgroup, then inspect paired cases. If estimating uncertainty for sampled templates, preserve the dependence of their variants, for example by resampling entire template groups under an appropriate sampling design. More variants of the same template do not provide the same evidence as new independent templates.
A hidden test reduces direct tuning on its answers, but does not by itself establish absence of training contamination. Compare fresh, valid variants and document what provenance is known. Passing exact-match arithmetic is one capability under one budget. Evaluate explanations, transfer and real application constraints separately; avoid converting an isolated failure into a claim about every possible system. See verifiable rewards for the related distinction between a checker and the intended task.
Look behind the total
- Why do the two 9/12 programs need different repairs?
Answer: One ignores changed quantities; the other uses irrelevant numbers. Their aggregate scores match, but their failure slices reveal different mechanisms.
- Replace 4 boxes with 5 while retaining 3 tiles per box. Should an answer-preservation test expect 12?
Answer: No. This is an answer-changing transformation: the new answer is 15. Treating it as invariant would penalize correct reasoning.
- Does the grammar program’s 12/12 prove it understands arbitrary paraphrases?
Answer: No. The supplied paraphrase returns no answer. The perfect score covers its twelve generated strings, not language outside the parser’s patterns.
- Can a confidence interval treat all variants from a shared template as independent tasks?
Answer: Not without a justified independence model. Shared structure induces dependence. Define the sampled unit and, where suitable, analyze or resample whole template groups.
From word problems to evaluation coverage
GSM8K supplies a problem-and-solution benchmark design, GSM-Symbolic probes controlled variation, and HELM makes evaluation coverage explicit. The present twelve examples are newly authored and contain no copied benchmark items. Their numbers explain the measurement choices; they are not performance estimates for an LLM.
Make a prediction, then check
Two systems score 9/12. Must they fail on the same cases?
Learning objectives
- Build valid answer-changing and answer-preserving transformations and report correlated cases honestly.
- Run the original finite experiment and explain its counterexample and scope.
Prerequisites & connections
Explore related knowledge →References
- Training Verifiers to Solve Math Word Problems — v1
Karl Cobbe; Vineet Kosaraju; Mohammad Bavarian; Jacob Hilton; Reiichiro Nakano; Christopher Hesse; John Schulman · 2021 - GSM-Symbolic: Understanding the Limitations of Mathematical Reasoning in Large Language Models — v1
Iman Mirzadeh; Keivan Alizadeh; Hooman Shahrokhi; Oncel Tuzel; Samy Bengio; Mehrdad Farajtabar · 2024 - Holistic Evaluation of Language Models — v1
Percy Liang; Rishi Bommasani; Tony Lee and coauthors · 2022
Version1 · Editorial status: Recorded technical checks completed
View technical check record (AI)
Codex · 2026-09-20 · Single AI author. Viewed PDF3: human-written math tasks and natural-language solutions; first-version rounded split counts. Viewed PDF5/10: constrained template variants and irrelevant clauses; results do not prove universal inability to reason. Viewed PDF5/29/31: scenario/metric coverage, calibration, local invariance and robustness; title/authors also read from page1 text. 4 paired equations and four explained exercises. All small arithmetic combinations, answer-changing variants, equal totals/different slices, paired outcomes and correlated-template scope checked. Rule programs are not LLMs.
- All small arithmetic combinations, answer-changing variants, equal totals/different slices, paired outcomes and correlated-template scope checked. Rule programs are not LLMs.
- Four computed SVG variants per topic;11 numeric/geometry tests and36 responsive cases passed. Twelve selected final captures directly viewed. Full article acceptance recorded separately.
Source locations checked:
- Training Verifiers to Solve Math Word Problems — v1 · Viewed PDF3: human-written math tasks and natural-language solutions; first-version rounded split counts.
- GSM-Symbolic: Understanding the Limitations of Mathematical Reasoning in Large Language Models — v1 · Viewed PDF5/10: constrained template variants and irrelevant clauses; results do not prove universal inability to reason.
- Holistic Evaluation of Language Models — v1 · Viewed PDF5/29/31: scenario/metric coverage, calibration, local invariance and robustness; title/authors also read from page1 text.
Related topics