Rethinking LLM Selection: Capabilities, Cost, and Agent Evaluation
Choosing a large language model for real work requires more than public leaderboard scores. This article outlines a practical evaluation framework covering task benchmarks, total cost, latency and stability, long-context engineering, agent workflow metrics, hallucination controls, and phased deployment.
1. Why Leaderboards Are Not Enough for Model Selection
Leaderboard scores reflect how a model performs on a standardized set of questions. They can indicate the general capability range of a model, but they cannot directly answer whether it can replace a specific step in an existing workflow. Real business processes often include specific coding standards, private document formats, and multi-turn interaction requirements that are difficult to reproduce in public evaluations. Teams should therefore shift the focus from “who ranks where” to “how well does it perform on our tasks.”
2. Three Core Evaluation Dimensions
A new model can be evaluated across three dimensions.
- Task capability: Cover common tasks such as code writing and modification, technical document understanding, data analysis, and logical reasoning. Prepare a test set for each task type with standard answers or automatically verifiable results.
- Cost structure: Total cost is determined by input tokens, output tokens, reasoning depth settings, and retry count. Looking only at unit price can easily underestimate actual spend. If a task requires three rounds of correction to pass, the total cost may be close to three times that of a single round.
- Latency and stability: Interactive scenarios care about time to first token, while batch scenarios care about throughput. Also record timeout rates and output format error rates, because failed calls still incur costs.
2.1 Building a Task Benchmark Set
The benchmark set should come from real tickets or historical requirements and be stratified by difficulty and type. Each sample should record the input content, expected output, and scoring rules. Tasks with clear answers are suitable for automatic scoring, such as unit test pass rates. Open-ended tasks can use double-blind human review or an independent model to assist with scoring, but scoring consistency should be spot-checked regularly to avoid scoring standard drift.
2.2 How to Calculate Cost
The cost per task should be calculated across the full chain, not just a single call:
cost_per_task = input_tokens × input_unit_price + output_tokens × output_unit_price+ retry_count × per_call_cost
Calculations should be grouped by task type, and manual correction time should also be recorded. A model may be cheap per call, but if it requires substantial manual correction, overall efficiency may not be higher.
3. Engineering Implications of Long-Context Capabilities
Supporting a longer context does not mean that all materials should be placed into a single request. Long context is suitable for tasks that require cross-file understanding, such as tracking how an interface is called across multiple modules. For questions that only need local information, retrieval-augmented generation is usually more cost-effective and makes it easier to locate the source of errors. In practice, a hybrid strategy can be used: first use retrieval to narrow the scope, then place the relevant files in full into the context.
When using long context, consider the following:
- Place key instructions at the beginning or end of the context to reduce the risk of middle content being overlooked.
- Split long documents in a structured way, preserving heading hierarchy and references so the model can locate information more easily.
- Record the relationship between context length and accuracy to identify the effective length range for the team’s tasks and avoid ineffective stacking.
4. How to Evaluate Agent Workflows
The difference between an agent and single-turn Q&A is that an agent needs to plan steps, call tools, read intermediate results, and decide the next action. Evaluation should therefore focus on four metrics: task completion rate, step efficiency, error recovery, and side-effect control.
- Completion rate: Whether the end-to-end task delivered a usable result.
- Step efficiency: The number of tool calls required to complete the task.
- Error recovery: Whether the agent can adjust its strategy after a tool returns an exception, rather than repeating the same erroneous operation.
- Side-effect control: Whether the agent modifies files, deletes data, or executes high-risk commands without authorization.
Below is an illustrative evaluation framework. The dependent functions need to be implemented according to the actual environment:
import timedef run_eval(client, cases, max_steps=20):report = []for case in cases:start = time.perf_counter()state = {"history": [], "steps": 0, "done": False}while not state["done"] and state["steps"] < max_steps:action = client.plan(case["goal"], state["history"])if action.type == "finish":state["done"] = Truebreak# Execute tools in a sandbox to avoid affecting real dataobservation = execute_tool(action, sandbox=True)state["history"].append((action, observation))state["steps"] += 1report.append({"id": case["id"],"completed": case["check"](state["history"]),"steps": state["steps"],"latency_s": round(time.perf_counter() - start, 2),"unsafe_actions": count_unsafe(state["history"]),})return report
The key to this framework is executing tools in a sandbox and tracking side effects as an independent metric. This way, even if the model occasionally oversteps its authority, the issue can be found during evaluation rather than affecting the production environment.
5. Controlling Hallucinations and Knowledge Staleness
A model’s training data has a cutoff date, so it can easily give outdated or fabricated answers for new API versions, recent policies, or internal standards. To reduce this risk, teams can take three approaches:
- Connect authoritative sources: Use retrieval to connect official documentation or an internal knowledge base so that answers can be traced back to specific passages.
- Constrain output behavior: Explicitly require in the prompt that when something cannot be confirmed, the model should state the uncertainty and indicate where the basis is located.
- Automatically verify conclusions: For key conclusions, execute code, compare database records, or consult authoritative documentation to test model output against external results.
Prompt constraints can reduce obvious fabrication, but they cannot replace external verification. Teams should treat them as the first line of defense, not the only line of defense.
6. Deployment Recommendations
- Start with a small benchmark set for horizontal comparison and shortlist two or three candidate models.
- Run a canary release in the real workflow and use the manual correction rate as a core metric.
- Allocate model tiers by task value. Use more capable models for complex, high-value tasks, and lower-cost models for batch, simple tasks.
- Build a cost dashboard that tracks the cost per unit of output by task type.
- Re-test once per quarter, because model versions and pricing change over time.
Conclusion
Model capability determines the upper bound of tasks, while call cost determines the room for scale. Teams should put both into the same evaluation table and make decisions based on their own task data, rather than relying only on public leaderboards or a single promotional metric.
