RockAndEgg-313M-v3
A compact, non-generative decision model for efficient structured decision-making over a shared contextual state.
RockAndEgg reads a state — a deployment log, a support ticket, an invoice, a workflow trace — and answers typed questions about it. It returns a probability distribution and a confidence value per question. It does not generate text.
Its engineering proposition is reuse. A request can carry several questions about one state, and the state is encoded once; every question and every candidate option is scored against that single cached representation. The backbone runs a fixed number of times regardless of how many questions share the state.
Highlights
- 313,161,733 parameters — 312,892,928 backbone + 268,805 decision head.
- Headless Qwen3-derived backbone — 10 decoder blocks,
Qwen3Model, no LM head. - No autoregressive generation — no vocabulary projection at inference, no sampler, no generation loop.
- Three native decision primitives —
choice,score,noul. - Shared-state KV-cache reuse — one state encode per request, independent of question and option count.
- Batched candidate scoring — options are isolated in batch rows and scored in one pass.
- 10 MiB KV cache at S=256 in FP16 (20 MiB at S=512).
- 313M-class footprint — 626,323,466 bytes of raw FP16 parameter storage (313,161,733 × 2 B); the serialized
model.safetensorsis 626,337,154 bytes including its header.
Quantized variant
A qualified mixed-precision INT8 variant is available at
moeshawky/RockAndEgg-313M-v3-INT8:
quantized backbone projections (W8A16, group size 128) with FP16 embeddings and
decision head, ~24.5% smaller, decision quality statistically indistinguishable
from this FP16 release on the canonical panel. See that repository's model card
for methodology, benchmark results, and deployment limitations.
Model specifications
| Field | Value |
|---|---|
| Parameters | 313,161,733 (backbone 312,892,928 + head 268,805) |
| Backbone | Qwen3-derived, 10 decoder blocks, Qwen3Model (no LM head) |
| Hidden size | 1024 |
| Intermediate size | 3072 |
| Attention | 16 query heads / 8 KV heads (GQA 2:1), head_dim 128, full attention |
| Positional | RoPE, rope_theta 1,000,000, max_position_embeddings 32,768 |
| Vocabulary | 151,936, tied embeddings |
| Normalization | RMSNorm, rms_norm_eps 1e-6 |
| Decision head | query-type embedding (3) + 1024→256→1 scorer + per-type temperature |
| Decision primitives | choice, score, noul |
| State token limit | 256 |
| Option token limit | 64 |
| Output | per-question probability vector + confidence (max probability) |
| Weight precision | FP16 (all 122 tensors) |
| Raw parameter storage | 626,323,466 bytes (313,161,733 × 2 B, FP16) |
| Serialized checkpoint | 626,337,154 bytes (model.safetensors, includes header) |
| License | Apache-2.0 |
| Runtime | torch, transformers, safetensors; HTTP server additionally needs fastapi, uvicorn |
The 256/64 token budgets are the qualified configuration. They are set explicitly
in the adapter (max_state_len=256, max_option_len=64); the Transformers
defaults are larger and are not the qualified operating point.
Architecture
flowchart LR
A["State text"] --> B["Backbone prefill<br/>(one pass)"]
B --> C["DynamicCache<br/>shared KV"]
C --> D["Option rows<br/>(cache forked, not re-encoded)"]
D --> E["Decision head<br/>qtype + scorer"]
E --> F["Typed distribution<br/>per question"]
The mechanism, in order:
- Encode the state once. A single forward pass produces the backbone's
DynamicCache. - Fork the cache, not the text.
batch_repeat_interleavereplicates the cached state across option rows — an integer repeat, not a re-encode. - Isolate options in batch rows. Each option is scored in its own row against the repeated cache; option rows never attend to each other.
- Mix only in the head. The head reduces each row to one scaled logit; a softmax over a question's rows gives its probability vector.
- Pad, never reorder. Rows are padded to one width; padded positions receive a large negative logit and are excluded from the softmax.
Backbone invocation count stays fixed as questions and options grow, but candidate-scoring cost is not constant: it grows with the number of option rows scored. The saving is the eliminated re-encoding of the state, not a claim of constant-time inference.
The backbone derives from Qwen/Qwen3-0.6B-Base (Apache-2.0), distilled into a
compact 10-layer form. The decision head and the shared-state scoring contract
follow the typed-decision, head-over-backbone position.
Decision primitives
| Primitive | Purpose | Example |
|---|---|---|
choice | Select among discrete alternatives | Choose the next workflow action |
score | Select an ordinal level from an ordered scale | Assess operational risk |
noul | Evaluate a binary proposition | Determine whether human review is needed |
Each question returns probabilities in the order the options were supplied, the
chosen_key of the highest-probability option, and confidence (the maximum
probability).
Two contracts matter for correct use:
scorelevels are positional. Levels are interpreted by position, so labels must be ordered and contiguous.- Option text is part of the input. Options render as
key: valuewhen a value is supplied; changing the rendering changes the probabilities.
An optional caller-side helper, systemone_semantics.py, renders state-grounded
noul options and supports stable answer_keys. It is a convenience for
reproducible option rendering, not part of the model's identity, and it never
reads the state.
Benchmarks
Decision quality
Panel: LocalLLaMA/typed-decisions test split — 400 dossiers × 5 questions =
2,000 decisions. Canonical convention: every decision scored against the
dataset gold label, decision taken as argmax of the model probabilities.
| Model | Accuracy | NLL | Brier | Score MAE |
|---|---|---|---|---|
| RockAndEgg-313M-v3 (published weights) | 74.40% | 0.7283 | 0.0722 | 0.4956 |
| Laya, typed-decisions head (full 1024-token context) | 76.70% | 0.7272 | 0.0615 | 0.4707 |
Per decision type: choice 72.83%, noul 81.33%, score 70.37%.
Paired difference: −2.30 percentage points, 95% CI [−4.15, −0.25] (400 dossier clusters; 138 corrections, 184 regressions). The interval excludes zero, so on this panel and protocol Laya scored higher. This is a statement about one panel, not a universal ranking, and it is not an equivalence or non-inferiority claim — no margin was pre-specified.
Why 74.40% / 76.70% and not 74.50% / 76.65%. Both pairs are the same shipped weights (
bd30d80e…) and the same Laya typed-decisions checkpoint (4fa56de7…) on the same 400-dossier / 2,000-decision panel at S=256 in FP16. The 74.50% / 76.65% pair is the 2026-11-23 independent benchmark package (paired −2.15 pp [−4.15, −0.20]); the 74.40% / 76.70% pair is the 2026-11-25 canonical re-measurement (paired −2.30 pp [−4.15, −0.25]) reported here. The differences — 0.10 pp for RockAndEgg (two decisions) and 0.05 pp for Laya (one decision) — sit inside the measured FP16 run-to-run noise floor and reflect the two harnesses' independent paired-bootstrap implementations. The canonical re-measurement is the value used throughout this card.
The advantage is workload-dependent. RockAndEgg's measured strength is inference efficiency as questions share a state, not raw exact-match accuracy. Laya is better calibrated on this panel (Brier 0.0615 vs 0.0722) and slightly better on ordinal error.
Not reproduced here. An earlier out-of-distribution investigation reported large accuracy differences from option-rendering variants. That investigation contained evaluation-contract defects, including reversed
human_reviewoption polarity and an inconsistent ordinal rubric. Its OOD conclusions are withdrawn and are not established results. No replacement OOD result has been qualified, so none is claimed.
Inference latency and memory
Current published weights (bd30d80e…) against the native Laya typed-decisions
implementation (4fa56de7…), measured in-process on 2× Tesla T4 (SM 7.5) in
FP16 over 3 rounds. The current weights were faster in 32 of 32 measured configurations.
| Measurement (current published weights) | RockAndEgg-313M-v3 | Native Laya |
|---|---|---|
| Configurations faster | 32 / 32 | — |
| Latency ratio, F1 (one question, shared state) | reference | 0.90–0.96× (near parity) |
| Latency ratio, F8 (eight questions, shared state, S=256) | reference | 4.3× slower |
| Latency ratio, independent (non-shared) state | reference | 0.88–0.99× (advantage vanishes) |
| Peak allocated GPU memory, matched S256/F8 config | 860 MB | 2504 MB |
| Cold load | 1.6 s | 15.1 s |
The ratio is RockAndEgg latency over Laya latency, so below 1 favours RockAndEgg. The win is the shared-state KV reuse — the state is encoded once rather than re-encoded per question — so it is fan-out dependent: near parity at one question, 4.3× at eight, and it disappears when questions do not share a state. It is not a universal advantage. The memory difference is real but is not attributable to KV reuse alone: the models differ in parameter count (313M vs 421M) and in parameter-storage characteristics.
Historical (previous checkpoint 17a54706…, one T4, FP16, in-process): the
earlier stratified paired ratio was ~1.33× (range ~1.05–2.00×, 11/11 configs),
with ~0.85 GB vs ~2.68 GB peak reserved VRAM. Those figures describe the
pre-promotion checkpoint and are retained as historical; they are not the
current result. A separate matched workload on an RTX PRO 6000 favoured
Laya on p50 latency; results differ by hardware and workload and are not
combined.
Shared-state fan-out
The mechanism is measured, not asserted. Backbone forwards per request, counted by a hook inside the model:
| Arm | Backbone forwards per request |
|---|---|
| RockAndEgg, shared state | 2 — at every fan-out |
| RockAndEgg, one question at a time | 2F |
| Laya native | 1 (but its single batched pass still processes the state F times) |
At F=1 the shared and non-shared paths do identical work, which is the control that shows the harness measures the stated mechanism. From F=2 upward the shared path's advantage grows with fan-out; in the current re-benchmark this mechanism is the measured 4.3× latency advantage at F8/S256 (41 ms vs 177 ms).
Request-level concurrency
2× Tesla T4, FP16, S=256, in-process serving, 256 requests per level:
| Replicas | Requests/s | Decisions/s | p50 (ms) | p99 (ms) |
|---|---|---|---|---|
| 1 | 20.70 | 103.5 | 48.5 | 55.0 |
| 2 | 39.62 | 198.1 | 49.6 | 61.7 |
| 4 | 37.42 | 187.1 | 102.9 | 116.3 |
| 8 | 28.65 | 143.3 | 205.2 | 298.5 |
Throughput scales 1.91× from one replica to two with p50 unchanged. Beyond two replicas the aggregate regresses: both devices measure 91–94% GPU utilisation, so extra replicas queue rather than add capacity. The useful operating point on this substrate is one replica per T4.
This is in-process serving, not HTTP. No queueing model, no batching across requests. HTTP latency is not compared.
Quick start
Requires torch, transformers, and safetensors. The model ships custom
modeling code, so both loaders need trust_remote_code=True.
pip install torch transformers safetensors
import torch
from transformers import AutoModel, AutoTokenizer
from systemone_inference import Question, SystemOneInference, SystemOneRequest
model_id = "moeshawky/RockAndEgg-313M-v3"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModel.from_pretrained(
model_id, trust_remote_code=True, dtype=torch.float16
).to("cuda").eval()
adapter = SystemOneInference(model, tokenizer, max_state_len=256, max_option_len=64)
request = SystemOneRequest(
state=(
"Deployment failed at 03:12 UTC. The on-call engineer rolled back "
"the release and opened an incident."
),
questions=[
Question(
type="choice",
instruction="What happened?",
options=["The deployment failed", "The deployment succeeded"],
),
Question(
type="score",
instruction="How severe was it?",
options=["none", "low", "medium", "high"],
),
Question(
type="noul",
instruction="Does this need human review?",
options=["false", "true"],
),
],
)
with torch.inference_mode():
response = adapter(request)
for decision in response.decisions:
print(
decision.type,
decision.chosen_key,
round(decision.confidence, 4),
[round(p, 4) for p in decision.probabilities],
)
Verified output:
choice The deployment failed 0.566 [0.566, 0.434]
score high 0.3221 [0.2375, 0.2047, 0.2357, 0.3221]
noul false 0.5641 [0.5641, 0.4359]
systemone_inference.py ships in this repository. Download it into your working
directory before running the example.
On CPU, load with dtype=torch.float32. BF16 is not supported on Turing (T4);
use FP16 on CUDA.
Text-generation interfaces do not apply. There is no
generate()path and no LM head.model.generate(...)does not exist. Use the adapter above or the HTTP API below.
Serving
The repository ships a FastAPI server. It needs fastapi and uvicorn in
addition to the model dependencies.
pip install fastapi uvicorn
# Local directory (the script's own directory is used when it holds config.json)
python systemone_server.py
# From the Hub — the revision pin is mandatory for Hub sources
RAE_MODEL_ID=moeshawky/RockAndEgg-313M-v3 \
RAE_MODEL_REVISION=<commit-sha> \
RAE_PORT=8012 python systemone_server.py
| Endpoint | Method | Purpose |
|---|---|---|
/healthz | GET | liveness plus resolved configuration |
/ready | GET | readiness with per-check results |
/v1/systemone | POST | typed decisions for one state and question list |
curl -X POST http://127.0.0.1:8012/v1/systemone \
-H 'Content-Type: application/json' \
-d '{
"state": "Deployment failed at 03:12 UTC. Roll back or ignore.",
"questions": [
{
"type": "choice",
"instruction": "What should the operator do next?",
"options": ["Roll back the release", "Ignore it"],
"answer_keys": ["rollback", "ignore"]
}
]
}'
Representative response:
{
"decisions": [
{
"type": "choice",
"probabilities": [0.5273, 0.4727],
"chosen_key": "rollback",
"confidence": 0.5273
}
],
"truncated": false,
"state_tokens": 12,
"max_state_tokens": 256,
"physical_state_len": 256,
"context_policy": "fixed-256",
"options_truncated": 0,
"option_rows": 2
}
answer_keys is optional. Supply it to receive stable identifiers instead of
option text as chosen_key; omit it and the key is the option text. Empty or
whitespace-only states, and empty or duplicate answer_keys, are rejected with
HTTP 422.
The server binds loopback by default. Binding a non-loopback address requires
RAE_API_TOKEN; without it, startup fails rather than exposing an unauthenticated
endpoint.
Intended use
Appropriate applications:
- Agentic workflow decisions — routing, tool selection, next-action choice.
- Structured classification over a fixed, known option set.
- Candidate selection among enumerated alternatives.
- Operational assessments — severity, risk level, triage.
- Multi-question decision pipelines that share one state.
- Resource-constrained inference on Turing-class GPUs or CPU.
RockAndEgg is a decision-support component. It produces a scored recommendation with a confidence value; it does not authorize consequential actions. Any deployment that gates a consequential action on its output requires application-specific validation and human oversight.
Limitations
- Confidence is not calibrated. Probabilities are raw softmax at
T = 1.0. The production ECE ≤ 0.05 gate is not met (0.1323 on the 2,000-decision FP16 panel). Do not useconfidenceas a calibrated probability of correctness or as a risk threshold. - Accuracy is workload-dependent. On the 2,000-decision panel the model trails Laya by 2.30 pp; its measured advantage is inference efficiency under shared state, not accuracy.
- Bounded context. 256 state tokens, 64 option tokens. Longer inputs are truncated; the response reports
truncatedandstate_tokensso an overlength state is never presented as fully evaluated. - English-centric. Training data is English; other languages are untested.
- Fixed decision types.
choice,score,noulonly — no free-form label space and no instruction following. - Small evaluation panels. Per-type cells are 600–800 decisions and per-workflow cells 500, so small differences there are not resolved.
- No safety tuning. The model scores options; it does not refuse and has no notion of harmful content.
- Single-machine measurements. Latency, memory and concurrency figures are specific to the stated hardware and do not transfer unchanged.
Source code and technical documentation
- Source repository: https://github.com/moeshawky/rockandegg-v3-code
- Model card (source): https://github.com/moeshawky/rockandegg-v3-code/blob/main/docs/release/MODEL_CARD.md
- Inference and latency benchmarks: https://github.com/moeshawky/rockandegg-v3-code/blob/main/docs/INFERENCE_BENCHMARKS.md
- Release qualification: https://github.com/moeshawky/rockandegg-v3-code/blob/main/docs/release/RELEASE_QUALIFICATION.md
- Reproduction: https://github.com/moeshawky/rockandegg-v3-code/blob/main/REPRODUCTION.md
- Training methodology: https://github.com/moeshawky/rockandegg-v3-code/blob/main/FULL_BACKBONE.md
- Publication manifest: https://github.com/moeshawky/rockandegg-v3-code/blob/main/PUBLIC_MANIFEST.md
Detailed evidence ships with this model repository: evidence/quality_metrics.json,
evidence/latency_results.json, evidence/memory_results.json,
evidence/predictions.jsonl, evidence/fp16_invariance.json,
BENCHMARK.md, CALIBRATION_LIMITATIONS.md, and TRAINING_PROVENANCE.md.
License and attribution
Apache-2.0. The backbone derives from Qwen/Qwen3-0.6B-Base (Apache-2.0);
training data is LocalLLaMA/typed-decisions (Apache-2.0); the benchmark arm uses
convaiinnovations/laya (Apache-2.0). See ATTRIBUTION.md and LICENSE.
Citation
@misc{rockandegg313m_v3_2026,
title = {RockAndEgg-313M-v3: a non-generative typed-decision model},
author = {moeshawky},
year = {2026},
url = {https://huggingface.co/moeshawky/RockAndEgg-313M-v3}
}