context-language-models README

The project's README from github.com/facebookresearch/context-language-models. As one markdown file: README.md.

Context Language Models (CLMs)

Rulin Shao1,2, Shannon Zejiang Shen3, Junjie Oscar Yin1,2, Yuetai Li1, Minheng Wang1, Hamish Ivison1, Radha Poovendran1, Nathan Lambert4, Teng Xiao1, Mike Lewis2, Wen-tau Yih2, Luke Zettlemoyer1,2, Pang Wei Koh1

1University of Washington   2Meta Superintelligence Labs   3MIT   4Trillium Labs

arXiv Twitter

Context Language Models

We introduce Context Language Models (CLMs), language models that natively manage their own context. 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.

Day 1 Support

CLM for Pi:

pi install npm:@lolipopshock/pi-clm

Getting started

Run the minimal CLM agent on any Harbor task:

pip install -e .
clm-harbor run -p <harbor-task> -a clm-minimal -m openai/<model> \
  --agent-kwarg api_base=http://localhost:8000/v1

clm-harbor is the Harbor CLI with CLM available as -a clm-minimal. See clm/clm_harness for configuration and serving.

Repository

clm/clm_harness CLMs implemented in Harbor
clm/clm_icl In-context learning for CLMs
clm/clm_rl Reinforcement learning for CLMs
suffix_cache_reuse Suffix Cache Reuse for CLM efficient serving

Coming soon

Citation

If you find our work helpful, we would appreciate it if you could cite our paper:

@article{shao2026context,
  title   = {Context Language Models},
  author  = {Shao, Rulin and Shen, Shannon Zejiang and Yin, Junjie Oscar and Li, Yuetai and
             Wang, Minheng and Ivison, Hamish and Poovendran, Radha and Lambert, Nathan and
             Xiao, Teng and Lewis, Mike and Yih, Wen-tau and Zettlemoyer, Luke and Koh, Pang Wei},
  journal = {arXiv preprint arXiv:2609.37725},
  year    = {2026}
}

License

This project is licensed under CC BY-NC 4.0. See also NOTICE.

context-language-models (facebookresearch/context-language-models)

Searching Database…

What is this?This is the official code release for 'Context Language Models (CLMs)', research from University of Washington, Meta Superintelligence Labs, MIT and Trillium Labs. CLMs are language models that natively manage their own context by treating it as a file they can freely edit, which naturally extends to multi-agent setups where each agent's context is its own file.
Is this a finished tool or research code for reproducing the paper's experiments?It's research code accompanying the CLM paper, not a polished product: the repo ships Harbor-based implementations (clmharness, clmicl, clmrl) plus a suffix-cache-reuse serving component, meant for running and reproducing the paper's experiments.
How do I run a CLM?Run the minimal CLM agent on any Harbor task using the clm-harbor CLI with the '-a clm-minimal' flag; configuration and serving details are documented in clm/clmharness.
Do I need the Harbor framework to use this?Yes, CLMs are built on top of Harbor and are invoked through the clm-harbor CLI rather than run standalone.
Is everything from the paper already available here?Not entirely: ContextBench, the benchmark referenced for evaluating CLMs, is still listed as 'coming soon' and isn't included in the repo yet.
Can I use this commercially?No, the project is released under CC BY-NC 4.0, which allows research and non-commercial use only.
How much better are CLMs than standard context-management approaches?In zero-shot tests, CLMs reach 11.4% higher accuracy with 21.5% fewer FLOPs on BrowseComp-Plus, 5% higher scores with 59% fewer FLOPs on 12-hour EdgeBench, and a 65% greater improvement at equal compute on a 24-hour multi-repository agent-swarm task.
Can CLM behavior be tuned without retraining the model?Yes, clm/clmicl shows CLMs can be steered with natural-language instructions evolved through a skill-optimization loop, improving held-out accuracy by up to 35.9 points on a context-management task while using less compute.
Does the repo include a reinforcement learning method for CLMs?Yes, clm/clmrl implements an online RL method that improved Qwen3.5-9B's performance on BrowseComp-Plus by 47.6% while using 12% fewer FLOPs.
What is suffixcachereuse for?It's a component for efficiently serving CLMs by reusing suffix caches, aimed at reducing the compute cost of running CLMs in production-like settings.
Size
1.6 MB
Stars
732
Updated
CommitOct 14
Age
1mo
Commits · 90 Days