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…

这是什么?这是“Context Language Models(CLM,上下文语言模型)”研究的官方代码发布,研究来自华盛顿大学、Meta Superintelligence Labs、MIT 和 Trillium Labs。CLM 是一种以原生方式管理自身上下文的语言模型——它把上下文当作一个可以自由编辑的文件,这种做法自然延伸到多智能体场景,每个智能体的上下文就是它自己的文件。
这是一个做好的工具,还是用于复现论文实验的研究代码?它是伴随 CLM 论文发布的研究代码,不是打磨好的产品:仓库包含基于 Harbor 的实现(clmharness、clmicl、clmrl)外加一个后缀缓存复用(suffix-cache-reuse)服务组件,用于运行和复现论文实验。
怎么运行一个 CLM?使用 clm-harbor CLI 并带上“-a clm-minimal”标志,在任意 Harbor 任务上运行最小 CLM 智能体;配置和服务细节记录在 clm/clmharness 中。
用这个需要 Harbor 框架吗?需要,CLM 构建在 Harbor 之上,要通过 clm-harbor CLI 调用,不能独立运行。
论文里的东西这里都齐了吗?还不齐:用于评估 CLM 的基准测试 ContextBench 仍标注为“即将推出”,还没有包含在仓库里。
可以商用吗?不可以,该项目以 CC BY-NC 4.0 发布,只允许研究和非商业用途。
CLM 比标准的上下文管理方法好多少?在零样本测试中,CLM 在 BrowseComp-Plus 上准确率高 11.4% 且 FLOPs 少 21.5%,在 12 小时的 EdgeBench 上得分高 5% 且 FLOPs 少 59%,在计算量相同的情况下,24 小时多仓库智能体集群任务的改进幅度高出 65%。
能不重新训练模型就调整 CLM 的行为吗?能,clm/clmicl 表明 CLM 可以用经过技能优化循环演化出来的自然语言指令来引导,在一个上下文管理任务上把留出集准确率提升最多 35.9 个百分点,同时耗用更少的算力。
仓库里有针对 CLM 的强化学习方法吗?有,clm/clmrl 实现了一种在线强化学习方法,让 Qwen3.5-9B 在 BrowseComp-Plus 上的性能提升 47.6%,同时 FLOPs 减少 12%。
suffixcachereuse 是干什么用的?它是一个通过复用后缀缓存来高效服务 CLM 的组件,目标是降低在生产环境中运行 CLM 的算力成本。
Size
1.6 MB
Stars
736
Updated
CommitOct 14
Age
1mo
Commits · 90 Days