Evaluating Math Reasoning in LLMs: Selection and Acceleration Practices for Self-Deployment

    The mathematical capabilities of Large Language Models (LLMs) are evolving from simply outputting answers to executing complete reasoning processes. For developers, this raises two key questions: Can the model solve complex problems, and is self-deployment cost-effective? This article explores how to evaluate LLM math reasoning beyond mere answer accuracy, compares concise and long chain-of-thought styles, guides you in building a custom evaluation set, demystifies TPS (tokens per second) metrics, and shares engineering practices for self-deploying LLM inference services.

    The mathematical capabilities of Large Language Models (LLMs) are evolving from simply outputting answers to executing complete reasoning processes. For developers, this raises two key questions: Can the model solve complex problems, and is self-deployment cost-effective? Let’s break down these aspects.

    1. Why Just Checking Answer Correctness Is Not Enough

    Standard benchmark datasets are commonly used to measure LLM math capabilities, but they have two main issues. First, problems often have fixed solutions, allowing models to pattern-match their way to correct answers based on previously seen problem types. Second, test data contamination can inflate scores if the problems already exist in the training data. Therefore, evaluations must separate “answer correctness” from “reliable reasoning processes.”

    Open-ended problems better reflect true capabilities. These problems have no uniform solution, forcing the model to choose its own path, validate intermediate conclusions, and adjust its direction upon detecting errors. When evaluating, focus on the following metrics:

    • Pass rate: The proportion of times at least one correct answer or complete proof is generated across multiple sampling attempts of the same prompt.
    • Stability: The consistency of results across multiple runs of the same problem. High variance indicates that success relies more on luck.
    • Process correctness rate: The proportion of cases where the answer is correct but the reasoning contains obvious skipped steps or errors.

    2. Two Chain-of-Thought Styles and Their Costs

    The chain-of-thought (CoT) style impacts both cost and reliability.

    Concise CoT generates shorter text, mimicking the intuitive leaps of human experts. It responds quickly and consumes fewer tokens, making it ideal for writing, routine logical derivations, and Q&A. However, in complex proofs, the omitted steps are often where errors hide, requiring additional human or programmatic checks.

    Long CoT breaks problems down into many small steps, advancing gradually. It offers more fault tolerance for difficult problems, but the risks are clear. Intermediate steps might contain fabricated conclusions, deviations are hard to reverse, and token consumption increases significantly.

    The choice of style depends on the cost of errors. Scenarios requiring fast responses and where error costs are low suit concise CoT. Scenarios with high error costs requiring verifiable processes, such as scientific computing assistance, can justify the cost of long CoT, provided they include supporting validation steps.

    3. How to Build Your Own Evaluation Set

    Your evaluation set determines whether your conclusions are credible. Follow these steps to build one:

    1. Problem sources: Mix custom-made problems, public competition questions, and real-world business issues. For public problems, verify they aren’t in the model’s training data; use rewritten variants if necessary.
    2. Grading method: Use programmatic grading for problems with numerical answers. Proofs should be graded by staff with a math background using a fixed rubric, with regular spot checks for grading consistency.
    3. Sample size: Prepare at least dozens of problems per category. With too few samples, a difference of just a few problems can alter the ranking conclusions.
    4. Reporting: Simultaneously provide the pass rate, stability, average token count, and time per problem. Also, document sampling parameters (e.g., temperature) and prompt templates.

    Model comparisons are only valid under the same evaluation set, prompt, and grading criteria. Vague claims like “one generation of model is close to another” are irreproducible; you should rely on your own evaluation data.

    4. How to Read a TPS Number

    Claims like “generating hundreds of tokens per second” are common but meaningless in isolation. Throughput depends on many conditions, which must be specified when published or cited:

    • Model parameter count and architecture
    • Weight precision (e.g., FP16, INT8, or FP8)
    • Batch size and concurrent request count
    • Input and output token lengths
    • Hardware model, GPU count, and inter-GPU interconnect
    • Inference framework and version

    On the same hardware, throughput is high when both input and output are short; it drops significantly with long inputs and high concurrency. Numbers without these conditions are irreproducible and incomparable. Developers should use fixed scripts for their own stress testing rather than relying on third-party marketing numbers.

    High throughput does not equate to a good individual user experience. High aggregate throughput might mean longer queue times per request. Before going live, measure both first-token latency and generation speed per request.

    Common acceleration technologies fall into three main categories:

    • High-bandwidth memory and high-speed interconnects: LLM inference is often memory bandwidth-bound. Higher bandwidth reduces wait times for reading weights and the KV Cache, speeds up inter-GPU communication, and lowers overhead for multi-GPU parallelization.
    • KV Cache paging management: PagedAttention divides the KV Cache into fixed-size blocks and allocates them on demand. This reduces memory fragmentation, allowing a single GPU to accommodate more concurrent requests.
    • Tensor parallelism: Splits the computation of a single layer across multiple GPUs. It enables large models to fit into multi-GPU memory, but inter-GPU communication adds latency, so it is typically only used between GPUs within the same node connected via high-speed interconnects.

    5. Engineering Practices for Self-Deployment

    A common practice is to containerize the inference service, using an orchestration platform to handle scaling and health checks. For inference frameworks, you can choose open-source projects like vLLM or TGI. The specific choice depends on model support and your team’s familiarity.

    Below is a deployment schematic for a single replica using 8 GPUs. This is for structural illustration only; the image tag, model path, and resource quantities must be replaced according to your actual environment and validated in a testing environment before going live.

    1. apiVersion: apps/v1
    2. kind: Deployment
    3. metadata:
    4. name: llm-inference
    5. labels:
    6. app: llm-inference
    7. spec:
    8. replicas: 2
    9. selector:
    10. matchLabels:
    11. app: llm-inference
    12. template:
    13. metadata:
    14. labels:
    15. app: llm-inference
    16. spec:
    17. containers:
    18. - name: model-server
    19. image: vllm/vllm-openai:<verified-version-tag>
    20. args:
    21. - --model=/models/your-model
    22. - --tensor-parallel-size=8 # Matches the number of GPUs allocated to a single replica
    23. - --max-model-len=8192
    24. - --max-num-seqs=256
    25. - --port=8000
    26. ports:
    27. - containerPort: 8000
    28. resources:
    29. requests:
    30. cpu: "16"