← All research

Contrastive Language Models

Contrastive learning · 2026

How does an agent choose between possible actions? Explore CLM’s learned state–action matching, follow a scoring calculation, and understand a reproduced DeepSWE selection result.

Contrastive-LM project · Public documentation

TRY THIS
  • Lower temperature: the distribution sharpens while the best candidate stays the same.
  • Add a similarly scored option: probability mass is shared among alternatives.
  • Make all scores negative: a winner still exists even when every candidate may be unsuitable.

START WITH THE IDEA

The idea in brief.

CLM learns to match a situation with possible actions. It encodes the state and candidates, applies separate learned projection heads, and scores how well they align. Explore the calculation with visible example scores, then see what the published agent-solution selection benchmark measures.

Typed-answer path

  1. State and candidate representations
  2. Scaled similarities → distribution
  3. Typed answer → application policy

DeepSWE selection path

  1. Published per-step embeddings + tuned head
  2. Average final 12 step cosine scores
  3. Choose the highest-scoring trajectory
Two uses of CLM scoring. The typed API normalizes scores across options; the DeepSWE evaluator averages step cosine scores. The browser exercise illustrates the first path with authored numbers.

THE SIGNIFICANCE

Why it matters.

01

Make the candidate choice explicit

A supplied action set makes the decision inspectable. CLM’s state and action representations can be computed separately, allowing repeated candidates to reuse embeddings. The encoder still does real work for fresh text.

Original architecture and caching ↗
02

A reproduced selection result

Hopper matched 31/38 (81.579%) on the published held-out DeepSWE tasks with the released tuned head, four-candidate budget and final-12-step scoring. Uniform random selection has 73.684% expected success; the available-candidate oracle reaches 89.474%. These are selection results on existing trajectories.

Hopper reproduction receipt and task selections ↗
03

Know what was reproduced

We used the unchanged evaluator’s CPU fallback and published embeddings. The documented evaluation URL was unavailable, so we used the older evaluation dataset explicitly linked by the authors. Its bytes could not be compared with the inaccessible canonical dataset. We did not regenerate solutions, retrain the head, measure GPU speed or establish MLX parity.

Dataset provenance and scope ↗