squid-1 / README.md
naluj's picture
Clean up model card layout and formatting
a99d2de verified
|
Raw History Blame Contribute Delete
8.93 kB
---
license: apache-2.0
library_name: peft
base_model: thinkingmachines/Inkling-2-Mini
base_model_relation: adapter
pipeline_tag: text-classification
language:
- en
datasets:
- nvidia/When2Call
- nvidia/Aegis-AI-Content-Safety-Dataset-2.0
tags:
- decision-model
- classification
- calibration
- routing
- guardrails
- lora
- peft
- moe
---
<div align="center">
<img
src="https://huggingface.co/naluj/squid-1/resolve/main/assets/benchmark_scorecard.png"
alt="squid-1 decision model benchmark scorecard"
style="width: 100%; max-width: 100%; height: auto; display: inline-block; margin-bottom: 0.5em; margin-top: 0.5em;"
/>
<div style="display: flex; justify-content: center; gap: 1em; margin-bottom: 1em;">
<a href="https://github.com/naluj/squid"><strong>GitHub</strong></a>
·
<a href="#-how-to-use"><strong>Quickstart</strong></a>
·
<a href="#-performance"><strong>Benchmarks</strong></a>
</div>
</div>
# squid-1
`squid-1` is an open-weights, calibrated **System One decision model** post-trained as a rank-16 LoRA adapter on [`Inkling-2-Mini`](https://huggingface.co/thinkingmachines/Inkling-2-Mini) (26.4B total / 3.4B active looped-MoE) for **~$5.26 total training spend**.
Given a state, a question, and candidate options, it returns calibrated probabilities over every valid option in a **single forward pass at `effort=0.0`**, without generating chain-of-thought tokens.
- **72.77** weighted average across all 3 public-derived AA Decision Index v2.1 components (local proxy, 5,556 held-out items, 0 train–eval overlaps).
- **Well-calibrated for escalation**: `0.0254` ECE and `0.834` error-detection AUROC on `decision-v7/test` — escalating the lowest-confidence 20% catches **52.6%** of all errors.
- **Order- and injection-resilient**: `8.9%` 4-form flip rate (`0%` on safety) and a `>4×` smaller accuracy drop under unseen prompt injections.
## 🗒️ Model Details
| Model | Parameters | Description |
|---|---|---|
| [`Inkling-2-Mini`](https://huggingface.co/thinkingmachines/Inkling-2-Mini) | 26.4B (3.4B active) | Looped-MoE base model (Apache 2.0) |
| **[`squid-1`](https://huggingface.co/naluj/squid-1)** | 26.4B (3.4B active) | Rank-16 LoRA adapter (~742 MB) for calibrated single-pass decisions |
- **Inputs**: text states (structured or free-form) and up to 62 options via single-token ASCII labels (`A–Z`, `a–z`, `0–9`)
- **Adapter**: PEFT LoRA (`r=16`, `lora_alpha=32`, all linear layers)
- **Inference**: single forward pass at `effort=0.0`; optional 2-pass parallel option-order averaging for stronger symmetry and calibration
- **Max sequence length**: up to 32,768–65,536 tokens (middle-out truncation in serving preserves both state prefix and question/options)
## 🏃 How to use
### Request format (`/v1/systemone`)
The [serving wrapper](https://github.com/naluj/squid) exposes a drop-in `/v1/systemone` API. A request carries one `state` and any number of `questions`:
```python
questions = {
"refund": {
"type": "noul",
"instructions": "Is the customer asking for a refund?",
},
"team": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Charges, refunds, invoices",
"technical": "App or site faults",
"fraud": "Suspected unauthorised use",
},
},
"urgency": {
"type": "score",
"instructions": "How urgent is this?",
"criteria": ["Can wait", "Today", "Blocking the customer now"],
},
}
request = {
"state": "I was charged twice this month, please refund one of them.",
"questions": questions,
}
```
| `type` | `criteria` | answer fields |
|---|---|---|
| `noul`: yes or no | optional | `noul`: `P(yes)` |
| `choice`: one of named options | `{name: description}` or `options` | `choice`, `probabilities` |
| `score`: ordered levels | list of levels, lowest first | `score`, `probabilities` |
### PEFT / Transformers
```python
import torch
from transformers import AutoModelForMultimodalLM, AutoTokenizer
from peft import PeftModel
base_id = "thinkingmachines/Inkling-2-Mini"
adapter_id = "naluj/squid-1"
tokenizer = AutoTokenizer.from_pretrained(base_id)
base = AutoModelForMultimodalLM.from_pretrained(
base_id,
dtype=torch.bfloat16,
device_map="auto",
)
model = PeftModel.from_pretrained(base, adapter_id).eval()
```
See [github.com/naluj/squid](https://github.com/naluj/squid) for the exact `effort=0.0` prompt renderer, FastAPI server (`scripts/serve.py`), and benchmark harnesses.
### Calibration
Convert valid option-token logits to calibrated probabilities via per-type temperature scaling `p = softmax(logits / T)` (fit on a held-out calibration split):
| Decision type | `choice` | `score` | `noul` | `default` |
|---|---:|---:|---:|---:|
| Temperature `T` | `1.08474` | `1.11195` | `0.93600` | `1.06966` |
For best symmetry and Brier calibration, score the original and reversed option orders in parallel and average aligned probabilities: `0.5 * (p_orig + p_rev[::-1])`.
## 📊 Performance
### AA Decision Index v2.1 — Public-Component Proxy
Evaluated locally across all 3 public-derived index components (40% of total index weight, 5,556 held-out items, 0 failures, 0 train–eval overlaps) with 2-pass symmetry averaging.
| Benchmark (Index Weight) | `squid-1` | Notes |
|---|---:|---|
| EvalSafe-O\*NET-AA (15%) | **87.57** | `n=3,272` · `noul` 93.79, `choice` 81.66, `score` 78.63 |
| When2Call (10%) | **88.12** | `n=1,775` · `request_for_info` 95.49, `tool_call` 86.09, `cannot_answer` 85.10 |
| HLE-MultiChoice v1.1 (15%) | **47.75** | `n=509` · 60.9% decline rate |
| **3-Component Weighted Proxy (40%)** | **72.77** | **Local proxy — not an official AA leaderboard score** |
### Zero-CoT Public Benchmarks
Single-forward-pass (`effort=0.0`, zero generated tokens) accuracy, calibration, and selective-escalation metrics on untouched public benchmarks (0 train–eval overlaps):
| Benchmark | `n` | Accuracy | Brier | ECE | Error AUROC | Top-80% Acc |
|---|---:|---:|---:|---:|---:|---:|
| GPQA-Diamond (2-pass) | 198 | 50.0% | 0.6079 | 0.0720 | 0.735 | 55.1% |
| MMLU-Pro 1k (2-pass) | 1,000 | 62.2% | 0.5136 | 0.0881 | 0.802 | 70.1% |
| Kev `decision-v7/test` (1-pass) | 1,324 | 82.6% | 0.2457 | 0.0254 | 0.834 | 89.7% |
### Post-Training Impact, Symmetry & Robustness
<div align="center">
<img
src="https://huggingface.co/naluj/squid-1/resolve/main/assets/post_training_impact.png"
alt="squid-1 post-training impact and calibration"
style="width: 100%; max-width: 100%; height: auto; display: inline-block; margin-bottom: 0.5em; margin-top: 0.5em;"
/>
</div>
| Suite | Base (`Inkling-2-Mini`) | `squid-1` | Notes |
|---|---:|---:|---|
| AA-Symmetry analog (90 × 4 forms) | 65.55 (27.8% flip) | **72.31 (8.9% flip)** | `0%` flip on Aegis 2.0 safety |
| O\*NET `>26` options (`n=58`) | 73.89 (65.5% acc) | **84.52 (87.9% acc)** | 0 failures |
| Omniscience analog (`n=300`) | 75.74 | **76.76** | 99.0% answer precision (98/99) |
| Unseen prompt-injection drop | -6.0 | **-2.4** | 100% held-out attack templates |
| JevBench (231 tasks, 1-pass) | 87.9% | **87.9%** | `0.1714` Brier |
## 🔧 Training
- **Data**: Leak-free decision mix spanning `choice`, `noul`, and `score` tasks, including `When2Call` tool-calling routing, `Aegis 2.0` 4-form safety invariance, self-knowledge abstention MCQs, and clean-vs-injected pairs built from 18 training-only prompt-injection templates (0 overlaps with any eval split).
- **Distillation**: Active hard-example mining followed by `K=4` soft-target System 2 → System 1 distillation from `Inkling-2-Small` (`effort=0.5`).
- **Objective**: Candidate-normalized cross-entropy + proper Brier calibration term + vocabulary-mass anchor + 4-form symmetry group loss (Jensen–Shannon divergence and margin-spread penalty), followed by post-hoc per-type temperature calibration.
- **Recipe**: Multi-stage rank-16 LoRA (`lora_alpha=32`, all-linear) trained on Tinker for **~$5.26 total spend**.
## Limitations
- Tuned specifically for single-token decision prompting at `effort=0.0`; free-form text generation and non-zero reasoning effort are untested.
- Local AA proxy and analog numbers are independent evaluations with approximated prompts, not official Artificial Analysis leaderboard scores (`AA-Paperclip`, `AA-Omniscience-Decision`, and `AA-Symmetry` forms are private).
## License
`squid-1` is fine-tuned from [`thinkingmachines/Inkling-2-Mini`](https://huggingface.co/thinkingmachines/Inkling-2-Mini) and released under the [Apache License 2.0](LICENSE).
## Attribution
Base model: `Inkling-2-Mini` by Thinking Machines, licensed under the Apache License 2.0. This adapter modifies the base model via LoRA fine-tuning and is not affiliated with or endorsed by Thinking Machines or Artificial Analysis.