Instructions to use ericlewis/herb-150m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ericlewis/herb-150m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="ericlewis/herb-150m", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("ericlewis/herb-150m", trust_remote_code=True) model = AutoModel.from_pretrained("ericlewis/herb-150m", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Herb-150M (
ericlewis/herb-150m)
Herb-150M (ericlewis/herb-150m)
Herb-150M: Good judgment on a small budget.
Herb is named for Herbert A. Simon and his concept of bounded rationality (Simon, 1955). Real software decisions operate under budgets of latency, context, and compute. Herb delivers structured, typed judgment directly on compact hardware while leaving policy thresholds, tool execution, and escalation rules in application code.
(Herb is distinct from Jev and makes no claims on behalf of any external product deployment.)
Quantized Companion Releases
Pre-quantized zero-dependency weights (180.65 MiB backbone vs 576.17 MiB FP32 on disk; 188.1 MiB idle GPU VRAM vs 304.0 MiB BF16) are also available:
- FP8 (
float8_e4m3fn):ericlewis/herb-150m-fp8— per-output-channel FP8 encoder weights with FP32 scales, BF16 embeddings/norms, and FP32 decision head (zerotorchaodependency). - INT8 (
int8):ericlewis/herb-150m-int8— per-output-channel INT8 encoder weights with FP32 scales, BF16 embeddings/norms (ordtype=torch.float32on CPU), and FP32 decision head.
(Runtime quantization is also built directly into ericlewis/herb-150m via from_pretrained(..., quantize="fp8") or quantize="int8".)
Overview & Capabilities
Given a serialized context (state), a typed question, and its candidate choices or scale, Herb returns probability distributions and scalar expectations across three decision types:
choice— discrete multi-way selection over explicit options (Kcandidates)noul— binary existence / truth / presence adjudication (verify())score— ordered scalar rating on a bounded discrete grid (score())
Candidate options are first canonicalized by option ID (sorted(options.items())) and read out through HybridSetAttentionHead, so Python API predictions are deterministic regardless of caller dict insertion order. Because the underlying encoder still uses sequential RoPE positions across concatenated options, renaming option IDs in a way that changes their sorted order can affect borderline cases; passing orders=4 evaluates up to four canonical permutations in one batched GPU pass (1.60x faster than serial 4-pass execution) to stabilize close calls.
Architecture & Bundle Specifications
| Component | Specification |
|---|---|
| License | Apache-2.0 (LICENSE, matching dmis-lab/UltraBERT-150M) |
| Backbone | dmis-lab/UltraBERT-150M (24-layer bidirectional encoder, hidden_size = 768, alternating 128-token local / global attention) |
| Decision Head | HybridSetAttentionHead (kind: "hybrid_sab", width = 384, sab_heads = 6, sab_ffn = 768, strictly FP32) |
| Layer Aggregation | Per-type LayerScalarMix (use_scalar_mix = true, per_type_scalar_mix = true, scalar_mix_stride = 2) |
| Sequence Representation | lean_start / state_first (16,384 default max_seq_len matching training; 32,768 max positional window) |
| Bundle Footprint | 576.17 MiB encoder (model.safetensors, FP32 storage) + 7.08 MiB head (joint_head.safetensors) ≈ 586.7 MiB total |
| Quantized Companions | ericlewis/herb-150m-fp8 & ericlewis/herb-150m-int8 (180.65 MiB encoder + 7.08 MiB head) |
Precision, Long-Context Memory & Throughput (v1.1)
Measured on a single NVIDIA GB10 (Blackwell, CUDA 13.2, PyTorch 2.15.0+cu132, single-request B=1 unless noted) comparing v1.0 (9d0e4262) against v1.1 (hook-free lock-free forward + O(L·w) blocked sliding-window SDPA + batched orders=4/ask_many/decide_batch):
| Variant | Encoder Disk Size | Idle VRAM | 380t Latency | 15,040t Latency / Peak VRAM | 32,000t Latency / Peak VRAM | v11_val_balanced (4,934) |
Public 4-Set Mean (BoolQ/SST-2/AG News/SST-5) |
JevBench public-231 |
|---|---|---|---|---|---|---|---|---|
v1.0 BF16 (9d0e4262) |
576.17 MiB | 607.4 MiB | 10.12 ms | 1,153.1 ms / 3,010.7 MiB | 4,480.5 ms / 11,413.4 MiB | — | — | 148/231 (64.07%) |
v1.1 BF16 (main) |
576.17 MiB | 304.0 MiB | 9.87 ms | 408.2 ms / 881.6 MiB | 1,055.4 ms / 1,528.8 MiB | 85.23% | 73.27% (74.1 / 87.4 / 85.8 / 45.8) |
148/231 (64.07%) |
Herb-150M-FP8 (w8a16 default) |
180.65 MiB | 188.1 MiB | 13.66 ms | 418.5 ms / 767.5 MiB | 1,071.4 ms / 1,412.8 MiB | 85.37% (98.7% agree) |
73.30% (74.0 / 87.5 / 86.1 / 45.6) |
147/231 (63.64%, 95.7% agree) |
Herb-150M-INT8 (w8a16) |
180.65 MiB | 188.1 MiB | 13.55 ms | 415.5 ms / 767.5 MiB | 1,067.8 ms / 1,412.8 MiB | 85.25% (99.47% agree) |
73.09% (73.9 / 87.3 / 85.9 / 45.3) |
147/231 (63.64%, 97.4% agree) |
Batching & Multi-Question Speedups (NVIDIA GB10, 380-token state, v1.1 BF16 vs v1.0):
choose(..., orders=4):25.69 msbatched vs41.17 msserial (1.60xspeedup;0.0probability delta)ask_many(state, 8_questions):50.02 msbatched vs81.56 msserial (1.63xspeedup)ask_many(state, 32_questions):260.21 msbatched vs325.41 msserial (1.25xspeedup)- CPU (
404tokens,dtype=torch.float32):v1.1FP32233.65 msmedian;INT8257.89 msmedian (264.04 msp95 vs333.63 msFP32 p95) with100.0%agreement onBoolQ-100(76%) andAG News-100(86%).
Post-Hoc Calibration (cal_a, cal_b)
decision_config.json includes a 6-parameter log-cardinality temperature curve (log T(type, K) = a_type + b_type * log(K / 2)) fitted on held-out v11_ood_cal (2,445 items) without modifying checkpoint weights (0 top-1 argmax changes across all evaluated benchmarks; pass calibrate=False to inspect raw logits):
| Evaluation Split | Uncalibrated ECE / Brier | Calibrated (v1.1) ECE / Brier |
Argmax Flips |
|---|---|---|---|
JevBench public-231 (148/231) |
0.1555 / 0.5334 |
0.0808 / 0.4959 |
0 |
v11_val_balanced (4,934 Qs, 85.23%) |
0.0241 / 0.1963 |
0.0175 / 0.1961 |
0 |
BoolQ-1000 (74.1%) |
0.0918 / 0.3801 |
0.0233 / 0.3616 |
0 |
(Note: because calibration temperatures are positive scalars per question type fit on an OOD mix at ~78% noul accuracy, higher-accuracy binary splits like SST-2 (87.4%) become slightly softer unless calibrate=False or task-specific temperature scaling is applied.)
Evaluation: Complete Official Decision Index 0.3
Evaluated on the complete public Decision Index 0.3 suite (140,620 total requests: 140,603 ok / 17 unsupported, 140,178 scoreable requests across 43 benchmarks, Clef-parity lean-start rendering).
Latency Method Note: The median / p95 latencies reported in the Decision Index table below (
3.1 ms / 28.2 msfor--orders 1) were measured under8× RTX PRO 6000 BF16batched native evaluation, which is not directly comparable to single-requestB=1HTTP timings (see the single-GPUB=1table above).
Checkpoint Comparison
| Model / Revision | Eval Mode | Decision Index | Raw Index | Knowledge | Language | Retrieval | Tools | Arts | Median / p95 Latency (8× GPU batched) |
|---|---|---|---|---|---|---|---|---|---|
ericlewis/herb-150m (main · z54c-dsbm-quad-s12-hi30-20c-15b-20d-15a) |
--orders 1 |
43.01 | 57.25 | 14.17 | 45.58 | 65.60 | 61.92 | 31.15 | 3.1 ms / 28.2 ms |
ericlewis/herb-150m (main · z54c-dsbm-quad-s12-hi30-20c-15b-20d-15a, TTA) |
--orders 4 |
43.14 | 57.35 | 14.61 | 45.50 | 65.79 | 62.15 | 30.71 | 4.5 ms / 74.6 ms |
ericlewis/herb-150m (z54b-dsbm-tri-s14-hi35-30c-35b-h25-35c-40b) |
--orders 1 |
43.00 | 57.25 | 14.07 | 45.50 | 65.57 | 62.10 | 31.19 | 2.3 ms / 21.8 ms |
ericlewis/herb-150m (z54b-dsbm-tri-s14-hi35-30c-35b-h25-35c-40b, TTA) |
--orders 4 |
43.12 | 57.34 | 14.50 | 45.42 | 65.69 | 62.37 | 30.72 | 5.1 ms / 84.1 ms |
ericlewis/herb-150m (z53c-lw-lo12start-hi12-50-50-h40-60, TTA) |
--orders 4 |
43.14 | 57.36 | 14.70 | 45.44 | 65.77 | 62.13 | 30.68 | 4.6 ms / 74.7 ms |
ericlewis/herb-150m (z53c-lw-lo12start-hi12-50-50-h40-60) |
--orders 1 |
42.99 | 57.24 | 14.16 | 45.56 | 65.58 | 61.89 | 31.09 | 2.3 ms / 21.8 ms |
Engineering Fixes in v1.1
- Thread-safe lock-free forward: Removed per-call
register_forward_hookmutations frommodeling_herb.py; concurrent threads safely share one model instance (0.0max diff across 8 concurrent threads). - Exact Clef JSON rendering: Dict/list-valued
questionand optiondescriptionfields now serialize via compact sorted-key JSON (_render_value) instead of Pythonstr(). - Safe JSON state parsing:
_parsed_statecatchesValueError(such as Python's 4,300-digit integer string limit),TypeError, andRecursionError; passparse_json_state=Falsefor raw string passthrough. - Honest length limits & overflow control:
max_seq_lendefaults to16,384(matching training, withmax_seq_len=32768supported up to the positional window); truncation emits aUserWarningand returns"truncated"and"dropped_state_tokens"(or raisesValueErrorwithon_overflow="error"). - Memory & batching:
O(L · w)blocked sliding-window SDPA + padding-free global Flash SDPA cuts32k-token VRAM by7.5x; added batchedorders=4,ask_many(), anddecide_batch().
Usage
Pin revision= when loading with trust_remote_code=True to guarantee reproducible code and weights:
import torch
from transformers import AutoModelForMultipleChoice
model = AutoModelForMultipleChoice.from_pretrained(
"ericlewis/herb-150m",
revision="583c5db21719c46c3e659f0519ab06ff803aa990",
trust_remote_code=True,
dtype=torch.bfloat16,
# Optional runtime quantization: quantize="fp8" or quantize="int8"
).to("cuda" if torch.cuda.is_available() else "cpu").eval()
# 1. Discrete choice selection (orders=1 single pass, or orders=4 batched averaging)
choice = model.choose(
state={"user_msg": "Schedule a meeting tomorrow at 2pm", "tools": ["calendar_create", "send_email"]},
question="Which tool should run?",
options={"calendar_create": "Create a calendar event", "send_email": "Send an email message"},
orders=1,
)
print(choice["choice"], choice["probabilities"], choice["truncated"])
# 2. Binary true/false adjudication (noul)
check = model.verify(
state="Invoice #418 is marked paid on 2026-11-26.",
question="The invoice is unpaid.",
)
print(check["value"], check["probabilities"])
# 3. Ordinal scoring
rating = model.score(
state="Concise, accurate, and directly cites the relevant clause.",
question="Rate response quality.",
levels=["poor", "fair", "good", "excellent"],
)
print(rating["score"], rating["probabilities"])
# 4. Ask multiple questions over one shared state (tokenized once, batched on GPU)
many = model.ask_many(
state="Invoice #418 ($240.00) was paid on 2026-11-26 via ACH.",
questions=[
"Is the invoice unpaid?",
{"question": "How was it paid?", "options": {"ach": "ACH bank transfer", "card": "Credit card"}},
],
)
# 5. Extended context up to 32,768 tokens or strict overflow refusal
strict = model.verify(
state="...",
question="Is policy satisfied?",
max_seq_len=32768,
on_overflow="error",
)
Limitations, Scope & Intended Use
- Public Benchmark Evidence vs. Production Deployment: The metrics above measure public benchmarks (
Decision Index 0.3,JevBench public-231,BoolQ,SST-2,AG News,SST-5,v11_val_balanced). Production readiness requires task-specific confirmation splits, counterfactual checks, and calibrated error-rate bounds enforced by application code. - Known Weaknesses: As a
150M-parameter encoder without chain-of-thought generation, Herb-150M struggles on symbolic computation, program execution traces, math word problems, multi-hop probability/adequacy judgments (JevBenchadequacy4/12,probability2/10,routing6/12), graduate-level QA (HLE), and open-ended subjectiveArtstasks. - English Scope & Policy Boundary: Pretrained and fine-tuned on English text; critical or irreversible actions should always be gated by confidence thresholds and escalated to deterministic checks, larger verifiers, or human review.
- Downloads last month
- 43
Model tree for ericlewis/herb-150m
Base model
dmis-lab/UltraBERT-150M