Publish unified PFlash v3 weights (segment-probe, request-probe, seg-scoring-head, pflash_seg_reranker)
Browse files- .gitattributes +4 -0
- README.md +149 -0
- pflash_seg_reranker.gguf +3 -0
- request-probe.gguf +3 -0
- seg-scoring-head.gguf +3 -0
- segment-probe.gguf +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
segment-probe.gguf filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
request-probe.gguf filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
seg-scoring-head.gguf filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
pflash_seg_reranker.gguf filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- lucebox
|
| 7 |
+
- pflash
|
| 8 |
+
- prefill-compression
|
| 9 |
+
- gguf
|
| 10 |
+
- qwen3.5
|
| 11 |
+
base_model: Qwen/Qwen3.5-0.8B
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# PFlash
|
| 15 |
+
|
| 16 |
+
PFlash is Lucebox's prefill compression stack for long prompts and agentic sessions.
|
| 17 |
+
|
| 18 |
+
A small drafter ([`Qwen3.5-0.8B`](https://huggingface.co/unsloth/Qwen3.5-0.8B-GGUF)) reads the prompt once, and
|
| 19 |
+
four lightweight components on its activations decide what the large reader model prefills:
|
| 20 |
+
|
| 21 |
+
1. **Segment probe** (`segment-probe.gguf`) cuts the prompt into whole structural units (statements and
|
| 22 |
+
definitions, sentences, records, chat turns, tool calls) and emits container boundary probabilities;
|
| 23 |
+
2. **Request probe** (`request-probe.gguf`) finds which tokens carry the user's request, wherever it sits in
|
| 24 |
+
the prompt;
|
| 25 |
+
3. **Stage-1 scoring head** (`seg-scoring-head.gguf`) computes calibrated query→context attention density and
|
| 26 |
+
L2-normalized per-segment key centroids (`k_bar`);
|
| 27 |
+
4. **Bidirectional segment reranker** (`pflash_seg_reranker.gguf`) refines segment relevance with full
|
| 28 |
+
cross-segment context (`~4.1 ms` on GPU) and drives PFlash v3's one-sided adaptive keep-ratio safety net.
|
| 29 |
+
|
| 30 |
+
All Stage-1 signals read the same tap — the drafter's block-14 residual (`post_block14_residual_before_block15`)
|
| 31 |
+
— from the same single forward pass. The highest-ranked units that fit the budget go to the reader in their
|
| 32 |
+
original order, plus the pinned request.
|
| 33 |
+
|
| 34 |
+
## Files
|
| 35 |
+
|
| 36 |
+
| file | component | architecture / schema | sha256 | size |
|
| 37 |
+
|---|---|---|---|---:|
|
| 38 |
+
| `segment-probe.gguf` | Segment probe | `segmentprobe` (`qwen3_5_0_8b_segment_probe_v2`, ~263K params) | `470b7b0efe3736518dcb4c1ba8eb5b806107007e378a74668c17e26434602e68` | 1,062,976 bytes |
|
| 39 |
+
| `request-probe.gguf` | Request probe | `requestprobe` (`qwen3_5_0_8b_request_probe_v1`, ~265K params) | `5915557d4b60f5a08c8ef18fdd7a30cba56c3a24fda1c2b988da4a41313ebf49` | 1,060,192 bytes |
|
| 40 |
+
| `seg-scoring-head.gguf` | Stage-1 scoring head | `pflash_scoring_head` (`qwen3_5_0_8b_nope_qk_mass_v1`, 2.62M params) | `95e13076bff5c9b204c615366dfe08dbfa56aaa0bb417ff3dbf7d09c5906c1d6` | 10,486,400 bytes |
|
| 41 |
+
| `pflash_seg_reranker.gguf` | Bidirectional segment reranker | `pflash_seg_reranker` (`pflash_seg_reranker_v1`, 3L/384d/6H `kbar`) | `85bcecce88f2c8bad0888b3325426e2ad61858d4a8eec43fd04ac3a5aa0c9190` | 23,439,808 bytes |
|
| 42 |
+
|
| 43 |
+
- **Drafter** (required, verified by sha256 at load):
|
| 44 |
+
[`unsloth/Qwen3.5-0.8B-GGUF`](https://huggingface.co/unsloth/Qwen3.5-0.8B-GGUF) `Qwen3.5-0.8B-BF16.gguf`,
|
| 45 |
+
sha256 `cedf89af31c9041b601fa58303285bc46d99c51baee1b13f5e919626ca526ee5`. Each component refuses to load
|
| 46 |
+
against any other drafter file.
|
| 47 |
+
|
| 48 |
+
## How it works
|
| 49 |
+
|
| 50 |
+
- **Segment probe (`segment-probe.gguf`)**: LayerNorm(1024) → Linear(1024, 256) → GELU → three 5-tap Conv1d +
|
| 51 |
+
residual heads emitting per-token `unit`, `container`, and `sub-unit` logits. Cuts at unit threshold `0.8`
|
| 52 |
+
with `min_segment=32`, `max_segment=512`, and line-aligned oversize splitting preferring sub-unit starts.
|
| 53 |
+
Container probabilities feed directly into the segment reranker as left/right boundary features.
|
| 54 |
+
- **Request probe (`request-probe.gguf`)**: LayerNorm(1024) → Linear(1024, 256) → GELU (erf) → Linear(256, 1).
|
| 55 |
+
Locates the user's request inside long pastes, RAG prompts, or multi-turn chats and pins top-ranked request
|
| 56 |
+
units verbatim (up to 512 tokens). On autonomous tool turns and Lucebox Mix switches, active tool observations
|
| 57 |
+
are promoted as the query role so earlier regions are ranked and recalled against the live observation.
|
| 58 |
+
- **Stage-1 scoring head (`seg-scoring-head.gguf`)**: Two projection matrices (`attn_q` `[1024, 2048]`, `attn_k`
|
| 59 |
+
`[1024, 512]`) computing NoPE query→context attention mass density per unit plus L2-normalized key centroids
|
| 60 |
+
(`k_bar`). Calibrated Stage-1 `.lift` is preserved separately for recall gating (`PFLASH_RECALL_GATE`).
|
| 61 |
+
- **Bidirectional segment reranker (`pflash_seg_reranker.gguf`)**: 3-layer bidirectional Transformer encoder
|
| 62 |
+
(`d_model=384`, `n_heads=6`, `head_dim=64`, `d_ff=1024` SwiGLU, Pre-RMSNorm, 1D segment-index NeoX RoPE with
|
| 63 |
+
`theta=10000`, no causal mask) over all segments (`N_seg ~ 200–1500`). Consumes `k_bar` (`512`), pooled
|
| 64 |
+
`q_bar` (`512`), multiplicative interaction `W_int(k_d * q_d)`, and 12 per-segment scalars (z-scored density,
|
| 65 |
+
relative density, mass, max, top-4, peak ratio, length, position, left/right container probabilities, and
|
| 66 |
+
left/right adjacent segment key cosine similarity `adj_kcos`), emitting a zero-initialized residual delta on
|
| 67 |
+
Stage-1 `log_density`.
|
| 68 |
+
- **One-sided adaptive keep-ratio safety net**: Computed in `<0.1 ms` from the reranker's optional-segment
|
| 69 |
+
log-scores via sink-free token-level perplexity fraction `eff = exp(H_tok) / N_opt`:
|
| 70 |
+
- `eff < 0.42` (sharp/targeted query): untouched V3 base curve for maximum speedup;
|
| 71 |
+
- `0.42 <= eff < 0.58` (broad/multi-file query): monotonically widens keep ratio to `max(curve, eff)`;
|
| 72 |
+
- `eff >= 0.58` (diffuse/global query, e.g. whole-repo audit): bypasses to `100%` raw verbatim full prefill
|
| 73 |
+
whenever the prompt fits `max_ctx` (while preserving warm KV prefixes on continuations).
|
| 74 |
+
|
| 75 |
+
## Using it
|
| 76 |
+
|
| 77 |
+
PFlash v3 runs inside the Lucebox server with built-in defaults (no tuning flags needed). Download this
|
| 78 |
+
repository alongside the drafter GGUF, then set:
|
| 79 |
+
|
| 80 |
+
```bash
|
| 81 |
+
export PFLASH_SCORING_HEAD_GGUF=/path/to/pflash/seg-scoring-head.gguf
|
| 82 |
+
export PFLASH_SEGMENT_PROBE_GGUF=/path/to/pflash/segment-probe.gguf
|
| 83 |
+
export PFLASH_REQUEST_PROBE_GGUF=/path/to/pflash/request-probe.gguf
|
| 84 |
+
# pflash_seg_reranker.gguf is auto-discovered beside PFLASH_SCORING_HEAD_GGUF
|
| 85 |
+
# (optional override or opt-out: PFLASH_SEG_RERANKER_GGUF=/custom/path.gguf or off)
|
| 86 |
+
# server: --prefill-compression auto
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
- **Default V3 curve**: activates from **8,192** tokens (`8192:0.450`, `16384:0.250`, `32768:0.180`,
|
| 90 |
+
`65536:0.180`, `120000:0.150`).
|
| 91 |
+
- **Built-in defaults**: one-sided adaptive keep-ratio safety net, Lucebox Mix cold-history paging, and
|
| 92 |
+
autonomous tool-turn recall are all enabled automatically.
|
| 93 |
+
- Runtime support: [Luce-Org/lucebox PR #1048](https://github.com/Luce-Org/lucebox/pull/1048) (building on
|
| 94 |
+
[PR #746](https://github.com/Luce-Org/lucebox/pull/746)).
|
| 95 |
+
|
| 96 |
+
## Results
|
| 97 |
+
|
| 98 |
+
Measured end-to-end with all four components enabled (default launch, zero extra flags), reader
|
| 99 |
+
`Qwen3.8-27B IQ4_XS`, AMD Radeon AI PRO R9700, greedy decoding:
|
| 100 |
+
|
| 101 |
+
### 32K Matched Public Suite (125 items)
|
| 102 |
+
|
| 103 |
+
| configuration | avg TTFT | med TTFT | speedup vs full | avg served tok | BRIGHT (25) | QuALITY (25) | QASPER (25) | LongMemEval (25) | NoLiMa (25) | **macro** |
|
| 104 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 105 |
+
| full prefill | 33.04 s | 33.25 s | 1.00× | 32,266 | 0.8000 | 0.8800 | 0.3888 | 0.8400 | 0.1600 | **0.6138** |
|
| 106 |
+
| PFlash v2 (`1.5×` curve) | 9.42 s | 9.41 s | 3.51× | 9,132 | 0.8400 | 0.8400 | 0.4141 | 0.8000 | 0.2800 | 0.6348 |
|
| 107 |
+
| PFlash v2 (`1.0×` curve) | 6.97 s | 6.94 s | 4.74× | 6,241 | 0.8400 | 0.8000 | 0.3850 | 0.7600 | 0.2800 | 0.6130 |
|
| 108 |
+
| **PFlash v3 default (adaptive)** | **7.83 s** | **6.99 s** | **4.22× avg / 4.76× med** | **6,858** | **0.8400** | **0.8800** | **0.3970** | **0.7600** | **0.3600** | **0.6474** |
|
| 109 |
+
|
| 110 |
+
### Full 32K Public Suite (238 items, fixed `1.0×` V3 vs V2)
|
| 111 |
+
|
| 112 |
+
| configuration | avg TTFT | avg served tok | reranker | BRIGHT (28) | QuALITY (60) | QASPER (60) | LongMemEval (60) | NoLiMa (30) | **macro** | **micro** |
|
| 113 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 114 |
+
| PFlash v2 (`1.5×`) | 9.36 s | ~9,101 | — | 0.8571 | 0.8667 | 0.3781 | 0.7833 | 0.2333 | 0.6237 | 0.6415 |
|
| 115 |
+
| PFlash v2 (`1.0×`) | 6.92 s | ~6,220 | — | 0.8571 | 0.8667 | 0.3600 | 0.7000 | 0.2333 | 0.6034 | 0.6160 |
|
| 116 |
+
| **PFlash v3 (`1.0×`)** | **6.93 s** | **~6,221** | **4.13 ms** | **0.8571** | **0.9000** | **0.3786** | **0.7333** | **0.3000** | **0.6338** | **0.6459** |
|
| 117 |
+
|
| 118 |
+
### 8K–11K Public Suite (70 items)
|
| 119 |
+
|
| 120 |
+
| configuration | avg TTFT | med TTFT | speedup vs full | avg served tok | LongMemEval-10k (18) | NoLiMa-10k (16) | QASPER-10k (18) | QuALITY-10k (18) | **macro** |
|
| 121 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 122 |
+
| full prefill | 7.30 s | 7.35 s | 1.00× | 9,091 | 0.8889 | 0.3750 | 0.3383 | 0.8333 | **0.6089** |
|
| 123 |
+
| PFlash v2 (`r=0.35`) | 3.93 s | 3.55 s | 1.86× | ~3,498 | 0.8889 | 0.3750 | 0.3312 | 0.7778 | 0.5932 |
|
| 124 |
+
| **PFlash v3 default (adaptive)** | **4.90 s** | **4.18 s** | **1.49× avg / 1.76× med** | **4,636** | **0.8889** | **0.3750** | **0.3875** | **0.8333** | **0.6212** |
|
| 125 |
+
|
| 126 |
+
### Global / Diffuse 19K Codebase Queries (Adaptive Safety Net)
|
| 127 |
+
|
| 128 |
+
| prompt type | `eff` | decision | served / raw tokens | TTFT |
|
| 129 |
+
|---|---:|---|---:|---:|
|
| 130 |
+
| targeted symbol list | 0.140 | `region` (base curve) | 4,558 / 19,002 (24.0%) | 4.94 s |
|
| 131 |
+
| targeted counting | 0.193 | `region` (base curve) | 4,560 / 18,999 (24.0%) | 4.98 s |
|
| 132 |
+
| multi-file overview | 0.434 | `region` (adaptive widen) | 8,263 / 18,999 (43.5%) | 8.30 s |
|
| 133 |
+
| whole-repo audit | 0.590 | **`raw:adaptive_full`** (100% lossless) | **19,006 / 19,006 (100%)** | 18.18 s |
|
| 134 |
+
| open-ended review | 0.627 | **`raw:adaptive_full`** (100% lossless) | **18,994 / 18,994 (100%)** | 18.31 s |
|
| 135 |
+
|
| 136 |
+
### Agentic & Lucebox Mix Coding Workloads (Default Launch)
|
| 137 |
+
|
| 138 |
+
| workload | full prefill | PFlash v2 default | **PFlash v3 default** |
|
| 139 |
+
|---|---|---|---|
|
| 140 |
+
| Lucebox Mix 45K cold model switch (8 sessions) | 8/8 (100%), med TTFT 114.50 s | 8/8 (100%), med TTFT 114.54 s | **8/8 (100%), med TTFT 23.97 s** (4.8× faster) |
|
| 141 |
+
| Autonomous 3-turn tool-loop recall (6 sessions) | — | 3/6 (50%), med T3 TTFT 10.23 s | **6/6 (100%), med T3 TTFT 10.23 s** (+50 pp) |
|
| 142 |
+
|
| 143 |
+
## Limits
|
| 144 |
+
|
| 145 |
+
- Even with the one-sided adaptive safety net, compression is still lossy on sharp queries (`eff < 0.42`): a
|
| 146 |
+
rare edge case can drop a detail if both Stage-1 and the reranker under-rank it.
|
| 147 |
+
- Diffuse/global prompts (`eff >= 0.58`) intentionally fall back to full prefill (when within `max_ctx`),
|
| 148 |
+
trading speedup for exact lossless coverage.
|
| 149 |
+
- All four GGUFs are bound to the pinned `Qwen3.5-0.8B-BF16.gguf` drafter (`cedf89af…`).
|
pflash_seg_reranker.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:85bcecce88f2c8bad0888b3325426e2ad61858d4a8eec43fd04ac3a5aa0c9190
|
| 3 |
+
size 23439808
|
request-probe.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5915557d4b60f5a08c8ef18fdd7a30cba56c3a24fda1c2b988da4a41313ebf49
|
| 3 |
+
size 1060192
|
seg-scoring-head.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:95e13076bff5c9b204c615366dfe08dbfa56aaa0bb417ff3dbf7d09c5906c1d6
|
| 3 |
+
size 10486400
|
segment-probe.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:470b7b0efe3736518dcb4c1ba8eb5b806107007e378a74668c17e26434602e68
|
| 3 |
+
size 1062976
|