Large Language Models for Data Analysis: Practices and Insights
This article examines why a large language model that can run an analysis end to end is not necessarily usable in production. It defines four evaluation dimensions—instruction following, insight, chain-of-thought readability and language consistency, and tool use with complete deliverables—then provides a reusable prompt and output contract, a minimal profiling workflow, and selection and integration recommendations covering internal evaluation sets, tiered routing, observability, and data permissions.
1. Background: Why “It Runs” Does Not Mean “It Works”
In real development work, handing a manually sampled time series to a large language model for analysis looks like the most basic task possible, yet it is often where the model’s limits show up first. Early feedback described three recurring patterns: the model kept circling around individual jump points and produced inferences that contradicted the data; follow-up clarifications and a “think again” instruction did not make it notice what it had missed; and the chain of thought came out in English, creating a “question in Chinese, reasoning in English, answer in Chinese” translation chain that was hard to read. On top of that, some models started writing scripts immediately and went a long time without producing any conclusion, generated charts that never appeared in the response, or leaked reasoning drafts into the final answer and fell into loops.
These patterns show that fluent free-form generation does not imply equal reliability on three other things: staying constrained by data facts, reasoning over long chains, and delivering usable results. Deciding whether a model is fit for a production workflow means shifting the question from “can it generate” to “can it reliably deliver verifiable conclusions.”
2. Four Key Evaluation Dimensions
2.1 Instruction Following: Explicit Instructions vs. Wish-Style Requests
Writing requirements as decidable constraints—field meanings, sampling interval, anomaly thresholds, output format—significantly improves model stability. Vague open-ended phrasing such as “take a look and see what patterns there are” leaves too much room for free interpretation, and results vary noticeably across models. The engineering recommendation is to rewrite a wish as acceptance criteria.
2.2 Insight: Picking Up What Is Left Unsaid
Real requirements are often implied by context, for example “these two points may come from switching the collection device.” The model needs to raise hypotheses on its own and design checks for them, rather than treating a jump point as a trend. Requiring the model to first produce a “list of hypotheses to verify” forces that reasoning into the open.
2.3 Chain-of-Thought Readability and Language Consistency
When the reasoning language differs from the delivery language, reading and auditing costs go up. A workable approach is to state it explicitly: reasoning summaries use the same language as the final answer, contain conclusion-level points only, and the full derivation goes into an appendix or logs.
2.4 Tool Use and Deliverable Completeness
Writing code automatically is not the problem. The problem is whether the model confirms the shape of the data first, whether it produces a reproducible script, and whether charts are embedded in the response. Agree on an “inspect first, model second” order, and write the deliverable list into the output contract.
3. A Reusable Prompt and Output Contract (Illustrative)
Role: Senior data analysis engineerInput: CSV, fields [timestamp, value], sampling interval ~1min, 288 points totalTasks:1) Run a data health check first: missing values, duplicates, out-of-order timestamps, unit anomalies2) List 3 hypotheses to verify (including collection device switching, sensor drift)3) For each hypothesis, give the verification method and decision threshold4) When stating conclusions, separate "fact / inference / to be confirmed"Constraints:- Reasoning summary and final answer use the same language, conclusion-level points only- Charts must be embedded in the body by reference, with a path to a reproducible script- Mark confidence explicitly where uncertain; never fabricate data that was not provided
Paired with a minimal verification flow, this substantially lowers the cost of going off track:
# Pseudocode: profile first, analyze seconddef profile(series):return {"n": len(series),"missing": series.isna().sum(),"dup_time": series.index.duplicated().sum(),"max_jump": series.diff().abs().max(),}report = profile(series)assert report["missing"] == 0, "Handle missing values before analysis"# Feed report back to the model as context to keep it from looping on anomalies
4. Selection and Integration Recommendations
- Build an internal evaluation set: run 20–50 real tasks (including dirty data, jump points, ambiguous definitions) as a regression suite, with metrics for conclusion accuracy, hypothesis hit rate, deliverable completeness, and readability score.
- Use tiered routing: send simple extraction and formatting to a lightweight model, and complex attribution and modeling to a model with stronger reasoning, which keeps cost and stability more controllable.
- Make it observable: log prompts, model outputs, scripts, and charts together with monitoring and alerting, so runs can be reviewed and rolled out gradually.
- Handle data and permissions: mask sensitive data before it reaches the model, archive deliverables in object storage, and run reproducible execution environments on a container platform.
- If you use the relevant general capabilities from Baidu AI Cloud, a closed loop can be assembled from the general categories of “model service + logging service + monitoring and alerting + object storage,” avoiding tight coupling to specific APIs.
5. Conclusion
The root cause of differences in model experience is usually not how smart a model is, but whether constraints are clear, whether reasoning is auditable, and whether deliverables are complete. Write requirements as acceptance criteria, externalize hypotheses, put language and deliverables into the contract, and add small-step verification plus observability—only then can you get stable, reproducible, deliverable analysis results across multiple models.
