Views
No views yet
facebook/opt-125m backbone (AutoModel, fp32) + masked-mean pooling over
the prompt tokens + a Linear(768 → 1) scoring head.| Base | facebook/opt-125m |
| Loss | ListMLE (listwise), list size 16 |
| Epochs | 10 (resumed 5→10, continuous curve), seed 0 |
| Data | LMSYS-Chat-1M prompt → output-length lists |
| ListMLE loss | 25.67 → 23.04 → 19.98 → 18.02 → 16.22 → 15.01 → 13.84 → 12.92 → 12.51 → 11.67 |
| Ranking quality | Kendall τ ≈ 0.71 on a held-out LMSYS split (score vs true length) |
nvmmonkey/llama31-8b-output-lengths (LMSYS prompts withheld per license).modeling_opt_ranker.py):1import torch, importlib.util
2from huggingface_hub import snapshot_download
3from safetensors.torch import load_file
4from transformers import AutoTokenizer
5
6repo = snapshot_download("<your-hf-user>/opt125m-ltr-ranker")
7
8spec = importlib.util.spec_from_file_location("m", f"{repo}/modeling_opt_ranker.py")
9m = importlib.util.module_from_spec(spec); spec.loader.exec_module(m)
10
11ranker = m.build_ranker("facebook/opt-125m") # OPT backbone + linear score head
12ranker.load_state_dict(load_file(f"{repo}/model.safetensors"))
13ranker.eval()
14
15tok = AutoTokenizer.from_pretrained(repo)
16enc = tok(["Explain quantum computing in one sentence.",
17 "Write a 2000-word essay on the French Revolution."],
18 return_tensors="pt", padding=True, truncation=True, max_length=512)
19
20with torch.no_grad():
21 scores = ranker(enc.input_ids, enc.attention_mask) # higher => shorter output => schedule first
22print(scores) # the short prompt should score higher than the long onepriority from the score (see the code repo's
ltr/scheduler/priority.py and serving/serve_b1_ltr.sh, launched with
--scheduling-policy priority).facebook/opt-125m is under the OPT license (research / non-commercial); this
fine-tune inherits it.github.com/hao-ai-lab/vllm-ltr