Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -12,10 +12,8 @@ license: mit
|
|
| 12 |
library_name: smart-tree
|
| 13 |
---
|
| 14 |
|
| 15 |
-
# smart-tree — Ternary Inference Engine
|
| 16 |
-
|
| 17 |
🚀 **Production-ready binary for BitNet 1.58-bit / GGUF I2_S (type 36) inference with SIMD acceleration**
|
| 18 |
-
|
| 19 |
## Overview
|
| 20 |
|
| 21 |
`smart-tree` is a standalone CLI and library for ultra-low-precision neural network inference. Designed specifically for **ternary weights ({-1, 0, +1})** encoded in GGUF's `I2_S` format (quantization type 36).
|
|
@@ -72,18 +70,6 @@ cd smart-tree && cargo build --release
|
|
| 72 |
./st gguf inspect --file falcon3-3b-i2s.gguf --verbose
|
| 73 |
```
|
| 74 |
|
| 75 |
-
### Mixed-Precision Profiling (Experiment 5)
|
| 76 |
-
```bash
|
| 77 |
-
# Profile a GGUF model
|
| 78 |
-
./st profile --model model.gguf --samples 128 --max-seq-len 512
|
| 79 |
-
|
| 80 |
-
# Export Pareto frontier as JSON
|
| 81 |
-
./st profile --model model.gguf --output json --out pareto.json
|
| 82 |
-
|
| 83 |
-
# CSV for spreadsheet analysis
|
| 84 |
-
./st profile --model model.gguf --output csv --out layers.csv
|
| 85 |
-
```
|
| 86 |
-
|
| 87 |
## Technical Details
|
| 88 |
|
| 89 |
### I2_S Encoding (GGUF Type 36)
|
|
@@ -147,36 +133,6 @@ let out_val = simd_ternary_row_i2s(&row_weights_i2s, &activations, scale);
|
|
| 147 |
- **Prefetch hints** for sequential layer traversal
|
| 148 |
- **Exact integer arithmetic** throughout (no FP in hot path)
|
| 149 |
|
| 150 |
-
## NEW: Mixed-Precision Profiler (Experiment 5)
|
| 151 |
-
|
| 152 |
-
Layer-wise sensitivity analysis for optimal ternary quantization decisions:
|
| 153 |
-
|
| 154 |
-
```bash
|
| 155 |
-
# Profile a GGUF model
|
| 156 |
-
./st profile --model model.gguf --samples 128 --max-seq-len 512
|
| 157 |
-
|
| 158 |
-
# Export Pareto frontier as JSON
|
| 159 |
-
./st profile --model model.gguf --output json --out pareto.json
|
| 160 |
-
|
| 161 |
-
# CSV for spreadsheet analysis
|
| 162 |
-
./st profile --model model.gguf --output csv --out layers.csv
|
| 163 |
-
```
|
| 164 |
-
|
| 165 |
-
### Algorithm
|
| 166 |
-
1. **Calibration**: Run representative inputs through the model
|
| 167 |
-
2. **Activation Collection**: Capture post-residual activations per layer
|
| 168 |
-
3. **Perturbation Analysis**: Simulate quantization at multiple bit-widths (2, 3, 4, 8...)
|
| 169 |
-
4. **Sensitivity Metrics**: Cosine similarity, KL-divergence, Signal-to-Noise Ratio
|
| 170 |
-
5. **Composite Ranking**: Aggregate metrics into per-layer sensitivity score
|
| 171 |
-
6. **Pareto Frontier**: Greedy assignment finds optimal accuracy-vs-bits tradeoffs
|
| 172 |
-
|
| 173 |
-
### Output
|
| 174 |
-
- **Human-readable table**: Top-K most sensitive layers with slopes
|
| 175 |
-
- **JSON**: Full per-layer, per-bit-width metrics for downstream tools
|
| 176 |
-
- **CSV**: Spreadsheet-ready layer rankings with all metrics
|
| 177 |
-
|
| 178 |
-
Enables mixed-precision quantization: keep sensitive layers at higher precision, aggressively compress robust layers.
|
| 179 |
-
|
| 180 |
## Integration
|
| 181 |
|
| 182 |
### As Rust Dependency
|
|
@@ -209,8 +165,29 @@ All cores validated:
|
|
| 209 |
cargo test --lib ternary_bridge # 7 tests - lossless bridges
|
| 210 |
cargo test --lib gguf_interop # 10 tests - GGUF I2_S roundtrips
|
| 211 |
cargo test --lib simd_ternary # 5 tests - SIMD GEMM correctness
|
| 212 |
-
cargo test --lib profiler # 16 tests - sensitivity metrics & pipeline
|
| 213 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
|
| 215 |
## Related Work
|
| 216 |
|
|
@@ -225,4 +202,4 @@ MIT OR Apache-2.0
|
|
| 225 |
|
| 226 |
---
|
| 227 |
|
| 228 |
-
Part of the [**eightb**](https://huggingface.co/eightb) ecosystem.
|
|
|
|
| 12 |
library_name: smart-tree
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# smart-tree v25.0.0 — Ternary Inference Engine
|
|
|
|
| 16 |
🚀 **Production-ready binary for BitNet 1.58-bit / GGUF I2_S (type 36) inference with SIMD acceleration**
|
|
|
|
| 17 |
## Overview
|
| 18 |
|
| 19 |
`smart-tree` is a standalone CLI and library for ultra-low-precision neural network inference. Designed specifically for **ternary weights ({-1, 0, +1})** encoded in GGUF's `I2_S` format (quantization type 36).
|
|
|
|
| 70 |
./st gguf inspect --file falcon3-3b-i2s.gguf --verbose
|
| 71 |
```
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
## Technical Details
|
| 74 |
|
| 75 |
### I2_S Encoding (GGUF Type 36)
|
|
|
|
| 133 |
- **Prefetch hints** for sequential layer traversal
|
| 134 |
- **Exact integer arithmetic** throughout (no FP in hot path)
|
| 135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
## Integration
|
| 137 |
|
| 138 |
### As Rust Dependency
|
|
|
|
| 165 |
cargo test --lib ternary_bridge # 7 tests - lossless bridges
|
| 166 |
cargo test --lib gguf_interop # 10 tests - GGUF I2_S roundtrips
|
| 167 |
cargo test --lib simd_ternary # 5 tests - SIMD GEMM correctness
|
|
|
|
| 168 |
```
|
| 169 |
+
## NEW: Mixed-Precision Profiler (Experiment 5)
|
| 170 |
+
Layer-wise sensitivity analysis for optimal ternary quantization decisions:
|
| 171 |
+
```bash
|
| 172 |
+
# Profile a GGUF model
|
| 173 |
+
./st profile --model model.gguf --samples 128 --max-seq-len 512
|
| 174 |
+
# Export Pareto frontier as JSON
|
| 175 |
+
./st profile --model model.gguf --output json --out pareto.json
|
| 176 |
+
# CSV for spreadsheet analysis
|
| 177 |
+
./st profile --model model.gguf --output csv --out layers.csv
|
| 178 |
+
```
|
| 179 |
+
Algorithm:
|
| 180 |
+
1. **Calibration**: Run representative inputs through the model
|
| 181 |
+
2. **Activation Collection**: Capture post-residual activations per layer
|
| 182 |
+
3. **Perturbation Analysis**: Simulate quantization at multiple bit-widths (2, 3, 4, 8...)
|
| 183 |
+
4. **Sensitivity Metrics**: Cosine similarity, KL-divergence, Signal-to-Noise Ratio
|
| 184 |
+
5. **Composite Ranking**: Aggregate metrics into per-layer sensitivity score
|
| 185 |
+
6. **Pareto Frontier**: Greedy assignment finds optimal accuracy-vs-bits tradeoffs
|
| 186 |
+
Output:
|
| 187 |
+
* **Human-readable table**: Top-K most sensitive layers with slopes
|
| 188 |
+
* **JSON**: Full per-layer, per-bit-width metrics for downstream tools
|
| 189 |
+
* **CSV**: Spreadsheet-ready layer rankings with all metrics
|
| 190 |
+
Enables mixed-precision quantization: keep sensitive layers at higher precision, aggressively compress robust layers.
|
| 191 |
|
| 192 |
## Related Work
|
| 193 |
|
|
|
|
| 202 |
|
| 203 |
---
|
| 204 |
|
| 205 |
+
Part of the [**eightb**](https://huggingface.co/eightb) ecosystem.
|