Structured Memory for Edge Language Models: Persistent Context and Corpus Retrieval via O(1) SSM State Injection
This paper introduces PRECOG and SMC, a retrieval-augmented generation system for State-Space Models that pre-encodes document corpora into fixed-size hidden states to achieve context injection, enabling interactive edge language models with massive speedups over traditional Transformer-based RAG.
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 trying to teach a super-smart robot to answer questions by feeding it a massive library of books. In the world of artificial intelligence, the most popular way to do this is like handing the robot a stack of papers and saying, "Read every single word of these papers before you answer my question." This works, but it's slow. If the stack is huge, the robot has to spend a long time just reading the context before it can even say "Hello." Furthermore, the robot has to remember every single word it just read, which takes up a lot of memory, like trying to hold a whole encyclopedia in your head while you talk.
Scientists have been looking for a way to make this process faster and lighter, especially for robots that live on small devices like phones or smart appliances, where memory is tight and speed is everything. They are exploring a different kind of brain architecture called a "State-Space Model" (SSM). Think of an SSM not as a robot that reads a book page-by-page and memorizes every word, but as a robot that reads a book and then instantly compresses the entire story into a single, tiny, magical summary card. This card holds the meaning of what was read, but not the words themselves, and it doesn't matter where in the book the story happened. The big question researchers are asking is: Can we use this "summary card" trick to skip the slow reading part entirely? If we can, we could make AI that answers questions instantly, even on tiny devices, without needing a massive computer in the cloud.
This paper introduces a clever new trick called PRECOG (which stands for Pre-Computed Context Injection) that says "Yes, we can." The authors, working with a specific type of AI model called TENNs-LLM, figured out how to take a chunk of text, run it through the AI once to create that tiny "summary card" (a hidden state), and save it. Later, when a user asks a question, instead of making the AI re-read the text, the system simply pulls out the saved summary card and drops it directly into the AI's brain. It's like skipping the reading part of a test and just handing the student the prepared notes they already studied.
The results are mind-blowing for speed. On the specific edge hardware the team tested, the old way of "reading" the context took about 27 seconds just to get the first answer. With PRECOG, that time dropped to less than 6 milliseconds. That is a speed-up of roughly 4,500 times, turning a process that was unusable into one that feels instant and interactive. The paper proves mathematically that this shortcut doesn't make the AI "dumb"; the answers are just as good as if it had read the text word-for-word, because the way this specific type of AI works allows the summary card to be a perfect replacement for the text.
The paper also introduces a second feature called SMC (Structured Memory Consolidation). If PRECOG is about remembering a library of books, SMC is about remembering a person's life. It organizes the AI's long-term memories (like your preferences or past conversations) into different "folders" or clusters, like "Emotions," "Facts," or "Locations." It can then instantly load the right folder into the AI's brain when you start a conversation, so the AI remembers who you are and what you like without you having to remind it every time. This whole system is designed to work on small, low-power devices, making it possible to have a super-smart, memory-rich AI assistant right in your pocket.
The authors are very confident in their math. They proved that for this specific type of AI, the "summary card" method is not an approximation or a guess; it is mathematically identical to reading the text. However, they also point out that this trick only works for this specific type of AI architecture. The more common AI models (called Transformers) are built differently; they get tangled up in the order of words, so you can't just swap in a summary card for them. For those models, you still have to read the text every time. But for the future of small, fast, edge-based AI, this paper suggests a path where we can have powerful memory without the heavy baggage of slow reading.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.