LLM System Design and Mannequin Choice – O’Reilly
Choosing the proper LLM has grow to be a full-time job. New fashions seem nearly every day, every providing completely different capabilities, costs, and quirks, from reasoning strengths to price effectivity to code era. This competitors creates sturdy incentives for AI labs to carve out a distinct segment and offers new startups room to emerge, leading to a fragmented panorama the place one mannequin could excel at reasoning, one other at code, and a 3rd at price effectivity.
AI, in a single sense, is getting cheaper quicker than any earlier know-how, a minimum of per unit of intelligence. For instance, enter tokens for Gemini 2.5 Flash-Lite are roughly 600 instances cheaper than what OpenAI’s GPT-3 (davinci-002) price in August 2022, whereas outperforming it on each metric. On the similar time, entry to frontier capabilities can be changing into costlier than ever. The reason being easy: we will now pay straight for extra functionality, which has led to the rise of $300+ per 30 days Professional subscription tiers.
At the moment, any developer can run succesful open-weight fashions regionally for negligible marginal price utilizing instruments like Ollama. On the similar time, enterprise techniques can expertise sharp price will increase, relying on the mannequin measurement (variety of parameters, comparable to 3 billion, 70 billion, and even within the trillions), the variety of inside processing steps, and the quantity of enter knowledge. For builders, these are central system design decisions that straight have an effect on feasibility and price construction. For finish customers, this complexity explains why a primary subscription differs a lot from a premium plan with greater limits on superior fashions.
The alternatives you make in these broader improvement selections additionally decide which LLM and inference settings are optimum on your use case.
At In the direction of AI, we work throughout the LLM stack, constructing purposes, designing enterprise techniques, and providing on-line programs (including one on O’Reilly), customized company coaching, and LLM improvement consultancy. In our expertise, mannequin choice and system design have grow to be central to getting significant outcomes from these instruments. A lot of that, in flip, is dependent upon the place right this moment’s fashions are gaining their capabilities. Whereas scale nonetheless performs a job, current progress has come from a broader combine of things, together with training-data high quality, post-training strategies, and particularly how fashions are used at inference time.
The Shifting Foundations of Mannequin Functionality
Whereas early positive aspects in LLM efficiency tracked intently with will increase in pretraining compute, bigger datasets, larger fashions, and extra coaching steps, this method now yields diminishing returns.
Latest enhancements come from a broader mixture of methods. Pretraining-data high quality has grow to be simply as essential as amount, with higher filtering and AI-generated artificial knowledge contributing to stronger fashions. Architectural effectivity, just like the improvements launched by DeepSeek, has began to shut the hole between measurement and functionality. And post-training methods, particularly instruction tuning and reinforcement studying from human or AI suggestions (RLHF/RLAIF), have made fashions extra aligned, controllable, and responsive in follow.
The extra elementary shift, nevertheless, is going on at inference time. Since late 2024, with fashions like OpenAI’s o1, we’ve entered a brand new part the place fashions can commerce compute for reasoning on demand. Relatively than relying solely on what was baked in throughout coaching, they will now “assume tougher” at runtime, working extra inside steps, exploring different solutions, or chaining ideas earlier than responding. This opens up new functionality ceilings, but additionally introduces new price dynamics.
These assorted enchancment methods have led to a transparent divergence amongst AI labs and fashions, a fast growth in mannequin alternative, and in some circumstances, an explosion in mannequin utilization prices.
The Fashionable Value Explosion: How Inference Scaling Modified the Recreation
Inference-time compute scaling has launched a brand new dynamic in LLM system design: We’ve gone from a single lever mannequin measurement, to a minimum of 4 distinct methods to commerce price for functionality at runtime. The result’s a widening hole in inference price throughout fashions and use circumstances, typically by elements of 10,000x or extra.
Bigger fashions (measurement scaling): The obvious lever is sheer mannequin measurement. Frontier LLMs, like GPT-4.5, typically constructed with combination of specialists (MoE) architectures, can have enter token prices 750 instances greater than streamlined fashions like Gemini Flash-Lite. Bigger parameter counts imply extra compute per token, particularly when a number of specialists are lively per question.
Collection scaling (“considering tokens”): Newer “reasoning” LLMs carry out extra inside computational steps, or an extended chain of thought, earlier than producing their remaining reply. For instance, OpenAI’s o1 used ~30x extra compute than GPT-4o on common, and infrequently 5x extra output tokens per job. Agentic techniques introduce an extra technique of sequence scaling and an additional layer of price multiplication. As these brokers assume, plan, act, reassess, plan, act, and so forth, they typically make many LLM steps in a loop, every incurring extra price.
Parallel scaling: Right here, the system runs a number of mannequin situations on the identical job after which robotically selects the most effective output through automated strategies, comparable to majority voting (which assumes the commonest reply is probably going right) or self-confidence scores (the place the mannequin output claiming the very best confidence in its response is taken as the most effective). The o3-pro mannequin doubtless runs 5–10x parallel situations over o3. This multiplies the price by the variety of parallel makes an attempt (with some nuance).
Enter context scaling: In RAG pipelines, the variety of retrieved chunks and their measurement straight affect enter token prices and the LLM’s capacity to synthesize a superb reply. Extra context can typically enhance outcomes, however this comes at the next price and potential latency. Context isn’t free; it’s one other dimension of scaling that builders should price range for.
Taken collectively, these 4 elements symbolize a elementary shift in how mannequin price scales. For builders designing techniques for high-value issues, 10,000x to 1,000,000x variations in API prices to resolve an issue primarily based on architectural decisions are actually lifelike potentialities. Reasoning LLMs, though solely distinguished for about 9 months, reversed the development of declining entry prices to the easiest fashions. This transforms the choice from “Which LLM ought to I exploit?” to incorporate “How a lot reasoning do I wish to pay for?”
This shift modifications how we take into consideration choice. Selecting an LLM is not about chasing the very best benchmark rating; it’s about discovering the stability level the place functionality, latency, and price align along with your use case.
Core Mannequin Choice Standards
When selecting a mannequin we discover it is very important first clearly establish your use case and the minimal core AI capabilities and attributes wanted to ship it.
A typical first step is to check out customary benchmark scores (for instance LiveBench, MMLU-Professional, SWE-Bench). These benchmarks are a helpful place to begin, however some fashions are tuned on benchmark knowledge, and real-world efficiency on duties which might be truly related to you’ll typically differ. Filtering benchmark assessments and scores by your trade and job class is a useful step right here. An LLM optimized for software program improvement may carry out poorly in artistic writing or vice versa. The match between a mannequin’s coaching focus and your utility area can outweigh general-purpose benchmarks.
Leaderboards like LMArena and Artificial Analysis provide broader human‑desire comparisons however nonetheless don’t substitute customized real-world testing. It helps to have a set of your individual instance questions or duties at hand to check out a brand new mannequin for your self and see the way it performs. This could embody a mixture of simple duties to ascertain a baseline and difficult edge circumstances the place it’s simple for a mannequin to make errors.
As you progress past advert hoc testing, for any severe improvement effort, customized evaluations are non-negotiable. They should be tailor-made to your use case and the sorts of issues you resolve. That is the one option to actually know if a mannequin, or a change to your system, is genuinely enhancing issues for your customers and your particular enterprise targets.
Listed below are some core elements we contemplate:
Multimodality is rising as a serious differentiator. Fashions like GPT-4o and Gemini can deal with not simply textual content but additionally photographs, audio, and in some circumstances video, unlocking purposes that pure textual content fashions can’t assist.
Context window and efficient context window utilization are additionally key: What number of tokens or paperwork can the mannequin course of and the way a lot of that marketed context window can the LLM truly use successfully with out efficiency degradation relative to duties that use much less context?
Latency is particularly important for interactive purposes. Normally, smaller or cheaper fashions have a tendency to reply quicker, whereas reasoning-heavy fashions introduce delays because of deeper inside computation.
Reasoning is the power to scale inference-time compute and carry out multistep problem-solving, planning, or deep evaluation.
Privateness and safety are sometimes key concerns right here. For instance, if you wish to maintain your mental property non-public, you should use a mannequin that received’t prepare in your inputs, which regularly factors towards self-hosted or particular enterprise-grade API options.
Trustworthiness can be changing into essential and may come right down to the status and monitor file of the AI lab. A mannequin that produces erratic, biased, or reputationally damaging outputs is a legal responsibility, no matter its benchmark scores. For example, Grok has had well-publicized points with its alignment. Even when such points are supposedly mounted, it creates a lingering query of belief: How can one ensure it received’t behave equally sooner or later?
Moreover, the information cutoff date additionally issues whether it is for use in a fast-moving discipline.
After understanding if a mannequin meets your minimal functionality, the following choice is commonly on optimizing trade-offs amongst price, reliability, safety, and latency. A key rule of thumb we discover helpful right here: If the reliability acquire from a costlier mannequin or extra inference time saves extra of your or your customers’ time (valued when it comes to pay) than the mannequin prices, going with the bigger mannequin is an efficient choice!
The Execs and Cons of Open-Weight and Closed-API LLMs
The rise of more and more aggressive open-weight LLMs, comparable to Meta’s Llama sequence, Mistral, DeepSeek, Gemma, Qwen, and now OpenAI’s GPT-OSS has added a important dimension to the mannequin choice panorama. Momentum behind this open ecosystem surged with the discharge of DeepSeek’s R1 reasoning mannequin, aggressive with OpenAI’s o1 however priced at roughly 30x decrease API prices. This sparked debate round effectivity versus scale and intensified the broader AI rivalry between China and the US. Reactions ranged from “OpenAI and Nvidia are out of date” to “DeepSeek’s prices should be fabricated,” however no matter hype, the discharge was a milestone. It confirmed that architectural innovation, not simply scale, may ship frontier-level efficiency with far higher price effectivity.
This open-model offensive has continued with sturdy contributions from different Chinese language labs like Alibaba (Qwen), Kimi, and Tencent (Hunyuan), and has put aggressive stress on Meta after its open-weight Llama fashions fell behind. China’s current management in open-weight LLMs has raised new safety/IP points with some US- and European-based organizations, although we observe accessing these mannequin weights and working the mannequin by yourself infrastructure doesn’t require sending knowledge to China.
This brings us again to the professionals and cons of open weights. Whereas closed-API LLMs nonetheless lead on the frontier of functionality, the first benefit of open-weight fashions is fast and inexpensive native testing, unparalleled flexibility, and elevated knowledge safety when run internally. Organizations may also carry out full fine-tuning, adapting the mannequin’s core weights and behaviors to their particular area, language, and duties. Open fashions additionally present stability and predictability—you management the model you deploy, insulating your manufacturing techniques from sudden modifications or degradations that may typically happen with unannounced updates to proprietary API-based fashions.
Public closed-model APIs from main suppliers profit from immense economies of scale and extremely optimized GPU utilization by batching requests from 1000’s of customers, an effectivity that’s tough for a single group to duplicate. This typically implies that utilizing a closed-source API might be cheaper per inference than self-hosting an open mannequin. Safety and compliance are additionally extra nuanced than they first seem. Whereas some organizations should use self-hosted fashions to simplify compliance with laws like GDPR by protecting knowledge completely inside their very own perimeter, this locations the complete burden of securing the infrastructure on the interior group—a fancy and costly enterprise. Prime API suppliers additionally typically provide devoted situations, non-public cloud endpoints, and contractual agreements that may assure knowledge residency, zero-logging, and meet stringent regulatory requirements. The selection, subsequently, will not be a easy open-versus-closed binary.
The boundary between open and closed fashions can be changing into more and more blurred. Open-weight fashions are more and more supplied through API by third-party LLM inference platforms, combining the pliability of open fashions with the simplicity of hosted entry. This hybrid method typically strikes a sensible stability between management and operational complexity.
Main Closed LLMs
Under, we current some key prices and metrics for main closed-source fashions accessible through API. Many of those fashions have extra complexity and assorted pricing together with choices for quick modes, considering modes, context caching, and longer context.
We current the most recent LiveBench benchmark rating for every mannequin as one measure for comparability. LiveBench is a constantly up to date benchmark designed to supply a “contamination-free” analysis of huge language fashions by often releasing new questions with goal, verifiable solutions. It scores fashions out of 100 on a various set of difficult duties, with a big deal with capabilities like reasoning, coding, and knowledge evaluation. The same LiveBench scores between GPT-4.5 and a couple of.5 Flash-Lite, regardless of 750x enter token price variation, highlights each that smaller fashions are actually very succesful but additionally that not all capabilities are captured in a single benchmark!

Main open-weight LLMs
Under, we additionally current key prices, the LiveBench benchmark rating, and context size for main open-weight fashions accessible through API. We evaluate hosted variations of those fashions for simple comparability. Completely different API suppliers could select to host open-weight fashions with completely different ranges of quantization, completely different context lengths, and completely different pricing, so efficiency can differ between suppliers.

Whether or not hosted or self-deployed, choosing a mannequin solely solves a part of the issue. In follow, a lot of the complexity and alternative lies in how that mannequin is used: the way it’s prompted, prolonged, fine-tuned, or embedded inside a broader workflow. These system-level selections typically have a higher influence on efficiency and price than the mannequin alternative itself.
A Sensible Information to Designing an LLM System
Merely choosing the most important or latest LLM isn’t the optimum technique. A more practical method begins with a deep understanding of the developer’s toolkit: figuring out which approach to use to which downside to realize the specified functionality and reliability with out pointless price. That is all a part of the fixed “march of nines” as you develop LLM techniques modularly to resolve for extra reliability and functionality. There’s a must prioritize the simplest wins that ship tangible worth earlier than investing in additional incremental and infrequently expensive accuracy enhancements. The truth will all the time differ on a case-by-case foundation, however here’s a fast information to navigating this course of.
Step 1: Open Versus Closed?
That is typically your first choice.
- Go together with a closed-API mannequin (e.g., from OpenAI, Google, Anthropic) if: Your precedence is accessing absolutely the state-of-the-art fashions with most simplicity.
- Go together with an open-weight mannequin (e.g., Llama, Mistral, Qwen, DeepSeek) if:
- Knowledge safety and compliance are paramount: If it is advisable assure that delicate knowledge by no means leaves your individual infrastructure.
- You want deep customization and management: In case your purpose is to fine-tune a mannequin on proprietary knowledge and to create a specialised skilled that you simply management fully.
In case you went open, what are you able to realistically run? Your personal GPU infrastructure is a tough constraint. Assess your cluster measurement and reminiscence to find out when you can effectively run a big, main 1 trillion+ parameter MoE mannequin, comparable to Kimi K2, or in case you are higher served by a medium-size mannequin comparable to Gemma 3 27B or a a lot smaller mannequin like Gemma 3n that may even run on cellular.
Step 2: Gauging the Want for Reasoning
Does your job require the mannequin to easily blast out a response, or does it must assume first?
- Reasoning: For duties that contain advanced, multistep problem-solving, brainstorming, strategic planning, intricate code era, or deep evaluation, you want a devoted reasoning mannequin comparable to o3, Gemini 2.5 Professional, DeepSeek R1, or Claude 4. In some circumstances these fashions can be utilized in high-reasoning mode, which inspires the mannequin to assume for longer earlier than responding.
- No reasoning: For simple duties like easy Q&A, summarization of a single doc, knowledge extraction, or classification, a robust reasoning mannequin is overkill.
- The center floor: For duties requiring reasonable reasoning, comparable to producing a structured report from just a few knowledge factors or performing primary knowledge evaluation at scale, a “mini” reasoning mannequin, like OpenAI’s o4-mini or Gemini Flash 2.5, presents a stability of functionality and price.
Step 3: Pinpointing Key Mannequin Attributes
Past basic intelligence and reasoning, fashionable LLMs are specialists. Your alternative must be guided by the particular attributes and “superpowers” your utility wants.
- Prioritize accuracy over price for high-value duties the place errors are expensive or the place a human skilled’s time is being saved. o3-pro is a standout mannequin right here and it may possibly even be used as a reality checker to meticulously verify the small print of an earlier LLM output.
- Prioritize pace and price over accuracy: For user-facing, real-time purposes like chatbots or high-volume, low-value duties like easy knowledge categorization, latency and price are paramount. Select a hyper-efficient “flash” or “mini” mannequin comparable to Gemini 2.5 Flash-Lite. Qwen3-235B fashions will also be a terrific choice right here however are too advanced to inference your self.
- Do you want a deep, long-context researcher? For duties that require synthesizing info from large paperwork, whole codebases, or intensive authorized contracts, a mannequin with an unlimited and extremely efficient context window is essential. Gemini 2.5 Professional excels right here.
- Is multimodality important? In case your utility wants to know or generate photographs, course of audio in actual time, or analyze video, your alternative narrows to fashions like GPT-4o or the Gemini household. For one-shot YouTube video processing, Gemini is the standout.
- Is it a code-specific job? Whereas many fashions can code, some are explicitly tuned for it. Within the open world, Codestral and Gemma do an honest job. However Claude has received hearts and minds, a minimum of for now.
- Do you want stay, agentic net search? For answering questions on present occasions or subjects past the mannequin’s information cutoff, contemplate a mannequin with a built-in, dependable net search, comparable to o3.
- Do you want advanced dialogue and emotional nuance? GPT-4.5, Kimi K2, Claude Opus 4.0, or Grok 4 do a terrific job.
Step 4: Prompting, Then RAG, Then Analysis
Earlier than you dive into extra advanced and expensive improvement, all the time see how far you will get with the best methods. This can be a path of escalating complexity. Mannequin alternative for RAG pipelines is commonly centered round latency for finish customers, however just lately extra advanced agentic RAG workflows or long-context RAG duties require reasoning fashions or longer context capabilities.
- Immediate engineering first: Your first step is all the time to maximise the mannequin’s inherent capabilities by way of clear, well-structured prompting. Typically, a greater immediate with a extra succesful mannequin is all you want.
- Transfer to retrieval-augmented era (RAG): In case your mannequin’s limitation is an absence of particular, non-public, or up-to-date information, RAG is the following logical step. That is the most effective method for decreasing hallucinations, offering solutions primarily based on proprietary paperwork, and making certain responses are present. Nonetheless, RAG will not be a panacea. Its effectiveness is completely depending on the standard and freshness of your dataset, and constructing a retrieval system that persistently finds and makes use of the most related info is a big engineering problem. RAG additionally comes with many related selections, comparable to the amount of information to retrieve and feed into the mannequin’s context window, and simply how a lot use you make of long-context capabilities and context caching.
- Iterate with superior RAG: To push efficiency, you will want to implement extra superior methods like hybrid search (combining key phrase and vector search), re-ranking retrieved outcomes for relevance, and question transformation.
- Construct customized analysis: Guarantee iterations in your system design, additions of latest superior RAG methods, or updates to the most recent mannequin are all the time shifting progress ahead in your key metrics!
Step 5: Tremendous-Tune or Distill for Deep Specialization
If the mannequin’s core conduct—not its information—continues to be the issue, then it’s time to think about fine-tuning. Tremendous-tuning is a big enterprise that requires a high-quality dataset, engineering effort, and computational assets. Nonetheless, it may possibly allow a smaller, cheaper open-weight mannequin to outperform an enormous generalist mannequin on a particular, slim job, making it a robust software for optimization and specialization.
- Tremendous-tuning is for altering conduct, not including information. Use it to show a mannequin a particular ability, model, or format. For instance:
- To reliably output knowledge in a fancy, structured format like particular JSON or XML schemas.
- To grasp the distinctive vocabulary and nuances of a extremely specialised area (e.g., authorized, medical).
- Some closed-source fashions can be found for fine-tuning through API comparable to Gemini 2.5 Flash and numerous OpenAI fashions. Bigger fashions are usually not accessible.
- In open-weight fashions, Llama 3.3 70B and Qwen 70B are fine-tuning staples. The method is extra advanced to fine-tune an open-weight mannequin your self.
- Mannequin distillation may also function a production-focused optimization step. In its easiest type, this consists of producing artificial knowledge from bigger fashions to create fine-tuning datasets to enhance the capabilities of smaller fashions.
- Reinforcement fine-tuning (RFT) for problem-solving accuracy
As an alternative of simply imitating right solutions, the mannequin learns by trial, error, and correction. It’s rewarded for getting solutions proper and penalized for getting them unsuitable.- Use RFT to: Create a real “skilled mannequin” that excels at advanced duties with objectively right outcomes.
- The benefit: RFT is extremely data-efficient, typically requiring only some dozen high-quality examples to realize vital efficiency positive aspects.
- The catch: RFT requires a dependable, automated “grader” to supply the reward sign. Designing this grader is a important engineering problem.
Step 6: Orchestrated Workflows Versus Autonomous Brokers
The important choice right here is how a lot freedom to grant. Autonomous brokers are additionally extra more likely to want costlier reasoning fashions with higher ranges of inference scaling. Parallel inference scaling strategies with a number of brokers are additionally starting to ship nice outcomes. Small errors can accumulate and multiply throughout many successive agentic steps so the funding in a stronger extra succesful mannequin could make all of the distinction in constructing a usable product.
- Select an orchestrated workflow for predictable duties
You design a particular, typically linear, sequence of steps, and the LLM acts as a robust element at a number of of these steps.- Use when: You might be automating a recognized, repeatable enterprise course of (e.g., processing a buyer assist ticket, producing a month-to-month monetary abstract). The purpose is reliability, predictability, and management.
- Profit: You keep full management over the method, making certain consistency and managing prices successfully as a result of the quantity and kind of LLM calls are predefined.
- Construct hybrid pipelines: Typically, the most effective outcomes will come from combining many LLMs, open and closed, inside a pipeline.
- This implies utilizing completely different LLMs for various levels of a workflow: a quick, low cost LLM for preliminary question routing; a specialised LLM for a particular subtask; a robust reasoning LLM for advanced planning; and maybe one other LLM for verification or refinement.
- At In the direction of AI, we regularly have 2-3 completely different LLMs from completely different corporations in an LLM pipeline.
- Select an autonomous agent for open-ended issues. You give the LLM a high-level purpose, a set of instruments (e.g., APIs, databases, code interpreters), and the autonomy to determine the steps to realize that purpose.
- Use when: The trail to the answer is unknown and requires dynamic problem-solving, exploration, or analysis (e.g., debugging a fancy software program concern, performing deep market evaluation, planning a multistage mission).
- The important danger—runaway prices: An agent that will get caught in a loop, makes poor selections, or explores inefficient paths can quickly accumulate monumental API prices. Implementing strict guardrails is important:
- Price range limits: Set onerous caps on the price per job.
- Step counters: Restrict the whole variety of “ideas” or “actions” an agent can take.
- Human-in-the-loop: Require human approval for doubtlessly costly or irreversible actions.
- Gemini 2.5 Professional and o3 are our favorite closed-API fashions for agent pipelines, whereas in open-weight fashions we like Kimi K2.
Working by way of these steps helps translate a imprecise downside right into a concrete implementation plan, one which’s grounded in clear trade-offs and tailor-made to your wants. This structured method typically yields techniques that aren’t solely extra succesful and dependable but additionally far more practical for particular duties than a general-purpose chatbot ever might be.
Conclusion
The open-versus-closed race provides us fast entry to sturdy LLMs but additionally creates complexity. Deciding on and deploying them calls for each engineering self-discipline and financial readability.
Growing within the LLM ecosystem calls for a brand new stage of engineering self-discipline and eager financial consciousness. No single LLM is a cure-all. A sensible, evolving toolkit is crucial, however figuring out which software to drag out for which job is the true artwork. The problem isn’t simply choosing a mannequin from a listing; it’s about architecting an answer. This requires a scientific method, shifting from high-level strategic selections about knowledge and safety right down to the granular, technical decisions of improvement and implementation.
The success of specialised “LLM wrapper” purposes like Anyscale/Cursor for coding or Perplexity for search, a few of which are actually valued at over $10 billion, underscores the immense worth on this tailor-made method. These purposes aren’t simply skinny wrappers; they’re subtle techniques that leverage basis LLMs however add vital worth by way of customized workflows, fine-tuning, knowledge integration, and person expertise design.
Finally, success hinges on knowledgeable pragmatism. Builders and organizations want a pointy understanding of their downside area and a agency grasp of how price scales throughout mannequin alternative, sequence and parallel reasoning, context utilization, and agentic conduct. Above all, customized analysis is non-negotiable as a result of your use case, not a benchmark, is the one customary that actually issues.