Views
No views yet
ModalityDance/latent-tts-codi)<|latent|>, <|start-latent|>, <|end-latent|>0.712| Benchmark | Acc | Mean latent length |
|---|---|---|
| GSM8K | 42.76 | 11.83 |
| GSM-Hard | 9.71 | 11.94 |
| MultiArith | 90.52 | 11.44 |
1git clone https://github.com/ModalityDance/SLPO.git
2cd SLPO
3pip install -r requirements.txt # plus a CUDA PyTorch build
4hf download ModalityDance/slpo-codi-gpt2 --local-dir checkpoints/slpo-codi-gpt21CKPT=checkpoints/slpo-codi-gpt2 \
2MODEL_TYPE=codi STOP_POLICY=gate \
3STOP_GATE_THRESHOLD=0.7 MAX_LATENT_LENGTH=12 \
4DATA=data/gsm_test.json \
5bash scripts/eval.sh1import torch
2from transformers import AutoTokenizer
3
4from src.models.generation import LatentGenerationMixin, LatentGenerationConfig
5from src.paths import get_model_class
6
7model_id = "ModalityDance/slpo-codi-gpt2"
8backbone_cls = get_model_class("codi")
9
10class LatentModel(backbone_cls, LatentGenerationMixin):
11 pass
12
13tokenizer = AutoTokenizer.from_pretrained(model_id)
14if tokenizer.pad_token is None:
15 tokenizer.pad_token = tokenizer.eos_token
16
17model = LatentModel.from_pretrained(model_id)
18model.eval()
19
20question = (
21 "Janet's ducks lay 16 eggs per day. She eats three for breakfast every morning "
22 "and bakes muffins for her friends every day with four. She sells the remainder "
23 "at the farmers' market daily for $2 per fresh duck egg. "
24 "How much in dollars does she make every day at the farmers' market?"
25)
26prompt = question + "<|start-latent|>"
27inputs = tokenizer(prompt, return_tensors="pt")
28
29gen_cfg = LatentGenerationConfig(
30 stop_policy="gate",
31 max_latent_length=12,
32 stop_gate_threshold=0.7,
33 max_new_tokens=128,
34 pad_token_id=tokenizer.pad_token_id,
35 eos_token_id=tokenizer.eos_token_id,
36 bos_token_id=tokenizer.bos_token_id,
37)
38
39with torch.no_grad():
40 output = model.generate(**inputs, generation_config=gen_cfg)
41sequences = output.sequences if hasattr(output, "sequences") else output
42print(tokenizer.decode(sequences[0], skip_special_tokens=True))1@misc{you2026slpo,
2 title = {SLPO: Scaling Latent Reasoning via a Surrogate Policy},
3 author = {You, Runyang and Liu, Zhiyuan and Li, Yongqi and Li, Wenjie},
4 year = {2026},
5 eprint = {2607.19691},
6 archivePrefix = {arXiv},
7 primaryClass = {cs.CL},
8 url = {https://arxiv.org/abs/2607.19691}
9}