Run this model with HF Jobs

Run ModalityDance/slpo-codi-gpt2 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/ModalityDance/slpo-codi-gpt2. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/ModalityDance/slpo-codi-gpt2 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/ModalityDance/slpo-codi-gpt2. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/ModalityDance/slpo-codi-gpt2. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
How to use from
Docker Model Runner
docker model run hf.co/ModalityDance/slpo-codi-gpt2
Quick Links

CODI + SLPO (GPT-2)

Surrogate Latent Policy Optimization (SLPO) checkpoint on top of CODI (GPT-2 124M). This is the CODI+SLPO model reported in the paper SLPO: Scaling Latent Reasoning via a Surrogate Policy.

Model Details

  • Backbone: CODI / GPT-2 (ModalityDance/latent-tts-codi)
  • Method: stopping-gate cold start → SLPO (RLOO) with adaptive latent stopping
  • Special tokens: <|latent|>, <|start-latent|>, <|end-latent|>
  • Recommended gate threshold: 0.7
  • Max latent length: 12

Results (paper main table, Acc)

Deterministic accuracy with dropout disabled and learned stop gate:

Benchmark Acc Mean latent length
GSM8K 42.76 11.83
GSM-Hard 9.71 11.94
MultiArith 90.52 11.44

Related

Installation

git clone https://github.com/ModalityDance/SLPO.git
cd SLPO
pip install -r requirements.txt   # plus a CUDA PyTorch build
hf download ModalityDance/slpo-codi-gpt2 --local-dir checkpoints/slpo-codi-gpt2

Quick Start

Batched eval (paper Acc settings):

CKPT=checkpoints/slpo-codi-gpt2 \
MODEL_TYPE=codi STOP_POLICY=gate \
STOP_GATE_THRESHOLD=0.7 MAX_LATENT_LENGTH=12 \
DATA=data/gsm_test.json \
bash scripts/eval.sh

Minimal Python (from the repo root; needs the SLPO latent generation stack):

import torch
from transformers import AutoTokenizer

from src.models.generation import LatentGenerationMixin, LatentGenerationConfig
from src.paths import get_model_class

model_id = "ModalityDance/slpo-codi-gpt2"
backbone_cls = get_model_class("codi")

class LatentModel(backbone_cls, LatentGenerationMixin):
    pass

tokenizer = AutoTokenizer.from_pretrained(model_id)
if tokenizer.pad_token is None:
    tokenizer.pad_token = tokenizer.eos_token

model = LatentModel.from_pretrained(model_id)
model.eval()

question = (
    "Janet's ducks lay 16 eggs per day. She eats three for breakfast every morning "
    "and bakes muffins for her friends every day with four. She sells the remainder "
    "at the farmers' market daily for $2 per fresh duck egg. "
    "How much in dollars does she make every day at the farmers' market?"
)
prompt = question + "<|start-latent|>"
inputs = tokenizer(prompt, return_tensors="pt")

gen_cfg = LatentGenerationConfig(
    stop_policy="gate",
    max_latent_length=12,
    stop_gate_threshold=0.7,
    max_new_tokens=128,
    pad_token_id=tokenizer.pad_token_id,
    eos_token_id=tokenizer.eos_token_id,
    bos_token_id=tokenizer.bos_token_id,
)

with torch.no_grad():
    output = model.generate(**inputs, generation_config=gen_cfg)
sequences = output.sequences if hasattr(output, "sequences") else output
print(tokenizer.decode(sequences[0], skip_special_tokens=True))

Citation

@misc{you2026slpo,
  title   = {SLPO: Scaling Latent Reasoning via a Surrogate Policy},
  author  = {You, Runyang and Liu, Zhiyuan and Li, Yongqi and Li, Wenjie},
  year    = {2026},
  eprint  = {2607.19691},
  archivePrefix = {arXiv},
  primaryClass = {cs.CL},
  url     = {https://arxiv.org/abs/2607.19691}
}
Downloads last month
104
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for ModalityDance/slpo-codi-gpt2

Finetuned
(1)
this model

Collection including ModalityDance/slpo-codi-gpt2

Paper for ModalityDance/slpo-codi-gpt2