Introduction
In our last few lessons, you've built the core of an AI agent, equipping it with both short-term conversational memory and long-term knowledge through a Retrieval-Augmented Generation (RAG) system. Your agent can now hold a contextual conversation and consult a private knowledge base. But a critical question remains: which Large Language Model should serve as the agent's "brain"?
This lesson addresses the learning outcome: Evaluate the trade-offs between different LLM providers (e.g., cost, latency, accuracy) for project finance tasks.
Choosing an LLM is not about finding the single "best" model, but about selecting the "best fit" for a specific task. This decision involves navigating a classic trade-off between three key factors: accuracy, latency (speed), and cost. You can rarely maximize all three simultaneously. As you build sophisticated agents for project finance, understanding how to navigate this trade-off is one of the most critical architectural decisions you'll make.
The landscape of LLM cost and capability is also incredibly dynamic. What is state-of-the-art and expensive today may be a commodity tomorrow.

The Core Trade-off Framework: Accuracy, Latency, and Cost
The fundamental challenge in deploying LLMs at scale is balancing the quality of the model's output with the speed and cost of generating it. A great starting point is to adopt the philosophy used by the model providers themselves: first, optimize for the accuracy you need, and then optimize for latency and cost.
To get a deep dive into this framework, we'll watch a presentation from OpenAI's development team. It provides an excellent structure for thinking about these trade-offs.
OpenAI DevDay 2024 | Balancing accuracy, latency, and cost at scale
This video from OpenAI DevDay, 'Balancing accuracy, latency, and cost at scale,' lays out the foundational principles for optimizing LLM applications. We will reference different parts of it throughout this lesson.
First, watch the introduction from 02:38 to 03:31. Focus on the core methodology presented: Start by optimizing for accuracy to hit a business target. Then, optimize for latency and cost to maintain that accuracy with the cheapest, fastest model possible.
Part 1: Defining and Measuring "Accuracy" for Project Finance
For a general-purpose chatbot, "accuracy" might mean providing helpful, coherent answers. For your project finance agents, the definition is far more stringent. It involves capabilities like:
- Numerical Modeling: Performing calculations correctly (e.g., DSCR, IRR).
- Temporal Reasoning: Understanding sequences of events (e.g., construction milestones vs. operational periods).
- Scenario Planning: Evaluating outcomes under different assumption sets.
- Terminology Understanding: Correctly interpreting finance-specific jargon.
Standard benchmarks like MMLU provide a general sense of a model's knowledge, but they don't capture performance on these specialized financial tasks. Fortunately, academic research provides more domain-specific insights.
XFINBENCH: Benchmarking LLMs in Complex Financial ...
The research paper 'XFINBENCH: Benchmarking LLMs in Complex Financial Problem Solving and Reasoning' is directly relevant to your goals. It evaluates leading LLMs on graduate-level finance problems, giving us a clear picture of their strengths and weaknesses in this domain.
You don't need to read the entire paper. Instead, focus on these key parts: Read the Abstract to understand the benchmark's purpose and key findings. Examine Table 3: Performance of models on XFINBENCH to see the overall accuracy scores. Carefully study Table 10: Performance of models across five capabilities. This is the most important part. Compare how models like o1-preview, claude-3.5-sonnet, and gpt-4o perform on the five key capabilities (TU, TR, FF, SP, NM). Note the significant gap that still exists between the best models and human experts.
The XFINBENCH results show that even the most advanced models struggle with certain financial reasoning tasks, and no single model is the best at everything. This underscores the most important principle of model evaluation: benchmarks are a guide, but you must test on your own data.
The OpenAI video provides a practical framework for this.
OpenAI DevDay 2024 | Balancing accuracy, latency, and cost at scale
Now, let's look at how to systematically improve and measure accuracy for your specific use case.
Watch the section on optimizing accuracy from 03:31 to 17:10. Pay close attention to: Eval-driven development: The idea that you haven't 'built' a component until you have an evaluation to test it. Setting an accuracy target: The cost model example (at 09:20) is a powerful way to frame the business case for your agent's required performance. Optimization techniques: How Prompt Engineering, RAG (which you learned about last lesson), and Fine-Tuning are used to reach your accuracy target.
For your project finance agents, an "eval" could be a set of questions about a deal memo where you already know the answers (a "golden dataset"). You can then measure how often a model provides the correct answer, helping you choose between providers and prompting strategies.
Part 2: Analyzing Latency and Cost
Once you have a model that meets your accuracy threshold, the next step is to see if you can achieve the same result faster and cheaper.
Latency (Speed)
Latency is critical for user-facing applications. An agent that takes 10 seconds to answer a question feels broken. Total request latency can be broken down into:
- Time to First Token (TTFT): How long it takes to process the prompt and start generating a response.
- Time Between Tokens (TBT): The speed at which subsequent tokens are generated. Total output time is TBT multiplied by the number of output tokens.
OpenAI DevDay 2024 | Balancing accuracy, latency, and cost at scale
Let's return to the OpenAI video for a technical breakdown of latency.
Watch the section on latency from 17:10 to 26:25. Focus on the practical advice for reducing latency, such as using shorter prompts (or at least making them more concise), choosing smaller models where possible, and prompting for concise outputs.
Cost
LLM usage is typically billed per token, with different rates for input (prompt) and output (generation). Costs can add up quickly, especially with large context windows or high-volume tasks.
OpenAI DevDay 2024 | Balancing accuracy, latency, and cost at scale
The final segment of the OpenAI video covers cost optimization strategies.
Watch the section on cost from 26:25 to 32:26. The two key takeaways are: Prompt Caching: If you send the same system prompt repeatedly, the provider can cache it, reducing cost and latency. Batch API: For non-urgent, asynchronous tasks, you can submit jobs in a batch for a significant discount (often 50%). This is perfect for many back-office project finance analyses.
To see how these concepts apply in the real world, let's look at a practical comparison guide.
LLM Comparison Guide: December 2025 Rankings
The 'LLM Comparison Guide' provides a fantastic, data-rich overview of the current market, comparing leading models on performance, pricing, and speed. The dates and model versions are illustrative but reflect the kind of analysis you should perform.
Review the following sections: Technical Specifications at a Glance and Pricing Comparison & Cost Optimization: Look at the hard numbers for pricing, context windows, and tokens/second. Notice the vast difference in cost between models. Speed & Latency: See how tokens/second translates into real-world response times.
Part 3: The Strategic Choice: Proprietary vs. Open-Source
So far, we've focused on proprietary models available via an API (e.g., from OpenAI, Anthropic, Google). An alternative is to host an open-source model (e.g., from Meta, Mistral) on your own infrastructure.
Proprietary Models (API-based):
- Pros: Easy to use, no infrastructure to manage, access to the absolute state-of-the-art.
- Cons: Pay-per-use can be expensive, data privacy concerns (your data is sent to a third party), less control over the model.
Open-Source Models (Self-hosted):
- Pros: Full data privacy and control, no per-token API costs (only infrastructure costs), ability to deeply fine-tune.
- Cons: Requires significant engineering effort to set up and maintain, infrastructure can be expensive, typically lag slightly behind the frontier proprietary models in performance.
LLM Comparison Guide: December 2025 Rankings
The LLM Comparison Guide also provides a concise summary of this strategic choice.
Read the sections 'Open Source Alternatives' and 'Enterprise Considerations: Security & Compliance'. Note the trade-offs regarding infrastructure, maintenance, and data residency.
For someone with your CS background, the technical aspects of self-hosting are important. Latency isn't just a function of the model; it's also determined by the serving infrastructure.
.png)
A Practical Framework for Model Selection
Let's synthesize everything into a decision-making framework for building your project finance agents. The best practice is not to choose one model for everything, but to implement a multi-model routing strategy.
- Define the Task & Requirements: What is the agent doing?
- Task: Simple classification (e.g., "Is this a PPA?").
- Requirements: High volume, low cost, latency is not critical.
- Select a Candidate Model:
- A cheap, fast model is ideal. DeepSeek or a small, self-hosted open-source model would be a good fit. Using Claude or
o1would be massive overkill.
- A cheap, fast model is ideal. DeepSeek or a small, self-hosted open-source model would be a good fit. Using Claude or
- Test and Evaluate:
- Run a test set of 1,000 documents through the candidate model and measure its accuracy. If it meets your 99% accuracy target, you have your model.
- Build a Router:
- Create a "router" or "supervisor" agent that directs tasks to the appropriate specialist model.
The LLM Comparison Guide offers excellent heuristics for this.
LLM Comparison Guide: December 2025 Rankings
This guide provides clear, actionable advice on when to use—and when not to use—each model.
Read the sections 'When NOT to Use Each Model', 'Common Mistakes to Avoid', and 'Use Case-Specific Model Recommendations'. This is the synthesis of this lesson – turning the abstract trade-offs into concrete deployment decisions.
Test your understanding!
You are designing a multi-agent system for project finance. You need to build two distinct agents:
- Agent A (Due Diligence Summarizer): This agent runs overnight. It reads 100+ documents from a data room (legal opinions, technical reports, environmental assessments) and generates a 10-page "Key Risks and Mitigants" report for the investment team to review in the morning.
- Agent B (Deal Screener Assistant): This is a real-time chatbot for investment analysts. An analyst can paste in a news snippet about a new solar project and ask questions like "Does this fit our investment thesis?" or "What are the likely key risks here?".
For each agent, which dimension of the trade-off triangle (Accuracy, Latency, Cost) is most important, and which is least important? Based on that, what type of model would you choose as a starting point for each?
Show answer
-
Agent A (Due Diligence Summarizer):
- Most Important: Accuracy. The output is a critical investment document. Errors or missed risks could have severe financial consequences. You need the most capable, reliable model available (e.g., Anthropic's Claude 3.5/Opus, OpenAI's
o1). - Least Important: Latency. The agent runs overnight. Whether it takes 1 hour or 4 hours is largely irrelevant.
- Cost: Cost is a consideration, but it's secondary to accuracy. This is a perfect use case for the Batch API, which would give you access to a high-quality model at a 50% discount.
- Model Choice: A top-tier proprietary model like Claude 3.5 Sonnet or
o1, accessed via the Batch API.
- Most Important: Accuracy. The output is a critical investment document. Errors or missed risks could have severe financial consequences. You need the most capable, reliable model available (e.g., Anthropic's Claude 3.5/Opus, OpenAI's
-
Agent B (Deal Screener Assistant):
- Most Important: Latency. This is an interactive chatbot. Responses must feel instant (sub-3 seconds). A high-latency model will lead to a poor user experience.
- Least Important: Accuracy (relatively). While the answers must be good, they are for initial screening, not final investment decisions. A slightly less "deep" but much faster model is acceptable.
- Cost: Cost is important because this agent could be used frequently by many analysts.
- Model Choice: A model optimized for speed and cost, like GPT-4o, Gemini 1.5 Flash, or a well-optimized self-hosted open-source model like Llama 3.1 70B.
Conclusion
You now have a comprehensive framework for one of the most vital decisions in building AI systems: choosing the right LLM. This isn't a one-time choice but a continuous process of evaluation as models evolve and your application's needs change.
Key Takeaways:
- The Iron Triangle: Model selection is a constant trade-off between accuracy, latency, and cost.
- Accuracy is Domain-Specific: General benchmarks are a starting point, but you must evaluate models on tasks relevant to your domain, like the financial reasoning capabilities tested in XFINBENCH.
- Optimize Systematically: Start by hitting your accuracy target, then use techniques like prompt caching, batch processing, and choosing smaller models to optimize for latency and cost.
- Proprietary vs. Open-Source: This is a key strategic decision balancing ease-of-use and frontier performance against control, privacy, and long-term cost.
- Use a Multi-Model Strategy: The most effective and cost-efficient systems use a router to delegate tasks to different models—cheaper models for simple tasks and more powerful models for complex, critical ones.
In this lesson, we discussed the concept of a "router agent" that directs tasks to the right model. In our next lesson, we will put this into practice. We will tackle the learning outcome: Build a simple router agent that selects the appropriate tool based on user queries. You will learn how to build an agent that can dynamically choose between different functions or even other agents, a foundational step towards orchestrating the complex, multi-agent systems you aim to create.