Why LLM Agents Fail at Quantitative Research Reports—and How to Fix It

    This article explains why large language model (LLM) agents often produce fluent research reports but unreliable numbers, and how to address three core weaknesses: numerical precision, reproducible tool calls, and chart generation. It outlines a layered architecture that moves all math into deterministic code, a context engineering approach with a validation loop that treats a metrics file as the single source of truth, and a controlled method for comparing models. Readers will also find a checklist of common pitfalls and guidance on running these workflows reliably at scale.

    1. Background: Writing a Report Is Not the Same as Getting the Numbers Right

    Over the past year, agents with tool-calling capabilities have been widely used for information retrieval, table reading, and report writing. When you hand an agent a task such as “read inventory data, compute quantiles, and output conclusions,” it will most of the time produce a document with a complete structure and fluent language. But as soon as you compare the output item by item against the results of a deterministic program, discrepancies appear immediately: quantile positions are shifted, decimal places are flattened, and the sign and magnitude of the basis are inconsistent.

    This is not a prompt quality problem. It follows from how current large models work. A model performs probabilistic generation under its training distribution and context constraints; it does not have a strict numerical computation engine built in. Therefore, any step that involves exact decimals should not be left to the model to “fill in by intuition.”

    2. Root Causes of the Three Core Weaknesses

    2.1 Numerical Precision: Approximate Generation vs. Strict Mathematical Rules

    Metrics such as quantiles and basis are extremely sensitive to their definitions: which interpolation method is used, whether samples are deduplicated, and how missing values are handled can all change the decimal places of the result. Models tend to output numbers that “look reasonable,” and the error is amplified when the sample size is small and the distribution is skewed. The engineering conclusion is clear: computation must be externalized to deterministic code, and the model should only organize and explain.

    2.2 Tool Calling: From “Being Able to Read a File” to “Reading a File Reproducibly”

    It is technically feasible for an agent to read local tables via the command line and retrieve external information, but there are three hidden risks: path and encoding differences cause read failures; an uncertain working directory causes relative paths to drift; and command output is truncated, after which the model continues reasoning from incomplete content. Reproducibility therefore degrades.

    2.3 Chart Generation: Generative Images Are Unsuitable for Professional Analysis

    Producing analytical figures with image generation may look visually appealing, but the axis ticks, legends, and data point positions have no numerical credibility. A professional research report needs verifiable charts—that is, a one-to-one correspondence between data and graphics that can be re-rendered repeatedly by a script.

    3. A Reference Practice: Confining Uncertainty

    3.1 Layered Architecture

    Split the system into four layers: a data ingestion layer that pulls data from tables and APIs; a deterministic computation layer where scripts perform all mathematical operations such as quantiles and basis; an orchestration layer where the agent decides the call order and intermediate artifacts; and a presentation layer responsible for charts and text layout.

    1. # Deterministic computation layer: results are unique and reproducible
    2. import pandas as pd
    3. def quantile_report(df: pd.DataFrame, col: str, qs=(0.25, 0.5, 0.75)):
    4. s = df[col].dropna().astype(float)
    5. return {q: round(float(s.quantile(q)), 4) for q in qs}
    6. def basis(current: pd.Series, base: pd.Series) -> pd.Series:
    7. return (current - base).round(4)

    3.2 Context Engineering and a Validation Loop

    Give the agent an explicit task contract: input fields, calculation definitions, output templates, and failure handling. Also require it to “write intermediate result files first, then write conclusions,” and add a self-check step—compare the script output against the numbers in the text at the string level, and roll back for recomputation if they do not match.

    1. Process constraints (pseudo-config)
    2. 1. Fetch data -> persist raw.csv
    3. 2. Compute -> persist metrics.json (the single source of numbers)
    4. 3. Render charts -> read metrics.json
    5. 4. Write the text -> only values from metrics.json are allowed
    6. 5. Validate -> rewrite if numbers in the text differ from metrics.json

    3.3 Standardizing Visualization

    Use scripted plotting consistently, with fixed colors, ticks, and units, and output vector graphics or high-resolution bitmaps; every data point in a chart should be traceable to the intermediate result files. If you use a cloud-based, UI-driven AI coding environment, pay attention to its session quota and file persistence policy to avoid losing artifacts due to an interruption midway.

    4. How to Compare Results Correctly

    To evaluate different models on the same type of task, control the variables: the same dataset, the same calculation definitions, the same prompt contract, and the same rendering script, replacing only the generation model. Suggested comparison dimensions include numerical consistency rate, correctness rate of retained decimal places, tool-calling success rate, proportion of traceable charts, and manual rework time. Presenting metrics such as “current inventory quantile” and “basis quantile” in tabular form and comparing them automatically with a script is more convincing than subjective impressions.

    5. A Checklist of Common Pitfalls

    • Letting the model “mentally compute” quantiles or basis directly;
    • Replacing data charts with generative images;
    • Writing “accurate to four decimal places” in the prompt without providing a computation script;
    • Ignoring working directory and encoding issues, causing reads to work only intermittently;
    • Treating a free trial quota as a stable production resource.

    6. Conclusion

    Agents are good at understanding intent, orchestrating workflows, and expressing conclusions—not at acting as calculators. Only by giving the math to code, the structure to contracts, and validation to automation can you retain generation efficiency while obtaining reproducible, auditable analytical results. If you need to handle large-scale data and long-running tasks, you can combine general cloud capabilities such as object storage, message queues, container platforms, and log monitoring to complete the engineering implementation on platforms like Baidu AI Cloud, giving the entire pipeline elasticity and observability.