Views
No views yet
[0, 1]; the orchestrator
buzzes the moment confidence ≥ θ. It is an LFM2.5-1.2B backbone + a linear regression head
(not a text generator) — fast enough to score every incoming character (~9 ms/char).YUGOROU/quiz-main-gemma-merged| File | Role |
|---|---|
model.safetensors, config.json | LFM2.5-1.2B backbone (Lfm2Model, no LM head) |
buzz_head.pt | Regression head: Linear(hidden_size → 1) on the last token's hidden state → sigmoid → confidence |
tokenizer.json, chat_template.jinja | tokenizer + the exact prompt template used at train time |
1import torch, torch.nn as nn
2from huggingface_hub import hf_hub_download
3from transformers import AutoModel, AutoTokenizer
4
5repo = "YUGOROU/quiz-buzz-reg-1.2bjp-merged"
6tok = AutoTokenizer.from_pretrained(repo)
7backbone = AutoModel.from_pretrained(repo, torch_dtype=torch.bfloat16).eval()
8
9head = nn.Linear(backbone.config.hidden_size, 1)
10head.load_state_dict(torch.load(hf_hub_download(repo, "buzz_head.pt"), map_location="cpu"))
11head.eval()
12
13def confidence(prefix: str) -> float:
14 msgs = [{"role": "user", "content": f"問題文({len(prefix)}文字目まで):\n{prefix}"}]
15 ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt")
16 h = backbone(ids).last_hidden_state[:, -1] # last-token hidden state
17 return torch.sigmoid(head(h)).item()
18
19# buzz when confidence(prefix) >= theta (theta is the accuracy/speed knob; higher = later = safer)serve/serve_buzz.py) is in the GitHub repo.LiquidAI/LFM2.5-1.2B, full fine-tune (standard LoRA under-covers LFM2's MLPs), soft-BCE
regression head trained on S-buzz confidence labels (corpus built from AI王 / JAQKET).