Text Generation
MLX
Safetensors
English
Hungarian
bitnet
b1.58
ternary
quantization
apple-silicon
llm
sovereign
constellation
Instructions to use PeetPedro/quantal-ternary with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use PeetPedro/quantal-ternary with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("PeetPedro/quantal-ternary") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use PeetPedro/quantal-ternary with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "PeetPedro/quantal-ternary" --prompt "Once upon a time"
- Atomic Chat
card: thresholded-ternary best 2.1469 (per-group scale, zero state)
Browse files
README.md
CHANGED
|
@@ -39,25 +39,32 @@ Rust.
|
|
| 39 |
| Matrices | 168 ayeOS per-layer files (`m000.json` … `m167.json`) |
|
| 40 |
| Runtime assets | `embeddings.f16` `[151936, 896]`, `norms.f32` `[49, 896]` |
|
| 41 |
| Training | continued-train, masked CE, deployed-forward QAT |
|
| 42 |
-
| Validation (masked, n=90) | **
|
| 43 |
-
| Checkpoint sha256 | `
|
| 44 |
|
| 45 |
## Training
|
| 46 |
|
| 47 |
-
- **Data**:
|
| 48 |
c3), stratified 90-sample held-out val.
|
| 49 |
- **Loss**: masked cross-entropy — pad tokens (id 0) weighted out, honest mean
|
| 50 |
over valid tokens. Dynamic per-batch padding bucketed to multiples of 64.
|
| 51 |
-
- **Optimizer**: AdamW, weight decay 0.1, grad clip off, lr
|
| 52 |
-
|
| 53 |
-
- **Hardware**: vast.ai
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
- **Forward**: deployed-forward QAT — the exact forward the Rust runner uses
|
| 55 |
(weight-quant-only BitLinear, per-projection RMSNorm + activation quant
|
| 56 |
skipped), so training ≡ inference. The Rust runner reproduces the forward
|
| 57 |
-
to **
|
| 58 |
-
- **Val trajectory** (
|
| 59 |
-
|
| 60 |
-
samples, L40), 3.2862 (2,785, 3090); the old artifact
|
|
|
|
| 61 |
|
| 62 |
## Layout
|
| 63 |
|
|
|
|
| 39 |
| Matrices | 168 ayeOS per-layer files (`m000.json` … `m167.json`) |
|
| 40 |
| Runtime assets | `embeddings.f16` `[151936, 896]`, `norms.f32` `[49, 896]` |
|
| 41 |
| Training | continued-train, masked CE, deployed-forward QAT |
|
| 42 |
+
| Validation (masked, n=90) | **2.1469** |
|
| 43 |
+
| Checkpoint sha256 | `21294c68...8285` (best, epoch 2 / early stop) |
|
| 44 |
|
| 45 |
## Training
|
| 46 |
|
| 47 |
+
- **Data**: 20,007 text samples (konstellation corpus: kompress + domain +
|
| 48 |
c3), stratified 90-sample held-out val.
|
| 49 |
- **Loss**: masked cross-entropy — pad tokens (id 0) weighted out, honest mean
|
| 50 |
over valid tokens. Dynamic per-batch padding bucketed to multiples of 64.
|
| 51 |
+
- **Optimizer**: AdamW, weight decay 0.1, grad clip off, lr 3e-4 → cosine →
|
| 52 |
+
3e-5 (2% warmup), early stop patience 5 / min-delta 0.02, 40-epoch cap.
|
| 53 |
+
- **Hardware**: vast.ai RTX PRO 6000 (96 GB) — the nightly run, B12/256,
|
| 54 |
+
20,007 samples. `MLX_CUDA_GRAPH_CACHE_SIZE=2000`.
|
| 55 |
+
- **Quantizer**: true thresholded ternary — `weight_quant` uses a per-group
|
| 56 |
+
(64) scale and a real zero state (`|w| < 0.5·scale → 0`), so ~30% of the
|
| 57 |
+
weights land on zero. The old sign-based collapse wasted the third state;
|
| 58 |
+
this one earns it. Training forward ≡ export ≡ Rust (per-group scale, same
|
| 59 |
+
dequant `(code−1)·scale`).
|
| 60 |
- **Forward**: deployed-forward QAT — the exact forward the Rust runner uses
|
| 61 |
(weight-quant-only BitLinear, per-projection RMSNorm + activation quant
|
| 62 |
skipped), so training ≡ inference. The Rust runner reproduces the forward
|
| 63 |
+
to **1.3e-5** (golden-logits gate, both prompts, identical argmax 71703).
|
| 64 |
+
- **Val trajectory** (nightly run): 2.38 → **2.1469** (epoch 2, best) → 2.25
|
| 65 |
+
→ 2.49 → 2.72 → 2.76 → 3.07 (overfit after epoch 2; early stop). Prior
|
| 66 |
+
runs: 1.6998 (7,000 samples, L40), 3.2862 (2,785, 3090); the old artifact
|
| 67 |
+
measured 11.34.
|
| 68 |
|
| 69 |
## Layout
|
| 70 |
|