Theoretically Optimal Attention/FFN Ratios in Disaggregated LLM Serving
This paper presents an analytical framework and a closed-form provisioning rule to determine the theoretically optimal Attention-to-FFN resource ratio in disaggregated LLM serving, accounting for stochastic workload dynamics and synchronization overheads to minimize device idle time and step-level blocking.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are running a massive, high-speed factory that produces "thoughts" (tokens) for a giant AI brain. This factory has two main assembly lines working together to finish each thought:
- The Memory Line (Attention): This team is like a librarian. They have to run back and forth to a giant, growing bookshelf (the KV cache) to find specific pages for every request. As the bookshelf gets bigger, this team gets slower and slower because they have to carry heavier loads. They are memory-bound.
- The Calculation Line (FFN): This team is like a super-fast calculator. They don't need to look at the bookshelf; they just crunch numbers based on what the librarians hand them. They are compute-bound and can work incredibly fast if they have enough work to do.
The Problem: The "Mismatched Dance"
In the old days, these two teams were stuck in the same room. If the librarians were slow, the calculators had to sit idle, waiting for them. If the calculators were fast, the librarians were the bottleneck.
To fix this, engineers invented a new layout called AFD (Attention-FFN Disaggregation). They moved the librarians and calculators into separate rooms. Now, you can have many librarian teams feeding into one giant calculator room.
But here's the catch: How many librarian teams do you need for one calculator room?
- Too few librarians? The calculator sits idle, starving for data.
- Too many librarians? The calculator gets overwhelmed, and the librarians have to stand around waiting for the calculator to catch up.
Finding the perfect ratio (let's call it r) is like trying to find the perfect number of waiters for a single chef. If you guess wrong, the whole factory slows down.
The Paper's Solution: A "Crystal Ball" for Factory Managers
The authors of this paper realized that guessing the ratio is hard because the work is random.
- Some customers have short questions; others have long stories.
- Some requests finish quickly; others take a long time.
- The "bookshelf" (memory) grows differently for every request.
Because of this randomness, you can't just use a simple math formula based on averages. You need a way to predict the chaos.
Their "Secret Sauce" is a new mathematical framework that does three things:
- It measures the "Average Chaos": They developed a way to look at past request logs (traces) and calculate a single number (called θ) that represents the true average workload, accounting for the fact that longer requests are more likely to be seen at any random moment.
- It accounts for the "Slowest Runner": In this factory, all librarian teams must finish their work before the calculator can start. If one team gets stuck with a huge book, the whole line waits. The authors created a formula to predict how much extra time is lost because of these "stragglers" (the slowest workers).
- It gives a "Golden Ratio" Recipe: Using these two insights, they derived a simple, closed-form rule. You plug in your hardware specs and your request logs, and the formula tells you the exact number of librarian teams you need for your calculator room to run at maximum speed.
The Results: "It Works!"
The team built a digital simulator (a virtual factory) to test their theory.
- They tried different numbers of librarian teams (from 1 to 32).
- They compared their "Golden Ratio" prediction against the actual best performance found by the simulator.
- The Verdict: Their prediction was incredibly accurate, matching the real-world simulation within 10%.
They also found that as you add more librarian teams, the "waiting time" caused by the slowest team does increase, but their formula accounts for this, ensuring you don't add too many teams and waste money.
The Takeaway
This paper provides a scientific rulebook for building these split-AI factories. Instead of guessing or trial-and-error, system designers can now use this math to figure out exactly how to balance their memory and computing resources, ensuring the AI runs as fast and efficiently as possible, even when the workload is unpredictable.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.