目录

中文版

I am a beginner in large language models, gradually learning and understanding them. But in the process, I've encountered quite a few confusions. Here I adopt the Feynman learning method, hoping to explain some basic concepts, development history, technical solutions, and engineering practices of LLMs in plain language, to consolidate knowledge and fill in gaps. The following is a comprehensive overview.

1. What is a Large Language Model

When a user inputs: [I drank a cup of ___ before going out this morning], the model, based on the language patterns learned during training, calculates the “reasonable probability of what comes next” for thousands of fragments in its vocabulary. The highest probability candidates include “soy milk” and “cow milk” – expressions that align with common sense. If it selects the token corresponding to “soy,” the model then starts thinking again about what should follow [I drank a cup of soy], and the next output becomes [I drank a cup of soy milk], repeating this process until termination.

When a user inputs something like [I drank before going out this morning], during actual generation the model doesn't literally pick from tens of thousands of words. On one hand, low-probability words are often nonsensical and would make the content logically messy; on the other hand, considering the full vocabulary increases computational cost. So the model first uses rules to cut out extremely low-probability options, narrowing the candidate pool. This step is called candidate pool filtering, and the two most common rules are Top-K and Top-P algorithms.

After filtering to a reasonable candidate pool, the model randomly samples within this range according to probability to select the final next word. Temperature is used to adjust the randomness of this sampling:

That's how LLMs work. Through the simple mechanism of predicting the next word, the entire edifice is built.

Key technical details:

2. The Most Basic Operation Mode: Single-turn Interaction

Single-turn interaction is the most fundamental way LLMs operate, and it's the foundation for all subsequent complex interaction capabilities.

Many people think of LLMs as “Q&A” conversation machines, but from a logical standpoint, they only do one thing from start to finish: given some starting text, continue writing forward. All user input – questions, instructions, background information – is collectively called a prompt, essentially handing the model half a manuscript to complete. The complete result generated word by word based on this content is called the completion. The Q&A, copywriting, and code generation we see daily are essentially different forms of “continuation.”

This single-turn mode is inherently stateless; each interaction is completely independent. The model only processes the current input and won't actively remember information from the previous round of conversation. It's like handing it a fresh piece of scratch paper each time – it writes, clears it, and absolutely won't remember what was on the previous sheet.

Don't directly conflate this with mature complex products like [Doubao, CodeX, Claude Code]. At its core, the basic operation mode is stateless single-turn interaction. It's only through various engineering methods that people get the illusion of a stateful, multi-turn conversational Q&A system. Remember: LLMs are fundamentally not Q&A systems – they're one-shot continuation systems.

This also brings the most direct limitation: inability to handle multi-turn context. If you split the conversation into two rounds – first telling the model your name and age, then separately asking “How old am I?” – the model simply can't answer. Continuous conversation easily leads to “amnesia” and logical disconnection [we'll discuss solutions later]. In the single-turn interaction stage, the primary means of improving output quality is writing detailed prompts – refining the wording, structure, and instruction format to guide the model toward more accurate, better-aligned results.

Key technical details:

3. The Emergence of Context: The Foundation of Multi-turn Dialogue

Since LLMs are “memoryless” continuation machines, how do we get that smooth back-and-forth, even heart-to-heart chatting feeling in [Doubao]?

Actually, this is entirely an engineering “trick.” LLMs themselves don't remember things [Note: there are some solutions, which we'll discuss at an appropriate time later], but the engineers behind chat products are clever: when you're on the third round of conversation with the model, the software secretly copies everything you've said in the first two rounds, along with the model's responses, pastes them like a sticky note in front of your new question, then packages it all into a long text and stuffs it into the model. Technically, this bundled “history ledger” is called context.

So, the LLM can answer your follow-up questions not because it “remembers,” but because each time you press send, you're handing over the entire history along with the new question, letting it do a larger-scale “single-turn continuation.” This engineering approach of trading space for time perfectly fakes human “memory,” but at a steep cost – every additional sentence you say causes the text volume for transmission and recalculation to avalanche upward. Not only does it get more expensive the more you chat, but it quickly hits the physical ceiling of the LLM's vision.

Now, you sharp-minded folks surely see several serious problems:

Key technical details:

4. Giving LLMs Hands and Feet

A Doubao that can only chat has significant limitations. We can't keep copy-pasting code text into [Doubao] and then copy-pasting the results back into our editor. That's way too tedious!! Is there a way to let the LLM directly modify files itself? But here at least a few problems exist:

Function Calling emerged, but always remember: LLMs will only ever do one thing – “continue writing text.” They absolutely have no ability to open a web page or execute a single line of code on their own.

So-called function execution is essentially a “secret handshake” between the LLM and backend engineering code. The LLM is responsible for making decisions (calling out the secret code), while the backend program handles the physical work (executing code based on the secret code).

  1. Suppose our LLM supports weather querying, allowing users to input a city for the forecast.
  2. Before processing the user's input, the backend secretly prepends this text: “I have a function called get_weather that can query city weather. If you want to use it, you must output a JSON-formatted result like: {\"name\": \"get_weather\", \"arguments\": {\"city\": \"Hangzhou\"}}.”
  3. The model makes a decision and writes the “secret code”: The LLM reads your weather question and the function documentation, and through “text continuation” probability calculation, figures out: making something up won't work, but the secret code from the instructions fits perfectly! So instead of outputting vague nonsense like “the weather might be nice today,” it spits out the formatted secret code: {\"name\": \"get_weather\", \"arguments\": {\"city\": \"Hangzhou\"}}
  4. The backend intercepts the secret code: When the backend detects that the model's output is a properly formatted JSON code, it immediately intercepts this output before the user can see it. It unpacks the JSON package, takes the “Hangzhou” parameter, actually calls the weather bureau's API, and gets real-time real-world data: “Hangzhou, heavy rain, 20C.”
  5. It stuffs the result back into the conversation, completing the final text continuation: The backend takes this real weather result, appends it to the end of the context, and hands it back to the LLM: “I've retrieved the result you asked for. The content is [Hangzhou, heavy rain, 20C]. Now, based on this result, please provide the final continuation to the user's question.” The LLM glances at the updated history ledger, understands, and finally outputs the sentence the user actually sees: “Master, it's heavy rain in Hangzhou today at 20C – be sure to bring an umbrella when you go out!” 6.

You smartly realize there might be several problems here:

We'll discuss strategies for solving these problems later.

Key timeline and technologies:

5. LLM Hallucinations

LLMs only ever do one thing – “continue writing text” – and they do it based on probability. This leads them to frequently make things up in domains they don't understand. Moreover, because of the context mechanism, once they start going wrong, subsequent content builds on previous content, leading to increasingly absurd errors. This is hallucination!!

Typical hallucinations:

One reason for hallucinations is insufficient training data in the relevant domain, so when continuing text, there's no significantly high probability for selecting the next appropriate word. But it seems hard to solve:

This makes LLMs difficult to use in certain scenarios:

Key technologies:

6. LLM Open-Book Exams

An LLM is a “continuation machine” without memory, faking memory entirely by pasting history records into context.

Suppose you're building a historical archive decryption assistant. You have various electronic historical materials, and you want the LLM to answer questions about historical materials accurately and comprehensively, detailing various aspects of a small battle.

The LLM's context can't fit all historical materials. Even if you could barely stuff in a copy of “WWII Declassified Archives,” to answer a user's 100-character question, you'd need to concatenate a million-character context to send to the LLM for inference and next-word prediction – cost-prohibitive.

Enter RAG (Retrieval-Augmented Generation). In a nutshell: it solves problems like an open-book exam, rather than memorizing the entire textbook.

6.1 The Four Steps of "Open-Book Exam"

When someone asks: “On the eve of the Normandy landings in 1944, how did the Allies use false intelligence to deceive the Germans?” Here's how the RAG system “cheats” behind the scenes:

The LLM doesn't need to memorize the entire archive. It just needs to take the open-book exam with the “precise cheat sheets” stuffed into its context each time.

6.2 Open-Book Exams Can Also Fail

To solve these open-book exam failures, the industry has evolved more complex patch technologies.

Key technical details:

7. LLM Self-Reflection

LLMs have long been criticized as “fast talkers lacking deep thinking.” In previous chapters, we saw that LLM content generation is like a reflex – seeing the previous Token, it spits out the next Token based on probability, without pause, all in one go.

This “intuitive” continuation works great for writing essays and churning out papers, but frequently fails when facing complex math problems, logical reasoning, or writing large-scale engineering code. When humans tackle advanced math, they still need scratch paper to scribble and calculate for a while. Yet LLMs are expected to spit out the final answer within milliseconds – this clearly violates the objective laws of complex tasks.

To teach LLMs to “think before they act” like humans, engineering and algorithmic techniques for letting LLMs “draft” behind the scenes have evolved.

7.1 The Subtext Behind "Deep Thought"

When a user inputs a tricky problem: “Xiaoming has 3 apples. Xiaohong has twice as many apples as Xiaoming. Xiaoming eats 1 apple. Xiaohong gives Xiaoming 4 apples. Who has more apples now? How many more?”

A traditional “intuitive” LLM might, due to similar number combinations in its training data, blurt out a wrong conclusion – because LLMs are continuation machines!!

But in the new reasoning era (represented by Reasoning models), before presenting the final answer to the user, the LLM conducts a lengthy self-continuation on its “mental scratch paper” behind the scenes:

Model's internal chain of thought:
1. First clarify initial state: Xiaoming = 3, Xiaohong = 3 * 2 = 6.2. Process the first change: Xiaoming eats 1, Xiaoming = 3 - 1 = 2.3. Process the second change: Xiaohong gives Xiaoming 4. Wait, Xiaohong gives away 4, so Xiaohong decreases! Xiaohong = 6 - 4 = 2; Xiaoming receives 4, Xiaoming = 2 + 4 = 6.4. Re-compare results: Now Xiaoming has 6, Xiaohong has 2. Xiaoming has more.5. Calculate the difference: 6 - 2 = 4. Check passed, ready to output.

Finally, the user sees the concise and elegant final answer on screen: “Xiaoming has more apples now, 4 more than Xiaohong.”

The LLM hasn't changed its “text continuation” essence – it's just turned part of its continuation into “inner thoughts” visible only to itself (Thought). By stretching the generation time and trading more Tokens for logical accuracy, this technique of making the model write out its thinking process step by step is called Chain of Thought (CoT).

7.2 Admitting Mistakes, Pruning, and Self-Correction

You smartly realize: if the LLM makes a mistake in the second step of “drafting,” won't it go completely off the rails afterward?

In the latest post-training techniques, LLMs have been trained with a “self-correction” ability. When they discover logical contradictions in their chain of thought (for example, realizing the calculated total number of apples doesn't add up), they actively hit the mental brakes: “No, I forgot to subtract the apples Xiaohong gave away from Xiaohong's total. Let me recalculate.”

This mechanism of continuously evaluating the current path during generation, and backtracking to retry when something's wrong, is like pruning and searching on a thought tree. The model no longer goes down one path to the bitter end but iterates repeatedly on virtual scratch paper until it finds the reasoning path with the highest probability and most self-consistent logic.

Key technical details:

8. LLM Agents -- Qualified Workhorses

Because we keep saying LLMs are “continuation machines,” they sound weak. You ask a question, it responds with a secret code, the backend finishes the work, and it's done. This “whip once, turn once” mode obviously isn't smart enough.

But if you've actually used Claude Code, OpenAI Codex, or Cursor, you must be amazed: how can they sit there for hours continuously modifying code, compiling, debugging, and re-modifying until bugs are completely fixed, just like a real programmer?

They haven't replaced the underlying LLM, nor have they applied any magic. This ability to sustain endurance and autonomously solve complex engineering problems is the crystallization of Agent technology.

8.1 What Are the "External Shell" and "Inner Power" of an Agent?

If we compare an LLM to a “wise person” who has retired from the world but knows all martial arts secrets under heaven. It understands all programming languages, knows all algorithms, but has a fatal weakness – it has no physical body and suffers from intermittent amnesia. It can't touch a computer, and as soon as it speaks next (one interaction ends), it completely forgets what was just discussed.

To make this “wise person” write code for us continuously for hours, engineering must build it an exoskeleton armor consisting of four core components:

  1. Brain (LLM): Still the sage responsible only for text continuation.
  2. Tools: Giving the sage hands. For example, an API to read local files, a command-line terminal to run npm run dev or pytest.
  3. Planning: Giving the sage a task list. Facing a big task, what to do first, what to do next.
  4. Memory: Giving the sage a notebook that never gets lost, recording what was just done.

8.2 The Secret Behind Hours of Continuous Programming: The ReAct Loop

Tools like Claude Code can work continuously for hours because the core mechanism is trapping the LLM in a carefully designed “Think → Act → Observe → Think again” infinite loop (technically called the ReAct pattern).

Let's break it down in plain language. When you type claude-code fix the login bug in the terminal, here's what's actually happening behind the scenes in this crazy “involution loop” over the next few hours:

This is the truth behind its ability to code continuously for hours: It doesn't write code correctly all at once. Like a human programmer, it writes a few lines, runs it, encounters errors, curses, looks at the error message, changes a few more lines, and re-runs. As long as you don't hit Ctrl + C to forcefully terminate, the LLM will tirelessly keep self-correcting in this infinite loop driven by the code shell.

8.3 What's the Biggest Engineering Pain Point of This "Endurance Run"?

You cleverly recall what we discussed in Chapter 3 – the “avalanche-like explosion” of context and costs.

Letting Claude Code run for hours means this “Think-Act-Observe” loop cycles hundreds or thousands of times. Every error message, every piece of code read, keeps getting pasted into the LLM's “history ledger (Context).”

  1. The ledger fills up quickly: If the project is large, after reading a dozen files, the LLM hits its physical vision ceiling (e.g., 200k Tokens), and it starts forgetting what the user originally asked it to do.
  2. Gets more expensive and slower with each turn: Each cycle requires the LLM to read through the thick stack of “history cheat sheets” from scratch before deciding what the next word should be. This means the later stages require massive Token computation for every step, and the response becomes increasingly sluggish.

To solve this, top-tier code Agents like Claude Code invest heavily in “context management.” They meticulously manage this ledger. We'll discuss details later.

Key technical details:

9. Taming and Conquering LLMs

We've been saying that LLMs are essentially “one-shot text continuation systems.” But in practical applications, they seem very obedient – they don't really resist or curse at people. According to previous theories about Top-K, Top-P, temperature control, etc., this doesn't seem to explain why LLMs appear to be tamed, becoming docile workhorses, working 996 – why???

Behind this lies the most crucial “taming” of LLMs. The raw model freshly crawled from massive internet text is actually a “wild and untamable” puzzle – it knows a lot but doesn't obey at all. The corpus from forums like Tieba and Reddit is full of sarcasm, mockery, and aggressive language. Without control, an LLM might, through its probability-based Top mechanism, start spewing garbage.

9.1 Triple Jump: From "Pre-training" to "Living Buddha"

To transform a machine that only blindly continues text into the empathetic, format-rigorous AI assistant we see in [Doubao], the LLM must go through three stages of evolution. We can vividly use the metaphor of “training a wild monkey that has read all the Buddhist scriptures in the library into a living Buddha sitting in the main hall who answers all questions”:

If you often use Grok or Gemini, you'll notice that multiple options often pop up simultaneously, asking you to choose which is better – this is also a form of RLHF.

9.2 Why Can't LLMs "Store" New Knowledge Online Like a Hard Drive?

Earlier we mentioned that LLM knowledge is often stuck at the year it was trained (e.g., 2024), and it can't “learn online.” You smartly think: since fine-tuning (SFT) can feed it new data, why not just stuff new private standard manuals or 2026 news directly into fine-tuning and let it learn again – wouldn't that solve hallucination and timeliness issues?

This is very intuitive from an engineering standpoint, but in practice, it's a huge disaster.

An LLM's knowledge is stored in the form of digital weights, distributed uniformly and vaguely across billions or tens of billions of parameters, like salt dissolved in water. This brings two fatal technical limitations:

  1. Catastrophic Forgetting: When you forcefully feed 100,000 of your company's private financial statements into an already-formed model for fine-tuning, the model drastically modifies its underlying neural connections to memorize these new coordinates. The result: it might finally remember your company's reports, but when you ask it [What's 1+1?] or [How to write a leave request?], it might become a zombie spouting nonsense – it has “washed away” the general language ability and common sense it previously worked so hard to learn.
  2. Lossy Compression and “High-IQ Illiteracy”: Fine-tuning is meant to change the model's “skin (output format, speaking tone, instruction compliance),” not its “bones and flesh (hard factual knowledge).” Knowledge fed through fine-tuning, after the neural network's lossy compression, still leads to hallucinations with slight probability deviations during continuation. It might remember your company has a product called “System A,” but it could probably fabricate “System B”'s features onto System A.
Industry consensus:
- Use Fine-tuning to change the model's behavior, tone, obedience, or teach it specific output formats. -

Use RAG (Retrieval-Augmented Generation, i.e., open-book exam) to provide the model with the latest, most accurate hard facts and private data that cannot tolerate any lossy compression.

Treating fine-tuning as a hard drive to store new knowledge is like expecting a college student to memorize a medical dictionary and then immediately perform surgery – both inefficient and dangerous. This is also why, in current engineering practice, RAG and Agent have become mainstream for deployment, while fine-tuning has stepped back, specifically used for “alignment” and “pruning” of the model's various capabilities.

Key technical details:

10. Giving LLMs Eyes and Ears

We've been repeatedly emphasizing: LLMs are “text continuation” machines. All their superpowers are built on giving them a piece of text and having them spit out the next word based on probability.

But when you open the latest [Doubao] and casually take a photo of a dense code screen or a complex circuit board logic diagram, throw it at the model and ask: “Which line of code in here is wrong?” – it can instantly pinpoint among a sea of pixels and point out the error in text.

Don't LLMs only recognize text? How can they recognize images, even audio and video?

Behind this, the LLM hasn't changed its brain. Rather, engineers have installed a “translator” in front of the LLM.

10.1 The Game of Chopping Up Images for Continuation

Since LLMs only eat Tokens, we force images to also masquerade as Tokens.

When you upload a screenshot of code in the chat and ask “how to fix it,” the entire backend process is a “sleight of hand”:

  1. Patching: The vision processing program, before the LLM even sees the image, uses an invisible knife to chop the image into a bunch of 16×16 pixel “small tiles.” If it's a large image, it might be chopped into hundreds of small tiles.
  2. Vision Encoder: These small tiles are sent to a model specifically for understanding images (like CLIP's vision part). This translator doesn't write text – it only does one thing: translates the visual features of each image tile into a long string of digital coordinates (vectors).
  3. Projection: Here's the crucial step. Engineers use a mathematical method to forcefully map the “image coordinates” output by the visual translator into the LLM's original “vocabulary space.” For example, it adjusts the numbers from the image tile containing the giant panda's ear to be very close to Tokens like “animal” and “fluffy” in the LLM's perception. Technically, these translated image tile coordinates are called Visual Tokens.
  4. Big Platter Continuation: The history ledger ultimately presented to the LLM is concatenated like this: [System Prompt] + [Image Tile Token 1] + [Image Tile Token 2] +...+ [Image Tile Token 100] + [User Question: What's in this image?]

To the LLM, it doesn't see any colorful picture. In its “eyes,” those 100 image tiles are 100 “special words it has never seen before.” But because during massive pre-training, it has countless times seen the pattern that “[special characters with dark circles] often appear next to the word [giant panda].”

So it fires up its only trick – text continuation – and naturally spits out: “The image shows a giant panda eating bamboo.”

10.2 When LLMs Meet Robots

You immediately think: Since LLMs can “see” images by adding a “visual translator,” conversely, can we make them directly control a real-world robot or robotic arm through “text continuation”?

The answer is: absolutely yes, and this is exactly the field of Embodied AI.

Traditional robot control requires complex mathematical formulas to calculate joint angles, torque, and Cartesian coordinates for robotic arms. But what if we treat the robotic arm's actions as a kind of “language”?

In cutting-edge embodied AI engineering practice, engineers have done something very radical: they've encoded various robot actions – like “gripper open,” “gripper close,” “move left 5 cm” – into special codes in the vocabulary (usually called Action Tokens).

When you input to an LLM connected to a robotic arm: [Help me pick up the red block on the table.]

  1. The LLM uses the camera (visual Tokens) to see the tabletop layout.
  2. It starts frantically continuing in its underlying brain, but this time it doesn't continue in Chinese like “I'll go grab it.” Instead, it continues with a string of special symbols only the robotic arm can understand: <ROBOT_MOVE_X_0.05> <ROBOT_MOVE_Y_-0.02> <ROBOT_GRIPPER_CLOSE>.
  3. The robot's underlying controller (like ROS 2) intercepts this continued secret code, converts it into electrical current and pulses, directly driving the Franka robotic arm's motors to accurately pick up the red block.

This transforms the originally tedious mechanical control problem into a pure, cross-modal “advanced text continuation” game.

10.3 The Pain Points of This Crossover

But there's no free lunch. This approach of forcefully turning everything into Tokens and stuffing them into the LLM brings extremely heavy engineering costs:

To solve these visual and physical control failures, the industry is currently moving comprehensively from early “assembled multimodal (independent training then forced concatenation)” toward “native multimodal (from day one of pre-training, let the model simultaneously eat text, images, and action data).”

Key technical details:

11. The Assembly Pipeline for LLM Applications

In previous chapters, we've learned how to make LLMs work like workhorses performing various simple tasks.

But if you're asked to write an enterprise-level system, you'll find that just writing “glue code” to stick these parts together can exhaust you. That's when the LLM engineering world evolved specialized “assembly pipeline frameworks.”

11.1 LangChain's Benefits and Loss of Control

The earliest behemoth to appear was LangChain. Its core idea was to encapsulate common patterns in LLM application development into standard “Lego bricks.” It wrapped APIs from different vendors into unified shells and turned RAG steps into an automated conveyor belt. In the early days, it did allow beginners to assemble a chatbot in just a few lines of code.

But when people brought LangChain into serious production environments, the nightmare began:

11.2 The Rise of PydanticAI

Then PydanticAI emerged. It borrowed design philosophies from modern backend development (like FastAPI) and proposed two weapons against the uncontrollability of LLMs:

  1. Type Safety: Programmers strictly define output structures in code (e.g., user ID must be an integer, risk level must be a fixed enum). If the LLM outputs incorrectly, the framework intercepts the validation error behind the scenes without crashing.
  2. Dependency Injection: Completely eliminates global variables. Each user request gets an independent, isolated “external resource toolkit” (e.g., dedicated database connection), thoroughly solving data cross-contamination bugs under high concurrency.

12. LLM Memory Systems

An LLM is a stateless text continuation machine. We discussed earlier that multi-turn dialogue relies on the backend frantically stacking “history ledgers.” But if a user chats with AI for three days straight, or logs in again next month, this ledger will not only burst the LLM's context but also drive compute costs to bankruptcy.

To give Agents long-term memory similar to humans, engineering has installed a layered “permanent backpack”:

12.1 The Symphony of Short-term and Long-term Memory

12.2 Entity Memory

More advanced memory is the entity relationship graph. As AI communicates with you, it secretly draws a network about you in its backpack: [User] -- likes --> [Black Coffee], [User] -- profession --> [Software Development].

This memory is no longer fragmented text snippets but structured state, making the LLM feel like an old friend every time it interacts with you.

13. AI Skills Package

We've given LLMs “hands and feet” (Tool Call), letting them check weather and modify files. But imagine, in a large enterprise, there are thousands of internal microservice APIs (check finances, approve leave requests, search employees, modify permissions…).

If we cram all the “instruction manuals” for these thousands of tools into the LLM before every conversation, two things happen: First, the context explodes immediately, getting more expensive the more you chat. Second, the LLM, facing thousands of choices, becomes deeply confused and starts randomly calling tools.

Thus, the Dynamic Skills system emerged. It turns tool usage into a “two-stage retrieval”:

  1. Skills bundle encapsulation: Engineers group similar tools into highly decoupled, plug-and-play “Skills Bundles.”
  2. On-demand credential retrieval: When the user inputs “Help me reimburse last month's travel expenses,” the system's “page turner” jumps ahead, uses vector retrieval in the skills library, and only grabs the 3 tool instruction manuals related to “finance, reimbursement.”
  3. Dynamic feeding: The LLM can only see these 3 tools in this interaction. This reduces the “choose from thousands” problem into a “choose from three” multiple-choice question, not only saving massive Token costs but also skyrocketing Agent call accuracy.

14. The Ultimate Efficiency of LLMs

When we've used PydanticAI to set the standards, Memory to give it memory, and Skills to give it unlimited capabilities, this Agent (single workhorse) becomes theoretically omnipotent.

Now we have an extremely ambitious idea: Can I create an omniscient and omnipotent “Super Single Agent”? I'll stuff all the company's rules and regulations, customer service scripts, Python programming standards, and financial reimbursement processes into its prompt, letting it handle all the company's dirty work single-handedly.

In engineering practice, if you actually do this, the LLM will slap you awake with reality. As you cram more and more prompts and hundreds of tools into this single Agent, it quickly falls into “deep confusion” – not only does response speed slow down, but it also frequently suffers from identity “schizophrenia.”

To solve this “mediocrity caused by omnicompetence,” there are two complete decouplings in the LLM world. One happens inside the LLM (the physical structure evolution of the model), and the other happens in our business code (the sociological separation at the application layer). These are often confused, but for beginners, distinguishing them is crucial.

14.1 The Self-Decoupling at the Model Level

First, we must peel back the physical shell of LLMs and see how their underlying hardware and compute power are squeezed out. In today's market, the underlying structure of LLMs mainly falls into two camps.

1. Dense Models

Early classic models (like early Llama series, or various small standalone models with tens of billions of parameters) are almost all “dense models.”

2. Mixture of Experts Models

To break through the physical limits of dense models, today's hottest top-tier LLMs (like the famous DeepSeek-V4 or GPT-5 series) have almost all switched to MoE architecture.

14.2 Sociological Decoupling at the Application Layer

After hearing about the hardware situation, you might think: “Since MoE models like DeepSeek are already this smart and cheap, if I write all my company's business logic into the prompt and let it handle everything alone, it should work, right?”

Sorry, it still fails. Because the underlying MoE can only solve “whether text continuation is fast and compute-efficient,” it cannot solve the logical chaos that occurs when humans write complex business systems.

Suppose you want to build a “fully automated R&D expense reimbursement audit assistant.” If you make it a single Agent, you'd have to write tens of thousands of characters in its System Prompt:

"You need to be both a warm and friendly customer service representative guiding users to upload invoices, AND a strict rigorous code auditor checking users' code for security vulnerabilities, AND a stingy accountant checking the company's MySQL database to see if department budgets are exceeded..."

When the LLM sees this massive chunk of prompt, its attention mechanism gets completely confused. When the user inputs: “Help me check if the code for this login interface is done, and also reimburse the 5000 yuan overspent last week due to fixing this bug.” This single Agent immediately falls into identity schizophrenia: it might evaluate your code in the extremely stingy tone of an accountant saying it's not cost-effective, or while checking the database, it casually treats a minus sign in the code as the reimbursement amount. This is “dementia caused by omnicompetence.”

When human society faces complex tasks, it never relies on a lone hero but on departmental collaboration. When LLMs are deployed in business, they must also move toward Multi-Agent systems. The core is: completely dismantle a complex all-powerful Agent into a “virtual office” composed of multiple specialized AIs.

Let's use the failure case above to see how a modern multi-agent system (e.g., built on LangGraph or PydanticAI Graph) flows smoothly behind the scenes:

  1. Application Router: It's the administrative front desk of the office. It doesn't have any hardcore professional skills. Its system prompt is extremely simple: “You are only responsible for understanding the user's needs and then breaking down and distributing tasks.” When it sees the user's complex request, it snaps twice and splits it into two work orders.
  2. Security Auditor (Agent A): The front desk throws the first work order to Agent A, the security auditor. This Agent's prompt is extremely pure: “You are a strict code security expert.” It only carries one Skills tool – read local code file. It focuses 100% attention on the code and quickly produces a rigorous security audit report.
  3. Accountant (Agent B): The front desk throws the second work order to Agent B, the accountant. Its prompt: “You are a shrewd accountant.” It doesn't look at any code, only carrying one advanced dependency injection – read-only connection to company financial database. It quickly queries last week's R&D department financial flow and produces the exact overspend amount.
  4. State Machine Merge: After the two experts finish their work in their respective unidirectional tracks (state machines), they throw their standard, type-safe Pydantic reports back to the front desk. The front desk manager neatly combines “code security” and “overspend amount” and presents them tidily to the user.

In this application-layer decoupling process, the LLM doesn't need to play both judge and god of wealth in the same context. Each sub-Agent's Prompt is extremely clean, carrying only two or three tool skills. Tool call accuracy directly skyrockets from 40% for the single Agent to over 95%.

中文版