FastBrain-9B / README.md
TypeScript's picture
Initial release of FastBrain-9B
a409e51
|
Raw History Blame
7.54 kB
---
base_model: Cloudflare/clef-flash
library_name: transformers
license: apache-2.0
pipeline_tag: text-generation
tags:
- fastbrain
- systemone
- decision-index
- tool-calling
- intent-classification
- structured-decision
---
<div align="center">
# FastBrain-9B
**Non-Autoregressive System-1 Structured Decision Model (`9.4B` Parameters)**
[![Architecture](https://img.shields.io/badge/Backbone-Qwen3.5--9B_Hybrid_(9.4B_Total)-3b82f6?style=flat-square)](#architecture)
[![Decision Head](https://img.shields.io/badge/Head-JointSchemaHead_(116M)-10b981?style=flat-square)](#architecture)
[![Decision Index](https://img.shields.io/badge/Decision_Index_v0.2.1-80.55%25_(%232_Overall_%C2%B7_%231_9B)-f59e0b?style=flat-square)](#benchmark-evaluation)
[![License](https://img.shields.io/badge/License-Apache_2.0-6366f1?style=flat-square)](./LICENSE)
</div>
**FastBrain-9B** (`9.4B` total parameters: `Qwen3.5-9B` hybrid backbone + `116M` `JointSchemaHead`) is a single-forward-pass, non-autoregressive **System-1 structured decision model**.
Given an arbitrary JSON state and one or more structured decision schemas (`choice`, `noul` binary verification, or `score` ranking), **FastBrain-9B** evaluates all candidate options and questions **jointly in a single forward pass (`0` generated tokens)**鈥攄elivering calibrated option probabilities, tool-call selections, and open-set abstention decisions at encoder-level latency.
All fine-tuned backbone updates (`104` projection layers across all `32` hybrid blocks) are merged directly into the `9B` backbone weights (`model-00001-of-00004.safetensors` .. `model-00004-of-00004.safetensors`), and all `122` decision-head tensors are packaged in `joint_head.safetensors`. **No external LoRA or PEFT adapter is required at inference time.**
---
## Benchmark Evaluation & Parameter Scale Comparison
Evaluated on the official **Cloudflare Decision Index (v0.2.1)** across **10 benchmarks (22,427 evaluation requests)**, **FastBrain-9B (`9.4B`)** achieves an overall Macro Mean of **`80.55%`**:
- **Ranks `#1` across all `<=9B` models on `10 / 10` benchmarks**, outperforming the same-size base model `Clef-flash` (`9.4B`, `74.96%`) by **`+5.59 pp`**, `Kev 9B` (`9B`, `76.51%`) by **`+4.04 pp`**, and `Laya` (`0.4B`, `58.09%`) by **`+22.46 pp`**.
- **Outperforms `3x`-larger `27B`-class models**: surpasses `Jev` (`27B`, `80.32%`) and `DiffusionGemma Jev` (`26B-A4B`, `69.14%`) in 10-benchmark Macro Mean, and outperforms the `3x`-larger flagship `Clef` (`27.4B`, `81.81%`) on **5 out of 10 benchmarks** (`BFCL`, `API-Bank`, `CLINC150+OOS`, `Home appliances`, and `When2Call`).
![FastBrain-9B Overview](./assets/benchmark_overview.png)
### Full 10-Benchmark Evaluation Matrix (Annotated by Model Parameter Scale)
![FastBrain-9B Scoreboard](./assets/benchmark_scoreboard.png)
### Fine-Grained Decision Calibration & Open-Set Reliability
![FastBrain-9B Calibration Breakdown](./assets/decision_calibration_breakdown.png)
### Summary Comparison by Model Parameter Scale
| Benchmark | Metric | `Laya`<br>*(0.4B / 421M)* | `DiffusionGemma Jev`<br>*(26B-A4B 路 4B Act)* | `Clef-flash`<br>*(9.4B Base)* | `Kev 9B`<br>*(9B Dense)* | `Jev`<br>*(27B Dense)* | `Clef`<br>*(27.4B Flagship)* | **FastBrain-9B**<br>*(9.4B 路 Ours)* |
| :--- | :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| **Parameter Scale** | **Total (Active)** | `0.42B` | `25.8B (4B MoE)` | `9.41B` | `9.0B` | `27.0B` | `27.36B` | **`9.41B`** |
| **BFCL** | Case Exact | 95.87% | 97.64% | 98.76% | 97.58% | 98.58% | 98.47% | **98.76% (#1)** |
| **ToolRet** | nDCG@10 | 51.31% | 45.28% | 67.26% | 65.72% | 65.50% | 68.18% | **67.26% (#2 路 #1 9B)** |
| **API-Bank** | Accuracy | 86.22% | 85.24% | 93.11% | 89.76% | 90.35% | 91.93% | **93.70% (#1)** |
| **BANKING77** | Macro-F1 | 62.66% | 93.80% | 93.69% | 91.77% | 93.58% | 94.07% | **93.77% (#1 9B)** |
| **CLINC150+OOS** | Macro-F1 | 73.79% | 94.64% | 66.77% | 96.65% | 96.44% | 97.43% | **98.44% (#1)** |
| **Home appliances** | Case Exact | 23.86% | 68.18% | 96.59% | 88.64% | 88.64% | 96.59% | **97.73% (#1)** |
| **BRIGHT** | nDCG@10 | 25.00% | 18.69% | 38.49% | 38.53% | 43.37% | 48.03% | **38.58% (#1 9B)** |
| **Amazon ESCI** | Macro-F1 | 52.84% | 56.83% | 57.39% | 53.75% | 56.60% | 59.30% | **57.40% (#2 路 #1 9B)** |
| **PhishNChips** | Accuracy | 60.45% | 55.65% | 71.95% | 72.10% | 88.20% | 91.70% | **78.75% (#1 9B)** |
| **When2Call** | Macro-F1 | 48.92% | 75.44% | 65.58% | 70.64% | 81.91% | 72.37% | **81.13% (#2 路 #1 9B)** |
| **Macro Mean (10)** | **Average** | **58.09%** | **69.14%** | **74.96%** | **76.51%** | **80.32%** | **81.81%** | **80.55% (#2 路 #1 9B)** |
---
## Architecture
1. **Hybrid Gated DeltaNet + Full-Attention Backbone (`9.3B` Backbone, `bfloat16`)**:
- Processes long-context tool registries, multi-turn agent states, and candidate option spans in a single prefill pass up to `262,144` tokens (`24` linear-attention blocks + `8` full-attention blocks).
- Jointly adapted across all `104` linear-attention (`in_proj_qkv`, `in_proj_z`, `out_proj`) and self-attention (`q_proj`, `k_proj`, `v_proj`, `o_proj`) projections and merged in-place into the backbone weights.
2. **Joint Schema Decision Head (`joint_head.safetensors`, `116M` Parameters)**:
- Extracts question-level and option-level span representations directly from the final hidden states and scores all questions (`choice`, `noul`, `score`) simultaneously without autoregressive decoding (`output_tokens = 0`).
3. **Compile-Time AST Schema-Aware Margin Calibration (`joint_schema_model.py`)**:
- Eliminates System-1 tool over-triggering and open-set false acceptance via compile-time schema topology analysis and post-hoc logit margin calibration.
---
## Quickstart
`TypeScript/FastBrain-9B` is a drop-in replacement for `Cloudflare/clef-flash` using the standard `joint_schema_model` runtime:
```python
from huggingface_hub import snapshot_download
import sys
import torch
model_dir = snapshot_download("TypeScript/FastBrain-9B")
sys.path.insert(0, model_dir)
import joint_schema_model as clef
model, processor = clef.load_release_model(model_dir, device="cuda", dtype=torch.bfloat16)
response = clef.systemone(model, processor, {
"model": "TypeScript/FastBrain-9B",
"state": {
"query": "Can you check my account balance?",
"tools": ["get_balance", "transfer_funds"],
},
"questions": {
"q": {
"type": "choice",
"query": "Select the best next action.",
"criteria": {
"a": "Call <tool_call>{\"name\": \"get_balance\", \"arguments\": {}}</tool_call>",
"b": "Could you please provide your account ID or authentication token first?",
"c": "I am unable to access personal banking records.",
},
},
},
})
print(response)
```
---
## Repository Structure
| File | Description |
| :--- | :--- |
| `model-00001-of-00004.safetensors` .. `00004` | Full `9B` backbone weights (`bfloat16`, in-place merged, no LoRA required) |
| `joint_head.safetensors` & `joint_head_config.json` | `116M`-parameter `JointSchemaHead` weights (`122` tensors) and configuration |
| `joint_schema_model.py` | `ClefModel`, `JointSchemaHead`, `load_release_model()`, and `systemone()` runtime |
| `config.json`, `tokenizer.json`, `processor_config.json` | Standard Hugging Face model, tokenizer, and processor configurations |
| `assets/*.png` | High-resolution technical benchmark and calibration charts |