LLM Math Reasoning Evaluation and Self-Hosting: A Practical Selection Guide
This article explains how to evaluate LLM math reasoning beyond benchmark accuracy, how GPU throughput affects inference, and when self-hosting is more cost-effective than API calls. It provides an evaluation workflow and code skeleton, guidance on interpreting TPS results, cost comparison logic, and a practical selection checklist.
Large language models are increasingly evaluated on math tasks as a way to gauge reasoning ability. However, standard benchmark accuracy alone makes it difficult to judge whether a model can reason reliably on unfamiliar problems. For model selection, developers also need to consider GPU inference throughput and whether self-hosting is cheaper than calling a cloud API. This article addresses three questions: how to evaluate math reasoning, how to interpret GPU throughput, and whether self-hosting is cost-effective. It closes with a selection checklist.
How to Evaluate Math Reasoning
Counting only final-answer accuracy misses several important signals. First is generalization: whether the model remains stable when a problem is rephrased or its conditions change. Second is whether the derivation can be verified. An incorrect derivation that happens to reach the right answer should not count as valid reasoning. Third is chain-of-thought length. Longer derivations consume more output tokens, which raises per-problem cost and response time.
A recommended evaluation process is as follows:
- Select a problem set and record its source and whether it is public. Public problem sets may already have been included in model training, so results should be discounted.
- Fix sampling parameters, including temperature, maximum output length, and system prompt.
- Run each problem multiple times. Even with temperature set to 0, most services still show some variance, so a single run is not enough to draw conclusions.
- Record accuracy, output token count, latency, and per-problem cost.
- Judge the answers. Numeric problems can be compared automatically; proof problems require human review or another verification process.
Below is a simplified script skeleton for recording results:
def run_eval(client, problems, repeats=3):records = []for p in problems:for i in range(repeats):resp = client.generate(prompt=p["question"],temperature=0,max_tokens=4096,)records.append({"id": p["id"],"run": i,"correct": check_answer(resp.text, p["answer"]),"output_tokens": resp.usage.output_tokens,"latency_s": resp.latency,})return records
check_answer needs to be implemented separately for each problem type. The records produced by the script should save raw responses so they can be re-judged later.
When comparing models, list results by dimension rather than giving only a single total score. Common dimensions include accuracy, verifiability of the derivation, average output token count, per-problem cost, and the types of errors that appear in long derivations. For example, one model may have slightly lower accuracy but shorter derivations and lower cost, making it suitable for high-frequency standardized question answering. Another model may have higher accuracy but longer derivations and higher cost, making it better for low-frequency difficult problems. Thresholds should be set by the team according to its own use case.
How GPU Compute Affects Inference Throughput
TPS refers to output tokens generated per second. Two concepts need to be distinguished: the speed a single request can achieve, and the total number of tokens the whole system can output per second. The former affects the response speed perceived by users; the latter determines how many concurrent users the same hardware can serve.
Throughput is mainly affected by the following factors:
- Model parameter count and precision. For the same model, FP16, INT8, or FP8 will change both memory usage and speed.
- GPU memory capacity and bandwidth. During inference, weights are read repeatedly and the KV Cache must be maintained, so memory often becomes the bottleneck before compute does.
- Batch size and concurrency. Larger batches usually increase total throughput, but latency for individual requests may increase.
- Input and output length. Long contexts cause the KV Cache to grow quickly, reducing the concurrency available.
- Interconnect bandwidth between multiple GPUs. When a model is split across multiple GPUs, communication between GPUs directly affects speed.
- Inference framework. On the same hardware, different inference frameworks may perform very differently.
Therefore, any TPS number should be accompanied by its test conditions. During procurement or evaluation, ask the vendor or internal test results to provide the following: GPU model and count, model name and parameter count, precision, batch size, input and output length, concurrency, P50 and P99 latency, test date, and software version. Numbers without these details should be treated only as reference and should not be used directly for capacity planning.
Is Self-Hosting Cost-Effective?
The method is to compare two cost curves. Monthly cloud API cost can be estimated as:
Monthly API cost = monthly input tokens × input unit price + monthly output tokens × output unit price
Monthly self-hosting cost includes hardware depreciation or rental, power and data center costs, operations staffing, model updates and testing, monitoring and storage, and backup equipment. Most of these are fixed costs and are not strongly tied to call volume. Therefore, the unit cost of self-hosting rises as utilization falls.
The break-even point is the monthly call volume at which the two approaches cost the same. The following example uses hypothetical numbers and does not represent any actual pricing. Assume an API output price of CNY 40 per million tokens and a self-deployment fixed monthly cost of CNY 35,000. The break-even point is the monthly output volume at which the API output cost equals CNY 35,000; the calculation uses CNY 35,000 divided by the per-token output price.
Selection Checklist
- Record the source of the problem set and whether it is public; discount results from public sets that may have been used in training.
- Fix temperature, maximum output length, and system prompt before comparing models.
- Run each problem multiple times and save raw responses for later review.
- Track accuracy, output tokens, latency, and per-problem cost together.
- Evaluate derivation verifiability and common error types in long reasoning chains.
- Require TPS figures to include GPU model and count, model and precision, batch size, input/output length, concurrency, P50/P99 latency, test date, and software version.
- Compare monthly API cost with self-hosting fixed costs and utilization assumptions.
- Set accuracy and cost thresholds based on the team’s own workload rather than relying on a single aggregate score.
