Fragment
Fragment is an open, from-scratch System-One decision model. You give it a state (any text) and typed questions; it returns typed answers with calibrated probabilities in a single forward pass. It never generates text, so there is nothing to parse and nothing to hallucinate.
This is v1.1 — a continuation-training round on top of the original release: 2 more supervised epochs with score-type oversampling, a second RLCD pass (sharper exploration anneal, stronger ordinal penalty), and an isotonic confidence calibration layer. Same architecture, same tokenizer, better decisions.
Fragment was built from zero in a CPU sandbox: its own BPE tokenizer, its own transformer encoder, its own decision head, and its own RLCD training loop — no pretrained weights anywhere.
Quickstart
The repo ships a self-contained runtime — fragment.py (needs only torch +
safetensors):
model.safetensors fp32 weights
fragment.py python runtime: Fragment.from_pretrained() + decide()
fragment_config.json architecture, temperatures, isotonic calibration knots
tokenizer.json BPE vocab + merges (trained from scratch)
pip install fragment-ai # or clone the repo
from fragment import Fragment
m = Fragment.from_pretrained("FrameXlabs/Fragment")
state = "Hi, we were billed twice for March. Please refund the duplicate today."
questions = {
"urgency": {
"type": "score",
"instructions": "How urgent is this request?",
"criteria": ["not urgent", "soon", "critical or blocking"],
},
"refund": {
"type": "noul",
"instructions": "Does the user explicitly request a refund?",
},
}
res = m.decide(state, questions)
print(res["answers"]["refund"]) # typed yes/no with calibrated probability
print(res["answers"]["urgency"]) # expected score + full level distribution
Architecture
| Type | System-One typed-decision model (non-autoregressive) |
| Encoder | 6 bidirectional transformer blocks, d=192, 4 heads, learned positions |
| Decision head | +1 refinement block, qtype embedding, per-option marker readout |
| Params | 4,944,260 (4.9M) |
| Context | 192 tokens |
| Tokenizer | fragment-bpe-v1 — byte-pair encoding trained from scratch, 8192 vocab |
| Question types | choice · score · noul (yes/no) |
| Calibration | per-qtype temperature + isotonic confidence remap + proper scoring rule training |
Sequence format (marker tokens let the model score every option in one pass):
[CLS] <type> question: <instructions> [SEP] <opt0> <opt1> ... [SEP] <state> [SEP]
Training: RLCD (two rounds)
Fragment is trained with RLCD — Reinforcement Learning for Calibrated Decisions — against strictly proper scoring rules, so reporting honest probabilities is the only way to maximise reward:
Round 1 (v1.0):
- MLM pretraining — masked-language modeling on 208k sequences (tied LM head), 11.6k steps
- Warmup — supervised soft cross-entropy on typed targets + answerability head (2 epochs over 51k items from SST-2, AG News, Yelp-5)
- RLCD — GRPO-style logit-noise policy gradient; reward = log score + 0.75·spherical score − RPS on ordinal
scorequestions; σ annealed 0.45 → 0.12 - Calibration — per-question-type temperature scaling on held-out validation
Round 2 (v1.1, this release):
- Warmup² — 2 more supervised epochs at lower LR (2.5e-4 encoder / 8e-4 head), with the weakest question type (
score) oversampled ×1.3 - RLCD² — second policy-gradient pass; exploration σ annealed 0.28 -> 0.08; RPS weight raised to 1.4 for sharper ordinal decisions
- Calibration² — per-qtype temperature (fine grid) + isotonic confidence remap (pool-adjacent-violators) fitted on held-out validation; the remap travels inside
fragment_config.jsonascalibrationknots
Reward function (strictly proper — truth is the unique maximiser):
r(q, y) = Σ y·log q + 0.75 · Σ y·q / ‖q‖ − 1[ordinal] · RPS(q, y)
Evaluation (held-out test, 2340 items — never trained on)
v1.1 results
| Question type | n | answerable accuracy | ECE |
|---|---|---|---|
| choice | 773 | 0.696 | 0.077 |
| score | 798 | 0.401 | 0.097 |
| noul | 769 | 0.653 | 0.147 |
Overall: accuracy 0.613, ECE 0.100.
v1.0 → v1.1 (answerable accuracy)
| choice | 0.464 | 0.696 | +0.231 | | score | 0.327 | 0.401 | +0.074 | | noul | 0.589 | 0.653 | +0.064 | | overall | 0.515 | 0.613 | +0.098 | | overall ECE | 0.435 | 0.100 | -0.336 (lower is better) |
The act head flags unanswerable state/question pairs instead of guessing.
Calibration knots per question type: {k: len(v) for k, v in cal.items()}.
Data
Public datasets: SST-2 (sentiment), AG News (topics), Yelp Review Full (5-level ratings) — converted into typed decisions with instruction templates and option-order shuffling to prevent position bias.
License
Apache-2.0. Trained and released by FrameXlabs.