This website uses cookies

Read our Privacy policy and Terms of use for more information.

THEWHITEBOX
How Agents are Shaping AI, Part 1: Software

Right now, AI is experiencing two large changes that are better explained together.

  1. Software is trying to look more like hardware

  2. Hardware is trying to look more like what software needs

This may read as obvious, but it’s not. For years, software ignored hardware issues and worked around them, and hardware is, still to this day, largely suboptimal for AI inference.

But with AI already representing the largest investment relative to GDP in US history, we need to make sure this all makes sense, and we all make some money. And agents are our best bet.

In this two-part series, my job is to answer the following:

❝

To the best of my ability, can I describe what AI models and chips will most likely look like three years from now?

If I did my job, today you’ll learn key intuitions about how models work, how they learn, and what state-of-the-art AI research looks like, because this is the first architecture built with one thing and one thing only in mind: agents.

The First “Mixture-of-Everything” Model

DeepSeek’s new model is like nothing we’ve ever seen. It has so much that I simply call it a ‘mixture-of-everything’. It brings back a decade-old idea, mixes it with new ideas, and creates an incredible model that is not only fascinating but genuinely good.

It’s all really in the name of improving two things:

  1. Reducing the agent bottleneck

  2. Reducing the memory bottleneck

And although I’m sure you know what the memory bottleneck is (we’ll review it nonetheless), what on Earth is the agent bottleneck?

Let’s find out.

Strong… and Weird

Getting the obvious out of the way. The model is good, very good.

Not as good as the best models on the planet, Fable and Astra from Anthropic and OpenAI, respectively, but close (it is as good as its predecessors), and most importantly: insultingly cheaper.

Source: DeepSeek

The pricing for this model is simply absurd.

Source: DeepSeek

Naturally, these are Chinese API prices, which I’m afraid I do not recommend using. However, DeepSeek models are free to download, so you can use them on Western servers no problem.

But how cheap is this compared to frontier labs?

The simple answer is that even at peak hours, the blended price of DeepSeek models at $0.75/million is 20 times smaller than what you pay for Opus 5, a model of comparative performance.

❝

We’ll revisit this question later once we have a better idea of why this model is so transformational, so that I can explain that the price difference is actually much larger.

Good, nice, and cheap.

I bet you don’t find this surprising in the slightest, as you probably know that capabilities become commoditized in a matter of months.

But I didn’t spend a full day reading such a complex paper and writing such a complex article just to tell you that AIs are getting cheaper per unit of intelligence.

What matters here is how they did it. DeepSeek’s new architecture is by far the most complex I’ve ever covered, so to truly grasp what they are doing here, we need to think in first principles.

LLMs are autoregressive. But why does that matter?

You probably know this by now, so I’ll keep it short and sweet: large language models like Claude or Gemini are next-token predictors, with a token being something like a word in text or a patch of pixels in images.

They take a sequence of tokens and predict what comes next. Then the model appends that next token, and the process repeats.

This approach seems obvious with text, since humans write or speak that way, but it also applies to other modalities like images.

Yes, when you ask ChatGPT to generate an image, what happens is mostly what you see in the image below on the left, with the right process being diffusion, which is also common but doesn't favor interleaved reasoning, so it’s used far less.

Source: Author

This means that every prediction, every new thing, depends on what came earlier. This matters because it lets us build a cache and avoid much redundant computation.

Because models look backward all the time, much of the work needed to predict the last token is redundant. Consequently, instead of recomputing that work we already did, we store it in memory and retrieve it when needed.

This is called the KV Cache, and it’s both a blessing and a curse.

  • It’s a blessing because it helps keep prediction time roughly constant. That’s why you see the model’s response speed stay roughly the same when you’re interacting with ChatGPT.

  • It’s a curse because it skyrockets our need for memory capacity.

You can think of the KV Cache as the AI’s ‘working memory’ for that particular sequence. In fact, if you store that cache and a new identical user request comes in, you can use that cache to serve that user, avoiding a tremendous amount of computation, a concept known as ‘prompt caching.’

For example, if you send your LLM the sequence “The sky is…,” the model first processes those first three tokens because they are new to it, generating the KV Cache in a process called ‘prefilling’ and producing the first output token: “blue.” For the remaining predicted tokens, the model can then rely on the working memory to generate the next ones with much less information.

The simplest way I understand the KV cache and the idea of ‘prefilling’ is as working on a math problem. You first read the entire problem, making sure you understand it all, and then you can start working on it.

The following predictions (i.e., you working through the problem) don’t need you to reread the entire problem again and again at every step; you already have it in your “working memory” and can use that “model of the problem” you have in your mind to work on the problem without having to read it again.

In their own particular way, that is how LLMs work!

KV caching is just necessary and unavoidable, but it creates major hardware-level problems. One small example pretty much explains it all.

If you send a model like GLM-5.3 a one-million-token sequence, which looks like a lot, but it isn’t these days, considering agents are voraciously pushing sequence lengths higher, that sequence alone requires a KV Cache of 88 GB.

Just that one sequence for a single user.

A state-of-the-art GPU like a Rubin VR200 has 288 GB of memory, so that sequence alone represents 30% of your ~$100k chip’s memory capacity. Once you factor in the model itself, which is TB in size for most top models, and the fact that you aren’t going to make a profit if you only serve one user at a time, one can easily understand why we need millions of chips packed into racks and why we need a gagillion bits of memory to serve the world’s demand for AI.

❝

Seeing all this, one realizes that this nerdy-named concept known as a KV Cache is one of the main driving forces, if not the biggest, behind the multiple-trillion capital expansion Big Tech companies are undergoing.

So it's urgent to find ways to reduce its size without hurting performance too much.

But can’t we simply make it smaller without a clear strategy? No. The KV Cache is the model’s working memory for that sequence, so the smaller you make it, the worse the model’s ability to recall certain facts, and it can even develop “amnesia” and forget stuff it once knew.

Cutting the model’s KV Cache is literally like forcing a human to forget stuff that may be useful.

Thus, it’s a trade-off: KV Cache size is one of AI engineering’s biggest problems, but it's also instrumental to performance.

❝

Knowing this, it’s no surprise that reducing the KV Cache is, without a doubt, the main problem we aim to solve with sparse mechanisms that Chinese Labs have made a staple of.

But no company on planet Earth is taking these approaches as far as DeepSeek. Nobody is making larger strides on this problem than they are.

Most people see DeepSeek as almost mystical; it’s the lab every US official mildly associated with AI knows by name. This is probably mostly marketing, but today you’ll see why the mystique is warranted.

So, without further ado, let’s dive in.

An architecture with one thing in mind: agents

The best way to understand what DeepSeek is doing here is to see it as an architecture that cuts KV cache size while also benefiting agentic workloads in an extremely innovative way.

Let’s focus on the former first.

Reducing the working memory without killing performance

Earlier on, I mentioned that models always “look backward.” But what do we mean by ‘looking’?

I like to describe Transformers, the architecture used by all major labs, as “knowledge gatherers.” They do two types of operations: attention and MLP, where one looks for information at the sequence level by making words “talk” to each other, and the other is the model’s “long-term memory.”

❝

Don't confuse the MLP layers with the KV cache, which is the model’s “working memory” for the task/sequence at hand. The MLP layers are the model’s actual memory, what it has learned after making the model all of humanity’s written word.

Regarding attention, by "talk," I mean each word looks back at previous words and decides which ones are worth attending to. Transformers are really hard to grasp with words alone, so let me use an example with a visualization, which I hope will make it clearer.

For example, say we have the sentence “The Black Pearl sank”.

  • With attention, ‘pearl’ looks back at ‘black’ and realizes that ‘black’ is an adjective describing it, making it a more complex concept, such as ‘black pearl’.

  • With the MLP layers, the model can retrieve information from its knowledge to enrich its understanding. As ‘Black’ and ‘Pearl’ are capitalized, paired with the clue attention picks up about a ‘sinking pearl’, the model realizes it’s talking about a boat named ‘Black Pearl’, eventually realizing it’s the ship from Pirates of the Caribbean.

The visualization below is, of course, a simplification, but it conveys what I want you to understand about how Transformer LLMs work: they use both the context provided by the sequence and the model’s own experience and knowledge to process the sequence and make the next prediction.

Naturally, as sequence-level information is so valuable, in an ideal world, even if the sequence has a million words, you would want every word to look back at all previous words.

For example, if we’re reading a book and an adjective describing a certain mysterious character appears in chapter two (e.g., ‘spooky’), and the character is eventually presented in chapter 16, if we’re discussing the book with an AI and ask it, “How is this character described in this book?”, unless the model has the full context, it can’t answer correctly because the contents of chapter 2 have long been forgotten.

❝

This describes the clear tension: an enormously taxing cache that can recall everything, and a cheaper-to-run one that is smaller but lossy. If you cut a model’s ability to remember the past (i.e., if you compress the cache), you unequivocally cut its ability to remember.

Usually, US Labs, much richer in terms of compute and capital, are less concerned about the cost-effectiveness of deploymen’t apply the trade-off at all. However, Chinese labs have diametrically opposite incentives; for them, achieving the best possible “intelligence” per cost matters most, which leads them to the obvious culprit: the cache.

First compression: compressed window attention

One of the first trade-offs DeepSeek makes isn't an innovation of theirs at all: sliding-window attention, which is better understood as prioritizing the present. But they do pair this with a type of attention of their own creation: compressed sparse attention.

As mentioned, the first isn't new; it was first proposed almost six years ago. Almost table stakes these days, it’s a way for every word to have “full attention”, but only to the tokens in its window.

But what does that mean?

Especially with text: when you know what word comes next, the most recent tokens are usually the most important. For example, while an adjective can refer to something that appeared earlier in a passage, adjectives usually refer to nearby nouns. This ‘recency bias’ is incredibly common in natural language.

So, when prioritizing which tokens matter most for the next prediction, it’s natural to focus on the most recent ones. This idea is what we call sliding-window attention, where each word can only attend to the last ‘m’ tokens.

For example, looking at the example below, with a window size of 3, the word ‘the’ can only attend to the last three tokens, “sat”, “on”, and itself, “the”, but not to “cat”. In other words, the word can only enrich its context with the most recent tokens.

Seeing this, it’s easy to see where the problem arises; the model basically develops “amnesia”, a complete inability to recall the past. So, although these layers are very popular these days, they're almost always combined with “global attention” layers that let the model look way back.

Simply put, most of the model’s computation is “local”, meaning tokens can only attend to nearby tokens, but every once in a while the model does look at the entire context to prevent itself from “losing the plot.” Usually, these global attention layers ensure good recall; if the model needs an older fact or data point, you give it the chance to see it.

Think of the book example. If chapter 16 starts talking about events that happened indirectly in chapter 2, the model won’t be able to “see” them without global attention layers.

So, in the current status quo, we essentially have four choices AI researchers can make when designing a model:

  • Full attention: The model has access to the entire context, but it’s the most expensive model to serve because context grows with sequence length, which is getting huge.

  • Full SWA: The cheapest option by far. However, it’s also the worst for performance because SWA has deep recency bias. You have full access to what happened recently but no access to the rest. The model develops deep amnesia fast. For that reason, this option is never used alone.

  • A third option is to combine both. You rely mostly on SWA, but add “reviews of the past”. The model may still forget things that happened in the past, as it can look back but less consistently, but at least it has full visibility.

  • A fourth option is to combine perfect recent recall with SWA and compressed summaries of the past, the most aggressive compression. The model no longer has access to everything that happened; it has full access to the recent past but only summaries of the older past.

So what is DeepSeek doing? It’s one of them, but with a fascinating twist.

logo

Subscribe to Full Premium package to read the rest.

Become a paying subscriber of Full Premium package to get access to this post and other subscriber-only content.

Upgrade

A subscription gets you:

  • NO ADS
  • An additional insights email on Tuesdays
  • Gain access to TheWhiteBox's knowledge base to access four times more content than the free version on markets, cutting-edge research, company deep dives, AI engineering tips, & more