Contrastive-LM / CLM
git clone https://github.com/Contrastive-LM/CLM.git
Contrastive Language Models (CLMs) are a new class of System One model trained with a contrastive learning objective that connects states and actions.
+3
stars, 24h · #4,028
+~21
stars, 7 days · #4,837
+3.1k
stars, 30 days · #178
3.1k
★ total · +1% this week
268
forks · 30 open issues
Star history (as recorded here)
LanguagePython
LicenseApache-2.0
Created2026-09-23 (28d ago)
Last push16d ago
Watchers22
OwnerOrganization
Links
README excerpt
Contrastive Language Models A System One Model for Fast and Generalizable Decision-Making | 📄 Blog | 🗣️ Discord | 🤗 Data & Models | 📚 API Reference | 🛠️ Fine-Tuning Tutorial | 🔥 **Contrastive Language Models (CLMs)** are a new class of **System One model** trained with a **contrastive learning** objective that connects **states and actions**. This repo serves **CLM-8B** behind a TypeSafe-compatible API. - **CLM-8B** is pre-trained on **60M Nemotron Q&A pairs**, mid-trained on **30M synthetic hard negatives**, and post-trained on **1M agentic trajectories**. - It performs on par with **Jev** across computer-use, gaming and tool-calling tasks with up to **9× lower latency**. With lightweight fine-tuning it sets a new SOTA as a verifier on agentic coding benchmarks: **Terminal-Bench 2.1 (87.6%)** and **DeepSWE (81.6%)**. - **States and actions are disaggregated**, so their embeddings are cached and reused independently, which makes training and serving cheap and blazing fast! We invite the community to plug it into their own agents and benchmarks! --- ## Installation [code] To install the latest from a clone: [code] --- ## Quickstart ### Serve [code] States longer than 2048 tokens are truncated. For longer states, raise both limits together, e.g. `--max-model-len 8192` on `vllm serve` and `clm-serve --max-tokens 8192` (needs more GPU memory). ### Ask typed questions about a state [code] Questions may be `Noul` / `Choice` / `Score` objects or plain wire-format dicts, so a request written for TypeSafe replays as `client.system_one(state, questions)`. ### Rank candidates directly `system_one` is built on one primitive: score a candidate against a state. For free-form candidates (best-of-N answers, tool names, next moves) use the in-process engine's `rank`: [code] --- ## Playground `clm-serve` also serves a web UI at `/` (`http://localhost:8700/` by default). Write a state, add typed questions, and see CLM's answer distributions; every request is also shown as JSON, `curl` and Python. A **Rank** tab ranks any candidate set, and links are shareable. Captured against a real clm-serve ( clm-latest , Qwen3-8B encoder on one RTX 4090). Remote server? `ssh -L 8700:localhost:8700 `. API only: `clm-serve --no-ui`. --- ## Results ### Zero-shot evaluation Across **computer-use, gaming and tool-calling tasks**, CLM-8B performs on par with Jev while running **up to 9× faster**. The speedups are largest when the number of candidate actions is large (WikiRacing) or when actions are reused across states (the T-Rex game). The T-Rex benchmark ships in this repo: see examples/t_rex. ### Agentic benchmarks: CLM as a verifier For each task we sample several candidate solutions (**Opus 5** for DeepSWE, **Fable 5** for Terminal-Bench 2.1), and CLM or Jev acts as the verifier that picks the best one. Evaluated on **38 held-out DeepSWE tasks** and **30 held-out Terminal-Bench 2.1 tasks**; latency on an H100. Jev fails to serve as a verifier for these long-h