Lever: Speculative LLM Inference on Smartphones
This paper presents Lever, an end-to-end system that optimizes speculative decoding across drafting, verification, and execution stages to enable efficient, low-latency large language model inference on smartphones by leveraging flash storage and mobile hardware constraints.
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
The Big Problem: The "Heavy Suitcase" on a "Bicycle"
Imagine you want to ride a bicycle (your smartphone) across a country. You have a very heavy, high-quality suitcase (a powerful Large Language Model or LLM) that contains all the knowledge you need.
- The Problem: The bicycle has a tiny basket (the phone's fast memory, or DRAM). It can't hold the whole suitcase.
- The Current Workaround: You have to keep the suitcase in the trunk (the phone's slow flash storage). Every time you need to take a step (generate a word), you have to stop, open the trunk, pull out the specific page you need, read it, and put it back. This "stop-and-go" is incredibly slow. It's like trying to ride a bike while constantly stopping to dig through a trunk.
The Idea: "Guessing" to Save Time
The paper introduces a system called Lever. It uses a trick called Speculative Decoding.
Think of it like a Guessing Game:
- The Small Assistant (Draft Model): You have a small, fast assistant sitting in the bike's basket (in the fast memory). This assistant is good at guessing what comes next.
- The Big Boss (Target Model): The heavy suitcase in the trunk is the "Big Boss." It is very smart but slow to access.
- The Strategy: Instead of asking the Big Boss for one word at a time, the Small Assistant quickly guesses a whole sentence (or a tree of possible sentences). Then, you only open the trunk once to ask the Big Boss: "Did I get these guesses right?"
If the Big Boss says, "Yes, the first three words are correct," you get three words for the price of one trip to the trunk. This saves a massive amount of time.
The Three Hurdles (and How Lever Solves Them)
The authors realized that while this "guessing" idea works great on powerful servers, it fails on phones for three specific reasons. Here is how Lever fixes them:
1. The "Tree Size" Dilemma (Drafting)
- The Problem: If the Small Assistant guesses too few words, you still have to open the trunk too often. If it guesses too many, the phone's brain gets overwhelmed trying to check all those guesses, and it slows down.
- The Lever Solution: Lever acts like a smart gardener. It doesn't just grow a random bush of guesses. It carefully calculates: "Is this branch of guesses worth the effort?" It only grows branches that are likely to be accepted and won't cost too much energy to check. It builds a "perfectly sized" tree of guesses that balances speed and accuracy.
2. The "Wasted Effort" Problem (Verification)
- The Problem: Even with a good tree, the Big Boss might have to check a branch that turns out to be wrong. On a phone, checking a wrong branch is a waste of precious battery and time.
- The Lever Solution: Lever installs a traffic cop (a lightweight predictor) halfway through the Big Boss's thinking process. Before the Big Boss finishes reading the whole sentence, the traffic cop looks at the clues and says, "Hey, this branch looks wrong; stop checking it!" This saves the phone from doing unnecessary work, but it's careful enough to never throw away a correct answer.
3. The "Tool Mismatch" Problem (Execution)
- The Problem: Smartphones have different types of "brains" (CPUs and NPUs). The NPU is great at doing math for many things at once, but it hates doing weird, irregular tasks. Guessing games are often irregular.
- The Lever Solution: Lever acts like a smart project manager. It knows when to use the fast NPU and when to use the flexible CPU.
- It groups similar guesses together so the NPU can work on them efficiently (like a factory assembly line).
- It saves the final "decision making" (figuring out which word to actually pick) for the CPU, so the NPU doesn't waste energy calculating answers for paths that will never be used.
The Results
The paper tested Lever on real smartphones (like the OnePlus 12) with various AI models.
- Compared to the old way (opening the trunk for every single word): Lever is 2.93 times faster.
- Compared to other guessing methods designed for servers: Lever is 1.50 times faster.
The Bottom Line
Lever is a system that lets your phone run huge, smart AI models without freezing up. It does this by using a small, fast "guessing" model to do the heavy lifting, while carefully managing the slow, heavy "checking" model so it doesn't waste time or battery. It turns a slow, stop-and-go process into a smooth, efficient ride.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.