Text Generation
Transformers
Safetensors
scrapegoat
dual-track
parallel-attention
Mixture of Experts
kda
quantile-balancing
Instructions to use scrapegoat/Scrapegoat-Tiny-Coder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use scrapegoat/Scrapegoat-Tiny-Coder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="scrapegoat/Scrapegoat-Tiny-Coder")# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("scrapegoat/Scrapegoat-Tiny-Coder", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use scrapegoat/Scrapegoat-Tiny-Coder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "scrapegoat/Scrapegoat-Tiny-Coder" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "scrapegoat/Scrapegoat-Tiny-Coder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/scrapegoat/Scrapegoat-Tiny-Coder
- SGLang
How to use scrapegoat/Scrapegoat-Tiny-Coder with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "scrapegoat/Scrapegoat-Tiny-Coder" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "scrapegoat/Scrapegoat-Tiny-Coder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "scrapegoat/Scrapegoat-Tiny-Coder" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "scrapegoat/Scrapegoat-Tiny-Coder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use scrapegoat/Scrapegoat-Tiny-Coder with Docker Model Runner:
docker model run hf.co/scrapegoat/Scrapegoat-Tiny-Coder
File size: 15,005 Bytes
8a4a724 8ac4664 8a4a724 8ac4664 8a4a724 48db284 8a4a724 133540f 8a4a724 133540f 8a4a724 133540f 8a4a724 1002167 8a4a724 48db284 9663af1 52fe054 8a4a724 52fe054 8a4a724 97739bb 8a4a724 dbfbbc7 8a4a724 48db284 8a4a724 48db284 8a4a724 dbfbbc7 8a4a724 48db284 8a4a724 dbfbbc7 8a4a724 48db284 8a4a724 48db284 8a4a724 48db284 8a4a724 48db284 8a4a724 48db284 8a4a724 48db284 8a4a724 48db284 8a4a724 48db284 8a4a724 48db284 8a4a724 dbfbbc7 8a4a724 dbfbbc7 8a4a724 8ac4664 8a4a724 9364e36 9694513 9364e36 9694513 9364e36 232d5a0 9364e36 8a4a724 52fe054 8ac4664 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | ---
license: apache-2.0
tags:
- scrapegoat
- dual-track
- parallel-attention
- moe
- kda
- quantile-balancing
- transformers
library_name: transformers
pipeline_tag: text-generation
datasets:
- Glint-Research/Fable-5-traces
- armand0e/claude-fable-5-claude-code
- lordx64/agentic-distill-fable-5-sft
- HelioAI/Fable-5-Distill-Reasoning-462x
- >-
Manusagents/GPT-5.5-Gemini-3.1-Pro-Grok-4-Claude-Fable-5-Mythos-5-Qwen-3.7-Max-and-more-Distillation-Dataset
- greghavens/fable-5-coding-and-debugging-traces
- Mike0021/claude-kimi-k3-game-session
- gbeck/kimi-k3-coding-and-debugging-traces
---
<div align="center">
<h1 align="center">π ScrapeGoat</h1>
<p><strong>Parallel DualβTrack Transformer Architecture β’ 81 Layers β’ 825B Parameters</strong></p>
<p>
<strong>Track A (Left Brain β Analytical β StateβAware Code Generation)</strong><br>
<strong>Track B (Right Brain β Holistic β System Design)</strong><br>
<strong>= Unified Intelligence</strong>
</p>
<p>
<a href="https://opensource.org/licenses/Apache-2.0">
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License">
</a>
</p>
</div>
---

---
## π Overview
ScrapeGoat is a **parallel dual-track transformer** modeled after the human brain's hemispheric specialization β Track A (analytical **left brain**) for deep sequential reasoning via KDA recurrent attention, Track B (holistic **right brain**) for broad parallel processing via GQA. Both tracks run simultaneously at every layer, united by learned gating. This architecture is purpose-built for **humanoid embodied intelligence**, combining the precision needed for logic, motor planning, and sequential reasoning with the flexibility required for natural language, spatial awareness, and multimodal perception. The architecture is derived from ScrapeGoat's Agentic Modelling and DeepSeek's DSpark innovations, with custom modifications including KDA (Kimi Delta Attention), Quantile Balancing MoE, and Mixture-of-Memories (MoM).
In ScrapeGoat-Tiny-Coder context: detailed state aware code generation (Track A) and holistic system design (Track B).
### π§ Humanoid Brain Readiness
| Cognitive Function | Brain Analog | ScrapeGoat Implementation |
|--------------------|-------------|--------------------------|
| **Logical reasoning** | Left prefrontal cortex | Track A KDA β sequential, stateful token processing |
| **Pattern recognition** | Right temporal/parietal | Track B GQA β parallel multi-head attention |
| **Motor planning** | Motor cortex / basal ganglia | 704 MoE experts = cortical column specialization, 8 active per token |
| **Episodic memory** | Hippocampus | MoM-KDA β 4 memory states with learned routing |
| **Sensory integration** | Corpus callosum | Per-layer learned gating (`attn_track_gate`, `moe_track_gate`) blends tracks |
| **Long-context awareness** | Working memory | 262K token context window (RoPE ΞΈ=10,000) |
| **Real-time control** | Reflex arcs | Low-latency KDA recurrent inference (O(1) per token, no KV cache quadratic blowup) |
---
### Key Innovations
| Feature | Track A (Left Brain β Analytical) | Track B (Right Brain β Holistic)
|---------|---------|---------|
| **Attention** | 32 heads Γ 256 dim (KDA/GQA 3:1 interleaved) | 64 heads Γ 128 dim (GQA) |
| **Key-Value Heads** | 2 | 8 |
| **MoE Experts** | 512 fused | 192 stacked |
| **MoE Intermediate** | 1024 | 1536 |
| **Routing** | Quantile Balancing (QB) | Quantile Balancing (QB) |
| **Shared Expert** | β
Shared across both tracks |
## ποΈ Architecture
### Parallel Dual-Track Processing
Both tracks process every token in parallel at each of the 81 layers, with learned gating per layer for attention (`attn_track_gate`) and MoE (`moe_track_gate`):
| Layer 0 (Special) | Layers 1β80 |
|-|-|
| Track A: MoE only (no attn) | Track A: KDA attention + MoE |
| Track B: Attention + dense FFN (no MoE) | Track B: GQA attention + MoE |
### β‘ KDA (Kimi Delta Attention)
Recurrent linear attention with diagonal gating:
```
S_t = (I - Ξ²_t k_t k_t^T) Diag(Ξ±_t) S_{t-1} + Ξ²_t k_t v_t^T
```
- Supports recurrent (inference) and chunkwise (training) modes
- ShortConv preprocessing for Q/K/V projections (kernel=3)
- 3:1 KDA:GQA interleaving β 60 KDA layers + 21 GQA layers (every 4th: `kda_gqa_layers = [0,4,8,...,80]`)
- Per-head diagonal gating: `Ξ±_t = sigmoid(W_g Β· x_t)`, applied element-wise over the recurrence
- ShortConv (1D conv, kernel=3) preprocesses Q/K/V before the KDA recurrence for stability
### π― Quantile Balancing for MoE
Alternating quantile algorithm (J. Su) computes per-expert biases that equalize token assignment β entirely hyperparameter-free (no temperature, no aux loss).
```
Ξ² β 0
q = 1 - k/n
for _ in range(qb_iterations):
Ξ± = quantile(scores - Ξ², q, dim=1)
Ξ² = quantile(scores - Ξ±, q, dim=0)
bias = Ξ²
routing_weights = softmax(router_logits - bias, dim=-1)
```
8 experts selected per token across 512 (Track A) + 192 (Track B) experts.
### π Mixture-of-Memories (MoM-KDA)
- Multiple independent KDA memory states with learned routing
- Shared memory always active + top-k memory selection per token (`top_k = num_experts_per_tok = 8`)
- 4 memories total, 2 active per token selected via softmax over router logits
- MoM integrates with KDA recurrence β each memory state has its own KDA layer with independent shortconv Q/K/V projections
### π Block Attention Residuals (v2)
Softmax attention over layer depth β each layer attends over prior block representations via a learned pseudo-query.
```
block_size = num_hidden_layers // attn_res_blocks # 81 // 8 = 10
block_idx = layer_idx // block_size # which block this layer belongs to
q = pseudo_query (learned, [hidden_size])
keys = LayerNorm(block_reps) [num_blocks, hidden_size]
attn_weights = softmax(q Β· keys^T / sqrt(hidden_size))
depth_out = attn_weights @ block_reps [hidden_size]
hidden_states = hidden_states + depth_out (residual)
```
- `attn_residual=false` β disabled in this checkpoint, 8 blocks when enabled
- Activated at every layer but only reads from prior blocks' representations
- Provides long-range depth-wise communication across the 81 layers; stabilises training on deep MoE architectures
### π StableMoE Stage 1
- Progressive routing stabilisation: `router` weights are frozen (`requires_grad = False`) in stage 2, preventing expert collapse during continued pretraining/LoRA fine-tuning
- Reduces expert representation collapse during training
---
## π Model Specifications
| Parameter | Value |
|-----------|-------|
| **Parameters** | ~825B |
| **Hidden Size** | 4096 |
| **Layers** | 81 |
| **Vocab Size** | 248,320 (tiktoken BPE) |
| **Max Position** | 262,144 (RoPE ΞΈ=10,000) |
| **Track A Heads** | 32 (KV: 2, head dim: 256) |
| **Track A Experts** | 512 (intermediate: 1024) |
| **Track B Heads** | 64 (KV: 8, head dim: 128) |
| **Track B Experts** | 192 (intermediate: 1536) |
| **Track B Dense FFN** | 13312 (layer 0 only) |
| **Experts per Token** | 8 |
| **Activation** | SiLU |
| **Norm** | RMSNorm (Ξ΅=1e-6) |
| **MoM Memories** | 4 (top-2 active) |
| **StableMoE Stage** | 1 |
| **Attn Residual** | false (configurable, 8 blocks) |
| **Weight Format** | BF16 |
### Weights
83 shards Γ ~20 GB each = **~1.65 TB total** (BF16 safetensors). Will be stored in the repo itself as `scrapegoat-fp8/`.
#### Notable Weight Name Differences from Model Code
| Weight Prefix | Mapped To | Notes |
|---|---|---|
| `q_norm`, `k_norm` | Attention QK LayerNorm | Extra weights present in checkpoint, accepted via `strict=False` |
| `expert_bias` | Track B MoE expert bias | Same |
| `shared_expert.gate_proj` | Shared expert gate | Fused in checkpoint |
---
## π Quick Start
### Installation
```bash
pip install transformers accelerate safetensors
```
### Loading for Inference
```python
import sys
sys.path.insert(0, "/path/to/model/dir")
from configuration_scrapegoat import ScrapeGoatConfig
from modeling_scrapegoat import ScrapeGoatForCausalLM
from transformers import AutoTokenizer
import torch
model_dir = "/path/to/scrapegoat-weights"
tokenizer = AutoTokenizer.from_pretrained(model_dir, trust_remote_code=True)
model = ScrapeGoatForCausalLM.from_pretrained(
model_dir,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
```
### Tokenizer
ScrapeGoat uses the **tiktoken BPE tokenizer** (`tiktoken.model`). The vocabulary is 248,320 tokens (163,584 base BPE merges + 256 special/control tokens). It ships with the weights in the repo.
- **BPE on bytes** β lossless encoding of any Unicode/UTF-8, no OOV tokens
- **256 special token slots** for `[BOS]`, `[EOS]`, `[PAD]`, `[UNK]`, role markers, tool call tokens, media tokens, etc.
- **Default backend**: `GigaKimiTokenizer` β a HuggingFace-compatible wrapper around Gigatoken (~750Γ faster than native tiktoken)
**Special tokens:**
| Token | ID | Purpose |
|-------|----|---------|
| `[BOS]` | 163584 | Begin of sequence |
| `[EOS]` | 163585 | End of sequence |
| `[PAD]` | 163839 | Padding |
| `[UNK]` | 163838 | Unknown |
| `[EOT]` | 163593 | End of turn |
| `<\|im_end\|>` | 163586 | Chat message end |
| `<\|im_user\|>` | 163587 | User role marker |
| `<\|im_assistant\|>` | 163588 | Assistant role marker |
| `<\|im_system\|>` | 163594 | System role marker |
| `<\|tool_calls_section_begin\|>` | 163595 | Tool calls section |
| `<\|tool_call_begin\|>` | 163597 | Individual tool call |
| `<\|media_begin\|>` | 163602 | Media/vision content |
| `<think>` | 163606 | Reasoning section begin |
| `</think>` | 163607 | Reasoning section end |
### Optimiser: NorMuon
`optimiser/normuon.py` implements [NorMuon](https://github.com/KellerJordan/Muon), a Muon variant that orthogonalises weight updates via Newton-Schulz iteration and normalises update norms via a second-momentum running average. Available as `NorMuon` (distributed), `SingleDeviceNorMuon`, `NorMuonWithAuxAdam`, and `SingleDeviceNorMuonWithAuxAdam` for training resumption and continued pretraining. See `README.md` in the repo root for usage.
### Training (SFT with DeepSpeed ZeRO-3)
Due to the 1.65 TB model size, training requires NVMe offloading. See `train_scrapegoat_sft.py` in the `Training/` directory for the SFT script (DeepSpeed ZeRO-3, LoRA).
Key config: DeepSpeed ZeRO-3 with `offload_param` and `offload_optimizer` to CPU, `train_micro_batch_size_per_gpu=1`, `gradient_accumulation_steps=8`.
---
## π§ Configuration
```python
from configuration_scrapegoat import ScrapeGoatConfig
config = ScrapeGoatConfig.from_pretrained("/path/to/model")
# Track A
config.track_a_num_attention_heads # 32
config.track_a_num_key_value_heads # 2
config.track_a_head_dim # 256
config.track_a_num_experts # 512
config.track_a_moe_intermediate_size # 1024
# Track B
config.track_b_num_attention_heads # 64
config.track_b_num_key_value_heads # 8
config.track_b_head_dim # 128
config.track_b_num_experts # 192
config.track_b_moe_intermediate_size # 1536
# Attention
config.kda_gqa_layers # [0,4,8,12,...,80] (every 4th = GQA)
config.kda_conv_kernel # 3
config.attn_residual # false (configurable, 8 blocks)
# MoE
config.quantile_balancing # True
config.qb_iterations # 5
config.num_experts_per_tok # 8
config.stable_moe_stage # 1
config.stable_moe_r3 # False
config.stable_moe_r3_cache # True
# MoM-KDA
config.mom_enabled # True
config.mom_num_memories # 4
config.mom_active_memories # 2
config.mom_shared_memory # True
# DSpark
config.dspark_block_size # 6
config.dspark_markov_rank # 256
config.dspark_noise_token_id # 0
config.dspark_target_layer_ids # [] (empty = apply to all layers)
config.output_router_logits # false (also returns router_logits in model output when enabled)
```
---
## π οΈ Hardware Requirements
| Setup | VRAM/RAM | Notes |
|-------|----------|-------|
| **Inference (BF16)** | ~1.65 TB | Multi-GPU cluster (e.g., 24ΓH100 80GB) |
| **Inference (4-bit)** | ~412 GB | 5+ H100 80GB |
| **QLoRA SFT** | ~180GB RAM + 750GB NVMe | ZeRO-3 + NVMe offload (single H100) |
| **Full Training** | Multi-node cluster | 1.65 TB+ |
---
## π Citation
```bibtex
@misc{scrapegoat2026,
title={ScrapeGoat: Parallel Dual-Track Transformer with KDA and Quantile Balancing},
author={ScrapeGoat Team},
year={2026},
}
```
## Coding Agent Framework
The most powerful AI coding agent on planet Earth is now a self-learning model agnostic harness.
/fast mode and more advanced skills enabled only with scrapegoat models
/graph - indexes your repo locally and auto-injects repo context. Excoder is always code aware.
/Agent-WebBridge - Browser automation via Agent-WebBridge-skill and Agent-WebBridge for QA automation and Browser Autonomy.
/dispatching-parallel-agents - To dispatch Swarm of agents for parallel work.
Team | Enterprise: run excoder, pick a username on first launch, then use /message @teammate to chat with org members in real time with secure encrypted messaging.
/redteam-skill & /pentest-skill for offensive and advanced cyber security capabilities.
- Application Security Testing β Detect and validate critical vulnerabilities in your applications
- Rapid Penetration Testing β Get penetration tests done in hours, not weeks, with compliance reports
- Bug Bounty Automation β Automate bug bounty research and generate PoCs for faster reporting
- CI/CD Integration β Run tests in CI/CD to block vulnerabilities before reaching production
- πΈοΈ Web apps | Black-box, external-attacker recon β exploit (XBEN suite) | β
- π© CTF | Hint-free, sandbox-jailed solves (Cybench) | β
- π€ Robotics / OT / embedded | Coordinated-disclosure pipeline for OSS vuln hunting (OSV + live-PoC + refuter) | β
- π Source code | White-box repo analysis with blind master-builder decomposition
- π° Smart contracts | Damn Vulnerable DeFi | β οΈ reproduction
- βοΈ Cloud (IaC) | Misconfig-detection benchmark (`cloud:bench`) + opt-in cloud arsenal | π§ IaC-misconfig scaffolding β live-cloud exploitation
- π± Mobile | Built-in static analyzer (manifest misconfig + secret/cleartext detection, `mobile:bench`) + opt-in arsenal (mobsfscan/objection/drozer; frida gated)
- π© Binary / RE | Decompiled-output sink detector (unsafe-copy / format-string / cmd-injection / int-overflow, `binary:bench`)
[](https://excoder.pro)
---
<div align="center">
<strong>Left brain β’ Right brain β’ One mind. π</strong>
</div> |