| ๐ Blog | ๐ป Code | ๐ฃ๏ธ Discord |
Contrastive Language Model (CLM) is a new class of System One model trained with a contrastive learning objective that connects states and actions. CLM-8B consists of two small projection heads (a state head and an action head) on top of a frozen Qwen3-8B encoder trained with a bidirectional InfoNCE loss.
clm packagegit clone https://github.com/Contrastive-LM/CLM.git && cd CLM
pip install -r requirements.txt
# 1. encoder: Qwen3-8B, last-token pooling
vllm serve Qwen/Qwen3-8B --served-model-name qwen3-8b --runner pooling \
--enable-prefix-caching --max-model-len 2048 --gpu-memory-utilization 0.35 --port 8090
# 2. API + playground at http://localhost:8700/ (fetches CLM_v0.1-8B.pt into ~/.cache/clm/)
clm-serve --port 8700 --emb-url http://127.0.0.1:8090/v1/embeddings
Ask typed questions about a state:
from clm import CLMClient, Choice, Noul, Score
client = CLMClient() # http://127.0.0.1:8700 by default
r = client.system_one(
state="Customer: my invoice was charged twice and nobody answers the phone!",
questions={
"urgency": Noul(instructions="Is this urgent?"),
"department": Choice(instructions="Which team should handle this?",
criteria={"billing": "Charges, invoices, refunds",
"technical": "Bugs and outages"}),
"frustration": Score(instructions="How frustrated is the customer?",
criteria=["Calm", "Frustrated", "Very angry"]),
},
)
print(r.answers["department"].choice) # billing
print(r.answers["department"].probabilities) # {'billing': 0.93878, 'technical': 0.06122}
Or rank free-form candidates (best-of-N solutions, tool names, next moves):
from clm import Engine
engine = Engine(emb_url="http://127.0.0.1:8090/v1/embeddings")
engine.rank("What causes tides on Earth?",
["The Moon's gravitational pull.", "Photosynthesis in plants.", "Because the Earth is round."])
# [{'rank': 1, 'candidate': "The Moon's gravitational pull.", 'prob': 0.993}, ...]
Only the heads are trained, so fine-tuning is cheap. This checkpoint is the starting point for the DeepSWE and Terminal-Bench heads.
hf download Contrastive-LM/CLM-v0.1-8B CLM_v0.1-8B.pt --local-dir ckpts
python train/finetune.py --task clm --hf-dataset Contrastive-LM/deepswe-clm-train-embeddings-8k \
--init-ckpt ckpts/CLM_v0.1-8B.pt --out-dir runs/deepswe \
--holdout-tasks heads/deepswe/heldout_tasks.json --batch 512 --seed 1234
See the fine-tuning guide.
clm-serve also serves a web playground at http://localhost:8700/.
@misc{kwok2026contrastivelanguagemodels,
title={Contrastive Language Models: A System One Model for Fast and Generalizable Decision-Making},
author={Jacky Kwok and Hangoo Kang and Tarun Suresh and Jon Saad-Falcon and Marco Pavone and Christopher Rรฉ and Azalia Mirhoseini},
year={2026},
note={Notion Blog},
url={https://contrastive-lm.notion.site}
}
The CLM-8B weights are released under the Apache 2.0 License. The base encoder Qwen3-8B is also Apache 2.0.
12 commits
| ๐ Blog | ๐ป Code | ๐ฃ๏ธ Discord |
Contrastive Language Model (CLM) is a new class of System One model trained with a contrastive learning objective that connects states and actions. CLM-8B consists of two small projection heads (a state head and an action head) on top of a frozen Qwen3-8B encoder trained with a bidirectional InfoNCE loss.
clm packagegit clone https://github.com/Contrastive-LM/CLM.git && cd CLM
pip install -r requirements.txt
# 1. encoder: Qwen3-8B, last-token pooling
vllm serve Qwen/Qwen3-8B --served-model-name qwen3-8b --runner pooling \
--enable-prefix-caching --max-model-len 2048 --gpu-memory-utilization 0.35 --port 8090
# 2. API + playground at http://localhost:8700/ (fetches CLM_v0.1-8B.pt into ~/.cache/clm/)
clm-serve --port 8700 --emb-url http://127.0.0.1:8090/v1/embeddings
Ask typed questions about a state:
from clm import CLMClient, Choice, Noul, Score
client = CLMClient() # http://127.0.0.1:8700 by default
r = client.system_one(
state="Customer: my invoice was charged twice and nobody answers the phone!",
questions={
"urgency": Noul(instructions="Is this urgent?"),
"department": Choice(instructions="Which team should handle this?",
criteria={"billing": "Charges, invoices, refunds",
"technical": "Bugs and outages"}),
"frustration": Score(instructions="How frustrated is the customer?",
criteria=["Calm", "Frustrated", "Very angry"]),
},
)
print(r.answers["department"].choice) # billing
print(r.answers["department"].probabilities) # {'billing': 0.93878, 'technical': 0.06122}
Or rank free-form candidates (best-of-N solutions, tool names, next moves):
from clm import Engine
engine = Engine(emb_url="http://127.0.0.1:8090/v1/embeddings")
engine.rank("What causes tides on Earth?",
["The Moon's gravitational pull.", "Photosynthesis in plants.", "Because the Earth is round."])
# [{'rank': 1, 'candidate': "The Moon's gravitational pull.", 'prob': 0.993}, ...]
Only the heads are trained, so fine-tuning is cheap. This checkpoint is the starting point for the DeepSWE and Terminal-Bench heads.
hf download Contrastive-LM/CLM-v0.1-8B CLM_v0.1-8B.pt --local-dir ckpts
python train/finetune.py --task clm --hf-dataset Contrastive-LM/deepswe-clm-train-embeddings-8k \
--init-ckpt ckpts/CLM_v0.1-8B.pt --out-dir runs/deepswe \
--holdout-tasks heads/deepswe/heldout_tasks.json --batch 512 --seed 1234
See the fine-tuning guide.
clm-serve also serves a web playground at http://localhost:8700/.
@misc{kwok2026contrastivelanguagemodels,
title={Contrastive Language Models: A System One Model for Fast and Generalizable Decision-Making},
author={Jacky Kwok and Hangoo Kang and Tarun Suresh and Jon Saad-Falcon and Marco Pavone and Christopher Rรฉ and Azalia Mirhoseini},
year={2026},
note={Notion Blog},
url={https://contrastive-lm.notion.site}
}
The CLM-8B weights are released under the Apache 2.0 License. The base encoder Qwen3-8B is also Apache 2.0.
12 commits