-
-
Notifications
You must be signed in to change notification settings - Fork 100
MATH Level5 Accuracy Investigation
Date: October 31, 2025
Goal: Achieve 10/10 (100%) accuracy on MATH Level 5 benchmark
Current Status: 5/10 (50%) accuracy
Investigated and fixed multiple issues with MATH Level 5 evaluation, achieving reliable 50% accuracy. Tools and complex prompting strategies actually hurt performance instead of helping.
-
Problem: Original test counted
score >= 0.80as "correct" - Result: Reported 90% (9/10) when real accuracy was only 50% (5/10)
- Fix: Changed to ONLY use normalized exact matching
- Problem: LLM-based evaluator gave score 1.00 to completely wrong answers
-
Examples:
- Problem 5: Model answered
45, expected87.5→ Evaluator gave 1.00 - Problem 8: Model returned 3x3 matrix, expected 3x1 vector → Evaluator gave 1.00
- Problem 5: Model answered
- Fix: Removed evaluator from scoring logic, use only exact string matching
-
Problem:
re.searchextracted FIRST matrix instead of LAST - Impact: Problem 6 failed even though model gave correct answer
-
Fix: Changed to
re.findall(...matrices...)[-1]to get LAST matrix
-
Problem:
\frac{1}{5}didn't match1/5,\\\\line breaks not handled -
Fix: Added normalization for:
-
\frac{a}{b}→a/b -
\\\\→ space - Whitespace collapse
-
- Problem: Model responses incomplete, cut off mid-calculation
- Fix: Implemented continuation loop (max 10 attempts)
- Result: Helped on some problems but not enough to solve them
- Baseline (no tools): 5/10 = 50% accuracy ✅
- With tools (MATH + ANALYSIS): 4/10 = 40% accuracy ❌
- Enhanced prompting + tools: 0/10 = 0% (just outputs tool JSON) ❌
- Conclusion: Tools add complexity and confuse the model
- ✅ Problem 2: Polar coordinates (Precalculus)
- ✅ Problem 3: Trigonometric minimization (Precalculus)
- ✅ Problem 4: Reflection matrix (Precalculus)
- ✅ Problem 6: Vector reflection (Precalculus) - Fixed with matrix extraction
- ✅ Problem 10: Determinant calculation (Precalculus)
-
❌ Problem 1: Vector orthogonality
- Expected:
\frac{3}{8} - Got:
\frac{3}{\sqrt{10}} - Issue: Wrong algebraic manipulation
- Expected:
-
❌ Problem 5: Trigonometric sum
- Expected:
87.5 - Got:
45 - Issue: Incorrect summation formula
- Expected:
-
❌ Problem 7: Trigonometric equation
- Expected:
18 - Got: Wrong value
- Issue: Calculation error
- Expected:
-
❌ Problem 8: Matrix normal vector
- Expected: 3x1 vector
\begin{pmatrix} ... \end{pmatrix} - Got: 3x3 matrix
- Issue: Misunderstood problem requirements
- Expected: 3x1 vector
-
❌ Problem 9: Trigonometric reduction
- Expected: Tuple
(3,-3,1) - Got: Wrong tuple
(3,3,2) - Issue: Sign error
- Expected: Tuple
- Enhanced Pólya Prompting - Made things worse (0% with tools)
- Few-Shot Learning - Test hung, couldn't complete
- Self-Correction - Test hung, couldn't complete
- Temperature Tuning - Test hung, couldn't complete
- Continuation Loop - Helped with truncation but didn't fix wrong answers
- ✅ Simple baseline (no tools): 50% accuracy
- ✅ Exact string matching: Reliable metric
- ✅ Matrix extraction fix: Fixed Problem 6
- ✅ LaTeX normalization: Better answer matching
- ❌ Tools (MATH/ANALYSIS): Reduced accuracy to 40%
- ❌ Complex prompting: Model just outputs tool JSON
- ❌ Higher max_tokens: Doesn't help if reasoning is wrong
-
benchmark_datasets/__init__.py- Fixed
extract_numeric_answer()to get LAST matrix - Enhanced
normalize_answer()with LaTeX patterns
- Fixed
-
test_math_level5.py- Added continuation loop detection and retry logic
- Changed scoring to exact match only
- Increased timeout 300s → 600s
- Added comprehensive debug output
-
New diagnostic tests:
test_token_limits.pytest_truncation_investigation.py
- Analyze failing problems - Understand WHY these 5 fail
- Problem-specific prompting - Different strategies per problem type
- Multi-sampling + voting - Generate 3 answers, pick most common
- Chain-of-thought - Force explicit step-by-step reasoning
- Fine-tuning - Train model specifically on MATH dataset
- Larger model - Try Qwen2.5-14B or 32B
- Ensemble methods - Combine multiple model predictions
- Symbolic math engine - Use SymPy for calculations
- Hybrid approach - LLM for reasoning, symbolic for computation
- Iterative refinement - Multiple correction passes
For this PR:
- ✅ Commit the fixes we made (matrix extraction, normalization, continuation)
- ✅ Document 50% baseline accuracy as starting point
⚠️ Do NOT include unreliable LLM evaluator in scoring⚠️ Do NOT use tools for MATH dataset (they hurt performance)
For future work:
- Focus on understanding the 5 failing problems
- Try simpler approaches before complex ones
- Baseline (no tools) is the foundation to build on
- Consider fine-tuning on MATH dataset for better results
Model: Qwen2.5-7B-Instruct (4-bit quantized)
Hardware: NVIDIA RTX 5080, 16GB VRAM
Parameters: temperature=0.0, max_tokens=4096, no tools
Test Duration: ~6.5 minutes for 10 problems
Evaluation Method: Normalized exact string matching
- Initial fixes:
934a71b0
- MATH Dataset: https://github.com/hendrycks/math
- Evaluation code:
src/airunner/components/eval/tests/test_math_level5.py - Answer extraction:
src/airunner/components/eval/benchmark_datasets/__init__.py