How to Evaluate Large Language Models: Long Context and AI Agent Practice
This article explains how to evaluate large language models by task outcomes rather than specifications alone. It covers the three layers of evaluation (core, system, and business capabilities), why a large context window does not guarantee effective use of information, how to assess coding and long-running AI agents, and how to build a phased enterprise evaluation process with controlled permissions and auditable results.
1. Evaluate Task Outcomes, Not Specifications
As large language models move from text generation to complex task execution, comparing parameter counts, context window sizes, or single benchmark scores is no longer enough to judge their real value.
For developers, the key questions are whether a model can understand an existing codebase, modify code correctly, and identify the cause of a failing test. For enterprises, the more important questions are whether a model can keep working within controlled permissions, produce results backed by evidence, and do so at acceptable cost and latency.
Evaluation should therefore use three layers:
Layer 1: Core capabilities. These include language understanding, reasoning, knowledge application, and code generation. They determine whether a model can understand a task and propose a sound plan.
Layer 2: System capabilities. These include context management, tool calling, handling of execution feedback, and failure recovery. They determine whether a model can carry the plan out.
Layer 3: Business capabilities. These include task acceptance, risk control, result auditing, and return on investment. They determine whether a system is worth deploying in production.
Parameter counts and test scores are useful references, but they cannot replace validation of the second and third layers. A more reliable approach is to build an evaluation loop around real tasks.
2. Parameter Scale and Post-Training: Focus on How Capabilities Form
2.1 Parameter count does not equal task quality
Parameter count describes a model’s structural capacity. It does not directly determine factual accuracy, reasoning reliability, or engineering delivery quality. Training data quality, model architecture, training objectives, post-training methods, and inference configuration all affect final performance.
In sparse activation architectures, total parameter count can differ from the number of parameters actually used in each inference pass. Inference cost therefore cannot be inferred from total parameter count alone, and a larger model is not necessarily better than a smaller one.
When choosing a model for an application, measure the following:
- whether the model can complete the task under the given input conditions;
- whether results stay stable across repeated runs;
- how many tool calls and how much human intervention the task requires;
- the total latency and total cost needed to meet the same acceptance standard.
2.2 Post-training shapes decision-making behavior
Pre-training teaches a model broad language patterns and knowledge. Post-training then shapes behaviors such as instruction following, reasoning, tool use, and preference alignment. Reinforcement learning can optimize a model’s decision policy in a specific environment by using task feedback.
Investing more training compute does not automatically produce gains in every scenario. What matters is whether the training environment is realistic, whether the reward signal is reliable, and whether the training tasks are diverse enough.
For example, if a coding task rewards the model only when a small set of tests passes, the model may learn to satisfy those tests without understanding the requirements. A more reasonable evaluation also includes hidden tests, boundary conditions, regression checks, code quality review, and security constraints.
When assessing post-training progress, ask three questions: Does the reward match the goal? Do the training tasks cover the real difficulties? Can the capability transfer to tasks the model has not seen?
3. Long Context: Fitting Input Is Not the Same as Using It Well
Long context lets a model process a large codebase, long research materials, and task records across many turns at once. However, a window size only sets the input limit. It does not guarantee that the model will understand the material.
3.1 Separate capacity, retrieval, and reasoning
Long-context ability has at least three layers.
Capacity describes how long an input the system accepts and how the output budget shares the limit with the input.
Retrieval describes whether the model can find the facts relevant to a question in a large body of material. This matters most for facts in the middle of a long text, facts mixed with similar content, and facts later revised by new information.
Reasoning describes whether the model can combine scattered evidence, identify conflicting versions, preserve chronological order, and reach a consistent conclusion.
A model that can locate a sentence in a long document does not necessarily understand dependencies across several documents. Evaluation must test these abilities separately.
3.2 Long context still needs information organization
Feeding every document into the model does not make sense just because the window is larger. Redundant information raises processing cost and can distract the model.
A more practical approach organizes context in layers:
- Persistent information: the task goal, permission boundaries, and acceptance criteria;
- Working information: the documents and code snippets needed for the current step;
- History summaries: completed actions, key conclusions, and open questions;
- External evidence: original sources retrieved on demand.
A summary should not be the only source of truth. For key figures, contract terms, interface constraints, or risk conclusions, keep a reference to the original source so the facts can be verified again.
3.3 Test context quality with realistic distractors
Long-context tests should not stop at checking whether the model can find a hidden piece of information. More useful tasks include determining the final version among several requirement changes, aligning definitions across financial reports from multiple periods, or identifying the scope of impact in a large engineering project.
Test materials should also include outdated notes, duplicated passages, and contradictory sources. Check whether the model can state which evidence it used and why it excluded other information.
4. Coding: From Code Snippets to Engineering Loops
Code generation is only one part of software development. Real engineering work also involves environment setup, dependency identification, requirement clarification, implementation, test execution, and delivery.
4.1 Use repository-level tasks as the unit of evaluation
Representative tasks include fixing a defect, adding compatibility handling, writing tests, or completing a small feature. Each task should come with explicit acceptance criteria rather than a vague request to “generate code that looks reasonable.”
Evaluation should cover at least the following:
- whether the feature meets the requirements;
- whether existing behavior has regressed;
- whether new security risks have been introduced;
- whether the scope of changes is reasonable;
- whether adequate tests and documentation are provided.
For a defect fix, the ideal workflow is to reproduce the problem first, make the minimum necessary change, and then verify the fix and check related code paths. If a model edits code without reproducing the problem, it may pass some tests in the short term but is more likely to misidentify the root cause.
4.2 Interpret execution feedback correctly
After calling a tool, a model must distinguish between different types of failure. A missing dependency, a misconfigured test, a temporary network outage, and a logic error in the code should not be handled in the same way.
When a failure comes from the environment, repeatedly changing business code often makes the problem worse. A reliable agent should first classify the failure, then choose to retry, request more information, roll back, or ask a person to confirm.
The final delivery should not consist only of the word “done.” It should include a summary of changes, the verification actually performed, the parts that were not verified, and any remaining risks. Tests that were not run must not be reported as passing.
5. Long-Horizon Agents: State Management and Reliability Come First
Long-horizon tasks usually involve multiple steps that depend on one another. Even when each step performs well, errors can accumulate as the number of steps grows. An agent therefore cannot rely on continuously generating text to keep the work on track.
5.1 Break tasks into checkable stages
A recommended loop is: goal confirmation → planning → execution → observation → verification → recovery. Each stage should have clear inputs, observable outputs, and stop conditions.
For example, a research task can start by defining the scope, then collect sources, build a fact table, analyze differences, and finally draw conclusions. If the fact table has not passed verification, the agent should not move on to writing the report.
5.2 Save task state explicitly
Systems that run for long periods should record completed steps, the current work item, tool results, key assumptions, and open questions. Checkpoints after important actions make it easier to resume after an interruption and allow a person to take over.
For actions that may be repeated, idempotency matters. Re-reading a source usually has little effect, but resubmitting a form, sending a notification again, or modifying data a second time can cause real harm.
5.3 Set boundaries for autonomous execution
Higher autonomy is not always better. Actions such as deleting files, changing permissions, executing payments, or publishing external content should require explicit approval conditions.
The system should also limit maximum execution time, tool-call budgets, and retry counts. When the environment fails, evidence is insufficient, or repeated attempts keep failing, the system should pause and explain the reason instead of trying indefinitely.
6. 3D Creation and Financial Research: Domain Constraints Must Govern Acceptance
6.1 3D creation is more than visual effects
3D tasks can include scene planning, geometry generation, material setup, lighting adjustments, and interaction logic. A model can propose a creative plan, but that does not mean the final asset meets delivery requirements.
Acceptance should cover both visual and engineering constraints, such as unit size, coordinate conventions, mesh quality, resource budgets, and editability. For content that runs in real time, check loading cost and runtime performance as well.
A more reliable workflow has the model organize the creative steps, execute them with professional tools, and verify the result through visual inspection and structured validation.
6.2 Financial research must preserve an evidence chain
The main difficulty in financial research is usually not the arithmetic. It is keeping data definitions, reporting dates, and measurement bases consistent.
The same metric may use different statistical scopes, currencies, or accounting standards. If a model combines these figures directly, the conclusion may read smoothly but lose a valid basis for comparison.
A sound process records the source and disclosure date, converts units consistently, separates historical facts from forecast assumptions, independently rechecks key calculations, and shows how sensitive the conclusion is to changes in assumptions.
When data is insufficient, the model should state the gap clearly instead of filling it with plausible-looking numbers. Research assistance output should also not be treated as a guarantee of returns.
7. High-Speed Inference: Measure End-to-End Efficiency, Not Only Output Speed
Faster token output improves the interactive experience. However, total task time also includes queuing, input processing, tool execution, network waits, and retries after failures.
Measure first response time, sustained generation speed, tool waiting time, and the total time from task start to completed acceptance separately. In multi-tool tasks, tool execution may be the main bottleneck, and faster text output alone may bring little overall benefit.
When comparing runtime configurations, hold quality constant. Keep the task set, input materials, tool permissions, inference budget, and acceptance rules as consistent as possible. Otherwise, the trade-off between speed and quality can be hidden.
A more meaningful business metric is the average cost per successful task, not the price of a single call. Failed retries, human review, and the cost of the runtime environment all belong in that calculation.
8. Build a Reproducible Enterprise Evaluation System
Enterprises can adopt model-based automation in three phases.
Phase 1: Offline evaluation. Draw anonymized tasks from real business workflows, covering common cases, complex edge cases, and high-risk operations. Use fixed acceptance criteria, and keep a set of tasks out of tuning to avoid overfitting.
Phase 2: Controlled trial. Run the system in an isolated environment with the minimum necessary permissions. Record inputs, outputs, tool calls, and execution results. Require human approval for critical actions, and verify that rollback works.
Phase 3: Limited rollout. Start with low-risk workflows that are easy to review. Continuously monitor success rate, human correction rate, task latency, and abnormal operations. Expand automation only when both the benefits and the risks can be explained.
On security, treat external documents, web content, and tool outputs as untrusted input, and prevent embedded instructions from changing the system’s original goal. Sensitive credentials should not be placed directly in the model context, and tool permissions should not expand without limit just because a task is complex.
Conclusion
The most important question for a new generation of large language models is not which specification stands out. It is whether the model can understand a task accurately in a complex context, use tools appropriately during execution, recover after failures, and hold back when evidence is insufficient.
Evaluation should combine core capabilities, the runtime system, and business acceptance. Only when tasks are reproducible, results are verifiable, costs are measurable, and permissions are controlled can improvements in model capability turn into stable engineering value.
