Context Language Models
88 points by emersonmacro 8 hours ago | 19 comments

gavinray 53 minutes ago

  > We implement this by treating the context as a file and allowing the model to make unrestricted updates to this file. 
What an incredibly novel and unprecedented idea!
reply
vatsachak 18 minutes ago
Eventually the CLM will be a separate model co-trained with the actual model right?

And there will be multiple contexts like hot vs cold pages in DBs.

Speaking of which I am predicting a "Context as a DB" paper within one year

reply
bob1029 4 hours ago
I would be concerned with context management consuming limited attention resources.

Do you want your agent solving its own memory crisis, or do you want it solving the actual task? It can probably do both at the same time, but I suspect there is a non trivial cost associated with this.

A separate hypervisor agent that manages the main agent's context would be much better in my experience. You can run it on a different schedule and the main agent has to spend zero tokens thinking about it. This also makes it a lot easier to control when caches will be missed.

reply
alightsoul 4 hours ago
Maybe have A second model do the management?
reply
theroadnotbacon 4 hours ago
Looks like they tested that in the paper, and the code allows for it as well. https://github.com/facebookresearch/context-language-models/... Of course, this is for suggesting context management strategies rather than the actual management afaict.
reply
alightsoul 4 hours ago
Yeah maybe a second model can do the actual management
reply
vatsachak 35 minutes ago
Yeah, that would be the canonical solution. Modularity is better
reply
svachalek 5 hours ago
Wow. Context management is one of the big remaining hassles with modern LLMs so this could be big. The obvious complication is cache busting so it's also exciting they investigated solutions for that.
reply
Bolwin 4 hours ago
The biggest discovery might actually be that they ignored regular caching rules and kept invalid cache suffixes and it didn't hurt performance
reply
TeMPOraL 2 hours ago
I wonder how bad the performance would be if they plain ignored the whole rotary encoding dance and just back-filled precisely the parts of the cache that changed directly. Would it break the model? Confuse the model? Or would the model internally correct for it?
reply
visarga 4 hours ago
Can't we do this trick today with any model? Just send the file as next context. Of course you pay the price for cache misses, depending how deep you make changes, while CLM just ignores the recomputation.
reply
nsingh2 4 hours ago
One approximation of this is the experimental context management Codex has been moving towards (not released yet). Rather than relying on summary compaction, the model maintains notes as it works and as it approaches the context limit. A new session is just a fresh context with those notes attached, and a pointer back to the previous session.

Not exactly like what this paper is suggesting, but similar in the sense it lets the model decide what and how to persist across turns.

I recreated this in Pi, with a max token limit on how long the note can be, to pressure the model to be concise. Ends up being cheaper than summary compaction too.

reply
TeMPOraL 2 hours ago
Interesting. It matches my manual workflow with all harnesses (including vanilla web ChatGPT/Gemini/Claude) for the past year or so: when the session gets compacted, or (ideally) when I feel it's about to be, I just tell it to write a handover note, and start a new session.

With some specific workflow I use in some cases (involving leaving long-lived intermediary artifacts), this turned into me pasting a path to handover file in previous agent's session, and handover itself directs the agent to key files from that session to read, and that's it. So far, with this process, at no point I felt any quality degradation (though early on I often see "I need to check how my predecessor did ${something}", followed by surgical spelunking of past chat's history), even as I carry a single piece of complex analytical work over 5+ sessions.

reply
visarga 4 hours ago
That is similar to what I am thinking... not just edit the context as a file or string, but have a way to evict blocks and replace them with summary notes and also be able to retrieve them on demand.

Do you have a public repo for your approach?

reply
nsingh2 4 hours ago
No public repo but it's not too difficult to point a LLM at the general idea. Since Codex is open source, you can even take a look at how they do it. Here is what the model is instructed to do in codex (look at "guidance_message"): https://github.com/openai/codex/blob/d91294c39edb93d204926b3...
reply
ijidak 4 hours ago
Memento
reply
plastic-enjoyer 2 hours ago
> We implement this by treating the context as a file and allowing the model to make unrestricted updates to this file. This allows the model to learn what is most important to maintain in context, and naturally extends to multi-agent systems where multiple agent contexts coexist as files.

So, is this like RAM, just for an LLM? Do we have to reinvent MMUs for LLMs and all the abstractions that come along with it?

reply
aghuang 3 hours ago
Looks great!
reply
gitghxst 3 hours ago
that's interesting!
reply