← 목록

CLM: A Decision Model Trained with Contrastive Learning, Not Another Chat Model

devto 2026-10-08 원문 보기 ↗


The model race today is mostly about generation: longer context, prettier answers, stronger reasoning.

But if you actually run agents, the thing that bites you usually isn't "generates poorly" — it's "decides too slowly."

Every step an agent takes requires choosing the next action. If that choice also runs the full token-by-token generation pipeline, both latency and cost climb — a single "which button" can burn hundreds of tokens.

CLM (Contrastive Language Models, 2913 stars, Apache-2.0, Python) attacks it from a different angle: pull decision-making out and train a model dedicated to it. Its one-liner: a System One model trained with a contrastive objective that connects states and actions directly.

How it differs from a normal LLM

A normal LLM is generative: given a state, it writes the action token by token.

CLM is contrastive: what it learns isn't "how to write," but "which action fits this state better" — scoring state–action pairs directly.

The practical payoffs:

It ships CLM-8B behind a TypeSafe-compatible API (the de-facto interface for this class of decision models), plus a fine-tuning tutorial and models/data on Hugging Face.

Three signals it's worth watching

The honest caveat

It's a decision component, not a general assistant. CLM only answers "which of these candidates" — it doesn't chat or generate content. You pair it with a main model (the repo uses Qwen3-8B as the encoder) that provides understanding and representation, while CLM scores and ranks fast.

It's also very new (weeks old at scale), and the dependency chain is non-trivial: vLLM serving an encoder + the CLM service + a client. Expect real setup friction.

I've localized the README to Chinese and added a "中文快速上手" (Chinese quick-start) section on top — what it actually solves, the shortest path to running it, environment requirements, and common pitfalls — so you don't have to read the whole English doc first: https://github.com/yangshun2005/CLM-cn

If you find this project useful, a star on the original repo supports the author's ongoing maintenance.