Ergo-TFQ-3.00 / README.md
ashxhart's picture
Update README to clean TFQ X.XX naming
9431623 verified
|
Raw History Blame Contribute Delete
8.62 kB
---
license: other
license_name: amazon-ergo-open-weight-license
license_link: LICENSE.md
base_model: Amazon-FMR/Ergo-bf16
base_model_relation: quantized
pipeline_tag: text-generation
language:
- en
tags:
- tensorfold
- tfq
- tfp6
- tfq-3.00
- quantized
- moe
- coding
- conversational
- apple-silicon
- cuda
- vulkan
inference: false
---
<p align="center">
<img src="assets/amazon-logo.png" alt="Amazon" width="110" />
</p>
<h1 align="center">Amazon Ergo — TFQ 3.00</h1>
<p align="center">
<a href="https://huggingface.co/Amazon-FMR/Ergo-bf16">Base BF16 (2.2 TB)</a> |
<a href="https://huggingface.co/Amazon-FMR/Ergo">Official MXFP4 (583 GiB)</a> |
<a href="https://www.aboutamazon.com/amazon-ergo">Amazon Launch Blog</a> |
<a href="https://github.com/ashhart/TensorFold">TensorFold</a> |
<a href="https://github.com/ashhart/TFQ">TFQ</a> |
<a href="LICENSE.md">License</a>
</p>
<p align="center">
<img src="https://img.shields.io/badge/Memory_Fit-426.4_GiB_(Fits_512GB_Unified_%2F_8x80GB)-0f766e" alt="Fits 512GB Unified / 8x80GB" />
<img src="https://img.shields.io/badge/Size-426.4_GiB_(5.15x_smaller)-0f766e" alt="Size 426.4 GiB" />
<img src="https://img.shields.io/badge/Format-TFQ_TFP6_v6_(Zero--LUT_INT8_A8)-2563eb" alt="TFQ TFP6 v6" />
<img src="https://img.shields.io/badge/Held--Out_KL-0.0330_(A8)-7c3aed" alt="KL 0.0330" />
<img src="https://img.shields.io/badge/Top--1_Agree-95.82%25-16a34a" alt="Top-1 95.82%" />
<img src="https://img.shields.io/badge/Shards-63%2F63_XXH64_Verified-15803d" alt="63/63 Verified" />
</p>
**`Ergo-TFQ-3.00`** is a **426.4 GiB** TensorFold Quantization (**TFQ**, **`TFP6 v6`** zero-LUT pure-ALU native signed-`int8` with `FLAG_A8_HADAMARD`) checkpoint of [**Amazon Ergo**](https://huggingface.co/Amazon-FMR/Ergo-bf16) (1.1T total parameters, 55B active parameters, 64 layers, 256 routed experts + shared expert, 1M context window), quantized directly from the native **BF16** weights (`Amazon-FMR/Ergo-bf16`, 2.2 TB) at **3.00 bits per weight** average on routed MoE experts while keeping all non-MoE tensors untouched in native BF16/F32.
At **426.38 GiB** — **5.15× smaller** than BF16 and **156.7 GiB (`26.9%`) smaller** than Amazon's official 583.1 GiB MXFP4 release — `Ergo-TFQ-3.00` fits comfortably on a single **512 GB unified-memory workstation** with ~85 GiB left for KV cache, while **beating Amazon's official 583.1 GiB MXFP4** on **Math KL (`-30.3%`)**, **Chat KL (`-22.4%`)**, and **Top-1 agreement across Code (`98.27%`), Math (`96.97%`), and Chat (`95.23%`)**.
> **Hardware & VRAM Fit (Fits Single 512 GB Unified Workstation / 8×80 GB Node)**
> - **Total Memory Required:** **`426.38 GiB`** (`457.82 GB`: `378.84 GiB` `TFP6 v6` MoE + `47.50 GiB` untouched BF16/F32 non-MoE + `36.5 MiB` tokenizer/config) — **5.15× smaller** than BF16 (`2.2 TB`) and **156.7 GiB smaller** than official MXFP4 (`583.1 GiB`).
> - **Single-Box Unified Memory:** Fits a single **512 GB Apple Silicon / unified-memory workstation** with **`~85 GiB`** free for long-context KV cache.
> - **Multi-GPU Servers:** Fits **`6×80 GB` / `8×80 GB` (H100 / A100)** or **`3×192 GB` / `4×192 GB` (MI300X / B200)** with large KV cache headroom.
| Hardware Target | Memory Footprint | Notes |
|---|---:|---|
| **512 GB Apple Silicon / Unified RAM** | **`426.38 GiB`** | Runs 1.1T Ergo on a single desktop workstation with `~85 GiB` free for KV cache |
| **8×80 GB GPU Node (H100 / A100)** | **`426.38 GiB` VRAM** | `~53.3 GiB/GPU` across 8 GPUs (`~213 GiB` total free VRAM for long-context KV) |
| **3×–4×192 GB GPU Node (B200 / MI300X)** | **`426.38 GiB` VRAM** | `~107–142 GiB/GPU` with huge batch & 1M-context headroom |
## Highlights
- **Format:** **`TFP6 v6`** zero-LUT pure-ALU native signed-`int8` trellis (`FLAG_A8_HADAMARD`) — eliminates all lookup tables (`pw_v5_tables.bin` removed) for native INT8 tensor-core / Metal 4 / CUDA / Vulkan acceleration.
- **Size:** `426.38 GiB` (`457.82 GB`) total on disk (`378.84 GiB` quantized routed MoE shards + `47.50 GiB` untouched BF16/F32 embeddings, attention, norms, dense Layer 0, routers, shared experts, and `lm_head`).
- **Method:** Calibrated sequential per-expert **Hessian-LDLQ-H** with tempered ReLU²-Jacobian MCKP mixed-precision rate allocation (`2.0–5.0 bpw` per tensor; edge layers `L01` & `L63` protected at `3.50 bpw`, interior layers `L02..L62` at `2.984 bpw` → `3.000 bpw` average), post-quantization Stage-2 `H_down` propagation from quantized Stage-1 `up_proj`, and Hessian-weighted 2-pass coordinate polish (`--polish --polish-su --polish-sv --share-su-groups --a8`).
- **Calibration:** `393,216` tokens (`384 × 1024`) across prose, code, math, and chat, strictly disjoint from the held-out evaluation set. Calibration-probe routed layer `out_SNR` ranges from `28.15 dB` (`L34`, relRMSE `0.0391`) to `44.18 dB` (`L01`, relRMSE `0.0062`).
- **Integrity:** All 63 MoE shards (`moe_L01.tffp6` .. `moe_L63.tffp6`, `512` routed tensors each) verified `63/63 OK [A8] [XXH64 verified]` via `tfq3-inspect`.
## Evaluation (Exact 262,144-Vocab FP64 Held-Out KL)
Evaluated over **65,472 strictly held-out prediction tokens** (`64 × 1024`, `16,368` tokens per domain, zero document overlap with calibration) across four domains (WikiText-2 test prose, Python code instructions, GSM8K test math, and UltraChat-200k test chat), comparing exact full 262,144-vocabulary FP64 log-probabilities directly against **`Amazon-FMR/Ergo-bf16` Gold** and **Amazon's official MXFP4 (`Amazon-FMR/Ergo`)**:
| Model | Disk Size | Fits 512 GB? | Overall KL (`gold \|\| cand`) | Rev-KL | Overall Top-1 | Overall Top-5 | Overall PPL | ΔPPL vs BF16 |
|---|---:|:---:|---:|---:|---:|---:|---:|---:|
| **`Amazon-FMR/Ergo-bf16`** (Gold) | `2,200 GiB` | No | `0.000000` | `0.000000` | `100.00%` | `100.00%` | `2.94176` | — |
| **`Amazon-FMR/Ergo`** (Official MXFP4) | `583.1 GiB` | No | `0.027034` | `0.028429` | `95.868%` | `99.881%` | `2.95855` | `+0.571%` |
| **`TensorFold/Ergo-TFQ-3.00`** (`TFP6 A8`, normative) | **`426.38 GiB`** | **Yes** | `0.033043` | `0.040052` | `95.821%` | `99.855%` | `2.99472` | `+1.800%` |
| **`TensorFold/Ergo-TFQ-3.00`** (`TFP6 A16`, ref) | **`426.38 GiB`** | **Yes** | `0.032859` | `0.040375` | `95.749%` | `99.869%` | `2.99175` | `+1.699%` |
*`TFP6 A8` (`FLAG_A8_HADAMARD`) matches `TFP6 A16` within `+0.000183` overall KL and achieves +47 higher Top-1 matches (`62,736` vs `62,689`).*
### Per-Domain Breakdown vs `Amazon-FMR/Ergo-bf16` Gold (`TFP6 A8` Normative)
| Domain | Metric | `Ergo-TFQ-3.00` (`426.38 GiB`) | Official MXFP4 (`583.1 GiB`) | Gold BF16 |
|---|---|---:|---:|---:|
| **Code** | KL / Top-1 / PPL | `0.008625` / **`98.27%`** / `2.4884` (`+0.25%`) | **`0.008528`** / `97.89%` / `2.4791` | `2.4821` |
| **Math** | KL / Top-1 / PPL | **`0.018054` / `96.97%` / `2.3359`** (`+0.61%`) | `0.025894` / `96.13%` / `2.3418` | `2.3217` |
| **Chat** | KL / Top-1 / PPL | **`0.028630` / `95.23%` / `5.0610`** (`+0.08%`) | `0.036908` / `94.32%` / `5.0424` | `5.0567` |
| **Prose** | KL / Top-1 / PPL | `0.076862` / `92.81%` / `2.7341` (`+6.39%`) | **`0.036808` / `95.13%` / `2.6172`** | `2.5699` |
*Note: Tempered MCKP rate allocation prioritizes high-leverage coding, math, and chat experts (delivering `-30.3%` lower Math KL and `-22.4%` lower Chat KL than 583.1 GiB MXFP4), while rare WikiText-2 prose experts take lower rates (`2.0–2.5 bpw`), accounting for the `+6.39%` prose PPL delta (`+6.22%` in A16).*
## Checkpoint Layout
- `nonmoe-00001-of-00011.safetensors` .. `nonmoe-00011-of-00011.safetensors` + `model.safetensors.index.json`: All `1,023` untouched non-routed BF16/F32 tensors (`47.502 GiB`) — token embeddings (F32), Layer 0 dense FFN, GQA attention + QK-norm, residual scales, router weights & biases, shared experts, and output head.
- `moe_L01.tffp6` .. `moe_L63.tffp6`: `63` `TFP6 v6` (`FLAG_A8_HADAMARD`) MoE shards (`7.014 GiB` for edge layers `L01`/`L63`, `5.981 GiB` for `L02..L62`; `378.841 GiB` total) containing all `32,256` routed expert matrices (`256` experts × `up_proj`/`down_proj` × `63` layers).
- Tokenizer & configuration files copied verbatim from `Amazon-FMR/Ergo-bf16`.
## Running with TensorFold
```bash
tensorfold serve TensorFold/Ergo-TFQ-3.00
```
Supported across Apple Silicon (Metal), NVIDIA GPUs (CUDA), and Vulkan backends in [TensorFold](https://github.com/ashhart/TensorFold), with open-source quantization tools in [TFQ](https://github.com/ashhart/TFQ).
## License
This quantized checkpoint inherits the [Amazon Ergo Open Weight License](LICENSE.md) from `Amazon-FMR/Ergo-bf16`.