Evaluating and Deploying New Large Language Models: A Practical Backtesting Workflow
As large language models continue to iterate rapidly, evaluating a newly released model requires more than benchmark claims, context length, or a single impressive demo. Using a trading-data backtesting system as a practical example, this article outlines four evaluation dimensions—requirement understanding, planning, execution, and verification—and discusses staged collaboration, table-to-structured-text conversion, local database design, external data integration, handling stalled responses, avoiding misleading backtest results, and building a reusable model evaluation checklist.
Evaluating and Deploying New Large Language Models: A Practical Backtesting Workflow
As large language models continue to iterate, the most important question about a newly released model is not the parameter scale, context length, or single-demo performance promoted in launch materials. What matters is whether the model can complete work reliably in real tasks.
For developers, model evaluation cannot stop at whether an answer sounds human. More important questions include: Can it accurately understand complex requirements? Can it continuously execute multi-step tasks? Is the generated code runnable and maintainable? When errors occur, can it identify the cause? When external data is involved, can it distinguish facts, inferences, and missing information?
This article uses “building a trading data backtesting analysis system with a large language model” as an example to discuss how to objectively evaluate a new model’s practical capabilities.
1. Evaluating a New Model Requires More Than a Single Conversation
Many models perform well in simple Q&A, code completion, or knowledge explanation, but once they enter a real project, different problems may appear:
- The model suddenly stalls during a long task.
- It generates interfaces that look plausible but do not exist.
- It omits some fields from the input data.
- It modifies the project structure without confirmation.
- After an error occurs, it retries repeatedly without forming an effective troubleshooting path.
- Its output lacks a basis for verification.
Therefore, model evaluation should include at least four dimensions.
1.1 Understanding
Can the model accurately extract the user’s goals, input conditions, constraints, and final deliverables? For example, when a user says, “build a stock trading backtesting system,” that statement contains multiple subtasks, including data acquisition, data cleaning, trading rules, equity curves, return statistics, risk analysis, and report generation.
If the model starts writing code immediately without first confirming the backtesting assumptions, the program may run, but the results may have no analytical value.
1.2 Planning
Complex tasks cannot rely on one-shot generation. A strong model should be able to break a goal into multiple independently verifiable stages and clarify the input, output, and acceptance criteria for each stage.
A reasonable set of stages usually includes:
- Identifying security identifiers in trading records;
- Checking date, price, quantity, and direction fields;
- Fetching corresponding historical market data;
- Unifying data formats and trading calendars;
- Building a local database;
- Writing trade matching logic;
- Generating statistical metrics;
- Performing manual sample verification of results.
1.3 Execution
Execution capability is not only about “being able to write code.” It also includes whether the model can correctly handle engineering issues such as files, databases, APIs, exceptions, retries, logging, and incremental updates.
Code that runs does not necessarily mean it is suitable for long-term use. Stability, traceability, and maintainability are equally important.
1.4 Verification
Conclusions generated by the model must be verifiable. For example, if a backtesting system reports a high return, developers should at least confirm:
- Whether the initial capital is correct;
- Whether buy and sell quantities match;
- Whether commissions and transaction costs are included;
- Whether future data was used;
- How suspensions, price limits, and missing market data are handled;
- Whether trading days and calendar days are confused;
- Whether summary data is consistent with the original execution records.
2. Why Not Describe All Requirements at Once
Many developers are accustomed to telling the model all their goals at once and then waiting for it to complete the entire project automatically. This approach may work for simple scripts, but it easily gets out of control in complex systems.
The reason is that the model must simultaneously handle requirement understanding, technology selection, code generation, file modification, and error troubleshooting. When the context is too long and constraints are too numerous, any error in an early judgment can affect all subsequent steps.
A safer approach is staged collaboration.
In the first stage, focus only on data identification. For example, ask the model to read a trading file and list the security names, codes, trading directions, and date ranges that appear in it. Do not ask it to immediately write a complete system. First, manually check the identification results.
In the second stage, design the data plan. Ask the model to explain which data tables are needed, how fields should be defined, how primary keys should be set, and how to avoid duplicate writes. After the plan is confirmed, move on to code implementation.
In the third stage, implement data collection. First fetch only a small number of symbols and a short time range to verify field mapping, date formats, and exception handling. After confirmation, expand the data range.
In the fourth stage, implement backtesting logic. Implement order matching, position calculation, cash changes, fee deduction, and return statistics separately, rather than piling all logic into one function.
In the fifth stage, generate reports. Reports must cite clear data sources and calculation processes, not just output a conclusion.
The core idea is this: let the model take limited responsibility at each step, and leave inspectable intermediate results at every stage.
3. What to Watch for When Converting Tables into Structured Text
Files exported by trading software are usually in table format. Giving them directly to a model for analysis may seem convenient, but there are several risks.
First, the model may read only some rows. Second, merged cells, hidden columns, special formats, and empty values may be misinterpreted. Third, column names exported by different software are not standardized, and the model may confuse “execution price,” “order price,” and “settlement price.”
Therefore, before entering the analysis workflow, it is advisable to standardize the data first:
trade_id Unique trade identifiertrade_date Trade datesymbol Security codename Security nameside BUY or SELLquantity Executed quantityprice Execution pricefee Transaction fee
If the table needs to be read by a model, it can be converted into structured text, but this is only an auxiliary method and cannot replace programmatic validation. Formal calculations should still use reliable table parsing libraries or database queries.
After import, perform the following checks:
- Whether all dates can be converted into a unified format;
- Whether quantities and prices are positive numbers;
- Whether the buy/sell direction contains only allowed enumeration values;
- Whether duplicate trade identifiers exist;
- Whether records with empty security codes exist;
- Whether sell quantities exceed available positions;
- Whether transaction fees are missing or abnormal;
- Whether the total number of file rows matches the number of imported rows.
4. How to Design the Local Database
For temporary analysis, a single data file may be sufficient. But if you need to run backtests repeatedly, update market data, and save results for different strategies, a structured database is recommended.
A relatively clear design can include the following types of tables.
4.1 Trade Records Table
Stores the user’s original execution data. In principle, it should be append-only and not overwritten. This preserves the original input for traceability.
4.2 Daily Market Data Table
Stores fields such as security, trading date, open price, high price, low price, close price, and volume, with a unique constraint on “security code + trading date.”
4.3 Intraday Market Data Table
If the backtest requires higher-frequency data, timestamp, price, volume, and other fields should be stored separately to avoid mixing them with daily data.
4.4 Backtest Task Table
Records the strategy name, parameters, run time, data range, and execution status.
4.5 Backtest Results Table
Stores results such as return, maximum drawdown, win rate, profit-loss ratio, number of trades, and equity curve.
The key to database design is not having as many tables as possible. It is clear data provenance, separated responsibilities, and repeatable execution. Every backtest should be reproducible from a task ID, including which data and parameters were used.
5. Common Model Errors When Integrating External Data
A model can help write data collection programs, but you cannot assume it knows every API detail. Common problems in real development include:
- Using fields that do not exist;
- Confusing data types returned by APIs;
- Ignoring rate limits;
- Failing to handle pagination;
- Failing to handle empty data;
- Mixing adjusted and unadjusted data;
- Retrying indefinitely after network errors;
- Writing duplicate records after data updates.
Therefore, a data collection program should at least include:
for item in symbols:try:data = fetch_history(item, start_date, end_date)data = normalize(data)validate(data)save_incrementally(data)log_success(item)except Exception as exc:log_failure(item, str(exc))continue
The point of this illustrative code is not the specific function names, but the engineering structure: process items one by one, normalize, validate, save incrementally, and record success and failure states.
In addition, the program should show clear progress, such as the current number processed, the number succeeded, the number failed, and the estimated remaining tasks. In this way, even if a task runs for a long time, developers can determine whether the program is working, waiting, or stuck in an abnormal state.
6. Handling Apparent Model Stalls or Long Response Times
When a new model is first launched, response delays, task stalls, or long periods with no interface output do not necessarily mean the model’s reasoning capability is insufficient. They may also be related to context length, task complexity, service load, or tool calls.
In such cases, do not blindly resubmit the entire task. A better approach is:
- Save the current conversation and generated files;
- Determine whether the model is thinking, calling a tool, or blocked by the program;
- Break the task into smaller steps;
- Explicitly require the model to output an execution plan first;
- Save results after each completed stage;
- Add timeouts and retry limits for external calls;
- Ask the model to explain its current state before deciding whether to continue.
For programming tasks, monitor “model response” and “program execution” separately. If the model has already generated code but the code is waiting for a network request, the problem may not be in the model itself.
7. Avoiding Backtest Results That Only Look Correct
Financial data analysis is especially prone to false precision. A report with an attractive return may simply be using future data or ignoring transaction costs.
At minimum, pay attention to the following issues.
7.1 Look-Ahead Bias
If the same day’s closing price is used to decide a trade that is executed at the same day’s close, time-travel bias may occur. The signal generation time and actual execution time must be clearly defined.
7.2 Adjustment Method
Ex-rights and ex-dividend events affect price series. Different adjustment methods are suitable for different analytical goals and cannot be mixed arbitrarily.
7.3 Transaction Costs
Commissions, stamp duty, slippage, and minimum fees all affect short-term strategy results. Ignoring costs often overstates returns.
7.4 Tradability
Suspensions, price limits, and insufficient liquidity affect whether orders can actually be executed. A backtest cannot assume that all prices can be executed immediately.
7.5 Sample Bias
Analyzing only securities that performed well in the past, or retaining only successful trades, leads to survivorship bias. The sample range should be determined before the backtest.
8. Building a Reusable Model Evaluation Checklist
To avoid being influenced by a single experience, build a quantitative evaluation checklist for the model:
| Evaluation Item | What to Examine |
|---|---|
| Requirement understanding | Whether the goal and constraints are restated accurately |
| Task decomposition | Whether executable steps are formed |
| Code quality | Whether the code is modular, runnable, and maintainable |
| Data handling | Whether data is fully read and validated |
| Exception handling | Whether timeouts, retries, and failure records are included |
| Engineering standards | Whether logs, configuration, and version records exist |
| Result credibility | Whether calculation assumptions and limitations are explained |
| Interaction stability | Whether multi-turn tasks can be completed continuously |
Only by using the same input, same data, and same acceptance criteria for each test can you perform meaningful horizontal comparisons.
Conclusion
The most reliable way to evaluate a newly released large language model is not to chase metrics from a launch event or draw conclusions from a single answer. It is to place the model in a real, complex, verifiable workflow.
In data analysis and software development scenarios, the value of a model is mainly reflected in whether it can help users reduce repetitive work, improve development efficiency, identify omissions, and provide a clear troubleshooting path when errors occur.
At the same time, models cannot replace data verification, business judgment, and risk control. Especially in highly sensitive scenarios such as trading backtesting, all conclusions should be based on traceable data, clear calculation rules, and sufficient manual review.
A truly mature way to use models is not to ask them to “complete all work at once.” It is to treat them as collaborative tools with reasoning and generation capabilities, and to convert model capabilities into maintainable, reproducible technical outcomes through staged delivery, process checks, and result verification.
