Graffioh commited on
Commit
3841953
·
verified ·
1 Parent(s): 1405d18

Upload PFlash V3.3 Dual-Key (kbar_katt 1024d) seg-reranker.gguf and updated README

Browse files
Files changed (2) hide show
  1. README.md +53 -61
  2. seg-reranker.gguf +2 -2
README.md CHANGED
@@ -15,17 +15,19 @@ base_model: Qwen/Qwen3.5-0.8B
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** (`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
@@ -38,7 +40,7 @@ original order, plus the pinned request.
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
- | `seg-reranker.gguf` | Bidirectional segment reranker | `pflash_seg_reranker` (`pflash_seg_reranker_v1`, 3L/384d/6H `kbar`, `delta >= 0`) | `597be36ea17ec70650b3598e1eb59008661332af98d592e9425f28bd43a93c6f` | 23,439,904 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`,
@@ -52,25 +54,29 @@ original order, plus the pinned request.
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 (`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 bounded non-negative residual promotion (`delta in [0, 100]`, metadata `reranker.delta_min`/`reranker.delta_max`) on
67
- Stage-1 `log_density` over non-mandatory body segments so isolated needles cannot be suppressed.
 
 
 
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
 
@@ -86,52 +92,38 @@ export PFLASH_REQUEST_PROBE_GGUF=/path/to/pflash/request-probe.gguf
86
  # server: --pflash auto
87
  ```
88
 
89
- - **Default V3 curve**: activates from **8,192** tokens (`8192:0.450`, `16384:0.350`, `32768:0.220`,
90
- `65536:0.210`, `120000:0.190`).
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
 
@@ -142,8 +134,8 @@ Measured end-to-end with all four components enabled (default launch, zero extra
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…`).
 
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
19
+ (blocks `0..15` only when the trained scoring head is active), and four lightweight components on its
20
+ activations decide what the large reader model prefills:
21
 
22
  1. **Segment probe** (`segment-probe.gguf`) cuts the prompt into whole structural units (statements and
23
  definitions, sentences, records, chat turns, tool calls) and emits container boundary probabilities;
24
  2. **Request probe** (`request-probe.gguf`) finds which tokens carry the user's request, wherever it sits in
25
  the prompt;
26
+ 3. **Stage-1 scoring head** (`seg-scoring-head.gguf`) computes calibrated NoPE query→context attention density
27
+ plus both uniform (`k_bar`) and attention-mass-weighted (`k_att`) L2-normalized per-segment key centroids;
28
+ 4. **Dual-key bidirectional segment reranker** (`seg-reranker.gguf`) refines segment relevance with full
29
+ cross-segment context (`~1.5–4 ms` on GPU) over concatenated `[k_bar, k_att]` (`1024`-dim) representations
30
+ and drives PFlash v3's one-sided adaptive keep-ratio safety net.
31
 
32
  All Stage-1 signals read the same tap — the drafter's block-14 residual (`post_block14_residual_before_block15`)
33
  — from the same single forward pass. The highest-ranked units that fit the budget go to the reader in their
 
40
  | `segment-probe.gguf` | Segment probe | `segmentprobe` (`qwen3_5_0_8b_segment_probe_v2`, ~263K params) | `470b7b0efe3736518dcb4c1ba8eb5b806107007e378a74668c17e26434602e68` | 1,062,976 bytes |
41
  | `request-probe.gguf` | Request probe | `requestprobe` (`qwen3_5_0_8b_request_probe_v1`, ~265K params) | `5915557d4b60f5a08c8ef18fdd7a30cba56c3a24fda1c2b988da4a41313ebf49` | 1,060,192 bytes |
42
  | `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 |
43
+ | `seg-reranker.gguf` | Dual-key bidirectional segment reranker | `pflash_seg_reranker` (`pflash_seg_reranker_v1`, 3L/384d/6H `kbar_katt` 1024d, `delta >= 0`) | `978bcb34c443927708fe25321704f67a969cf381660475f103f2bb2d6264c7a0` | 25,012,768 bytes |
44
 
45
  - **Drafter** (required, verified by sha256 at load):
46
  [`unsloth/Qwen3.5-0.8B-GGUF`](https://huggingface.co/unsloth/Qwen3.5-0.8B-GGUF) `Qwen3.5-0.8B-BF16.gguf`,
 
54
  with `min_segment=32`, `max_segment=512`, and line-aligned oversize splitting preferring sub-unit starts.
55
  Container probabilities feed directly into the segment reranker as left/right boundary features.
56
  - **Request probe (`request-probe.gguf`)**: LayerNorm(1024) → Linear(1024, 256) → GELU (erf) → Linear(256, 1).
57
+ Locates the user's request inside long pastes, RAG prompts, or multi-turn chats, scores only positive-logit
58
+ request tokens (`s1 >= 0`) while pinning whole request units verbatim (up to 512 tokens), and uses
59
+ score-calibrated blend weight (`PFLASH_QUERY_TW=score`) without prose-vs-paste heuristics. On autonomous
60
+ tool turns and Lucebox Mix switches, active tool observations are promoted as the query role.
61
  - **Stage-1 scoring head (`seg-scoring-head.gguf`)**: Two projection matrices (`attn_q` `[1024, 2048]`, `attn_k`
62
+ `[1024, 512]`) computing GPU-reduced NoPE query→context attention mass density per unit plus L2-normalized
63
+ mean key centroids (`k_bar`) and attention-mass-weighted key centroids (`k_att`) in a single GPU pass.
64
+ Calibrated Stage-1 `.lift` is preserved separately for recall gating (`PFLASH_RECALL_GATE`).
65
+ - **Dual-key bidirectional segment reranker (`seg-reranker.gguf`, V3.3)**: 3-layer bidirectional Transformer
66
+ encoder (`d_model=384`, `n_heads=6`, `head_dim=64`, `d_ff=1024` SwiGLU, Pre-RMSNorm, 1D segment-index NeoX
67
+ RoPE with `theta=10000`, no causal mask) over non-mandatory, positive-mass body segments (`N_seg ~ 200–1500`).
68
+ Consumes concatenated `[k_bar, k_att]` (`1024`-dim), pooled `[q_bar, q_bar]` (`1024`-dim), multiplicative
69
+ interaction `W_int(k_d * q_d)`, and 12 per-segment scalars (z-scored density, relative density, mass, max,
70
+ top-4, peak ratio, length, position, left/right container probabilities, and left/right adjacent segment key
71
+ cosine similarity `adj_kcos`), emitting a sparse, bounded non-negative residual promotion (`delta in [0, 100]`,
72
+ metadata `reranker.delta_min`/`reranker.delta_max`) on Stage-1 `log_density` so isolated needles cannot be
73
+ suppressed while multi-hop and cross-segment reasoning evidence is promoted.
74
  - **One-sided adaptive keep-ratio safety net**: Computed in `<0.1 ms` from the reranker's optional-segment
75
  log-scores via sink-free token-level perplexity fraction `eff = exp(H_tok) / N_opt`:
76
+ - `eff < 0.38` (sharp/targeted query): untouched V3 base curve for maximum speedup;
77
+ - `0.38 <= eff < 0.46` (broad/multi-file query): monotonically widens keep ratio to `max(curve, eff)`;
78
+ - `eff >= 0.46` (diffuse/global query): bypasses to `100%` raw verbatim full prefill whenever the prompt
79
+ fits `max_ctx` (while preserving warm KV prefixes on continuations).
80
 
81
  ## Using it
82
 
 
92
  # server: --pflash auto
93
  ```
94
 
95
+ - **Default V3.3 quality-first curve**: activates from **8,192** tokens (`8192:0.450`, `16384:0.350`,
96
+ `32768:0.270`, `65536:0.260`, `120000:0.240`).
97
+ - **Built-in defaults**: one-sided adaptive keep-ratio safety net, pure-neural query candidates
98
+ (`PFLASH_QUERY_TW=score`), Lucebox Mix cold-history paging, and autonomous tool-turn recall are all enabled
99
+ automatically.
100
  - Runtime support: [Luce-Org/lucebox PR #1048](https://github.com/Luce-Org/lucebox/pull/1048) (building on
101
  [PR #746](https://github.com/Luce-Org/lucebox/pull/746)).
102
 
103
  ## Results
104
 
105
  Measured end-to-end with all four components enabled (default launch, zero extra flags), reader
106
+ `Qwen3.8-27B IQ4_XS`, AMD Radeon AI PRO R9700, single GPU:
107
 
108
+ ### Public Long-Context & Code Suite (Full Prefill vs PFlash v3.3 Dual-Key)
109
 
110
+ | Benchmark | Full prefill | PFlash v3.3 Dual-Key | Full TTFT | PFlash v3.3 TTFT | Speedup | Median kept |
111
+ |---|---:|---:|---:|---:|---:|---:|
112
+ | Document QA | 27/30 | **27/30** | 29.8 s | **8.32 s** | **3.58×** | 29% |
113
+ | RULER QA | 13/15 | **13/15** | — | **6.06 s** | — | 35% |
114
+ | NoLiMa | 14/24 | **13/24** | 15.2 s | **6.12 s** | **2.48×** | 35% |
115
+ | CodeDebug | 23/30 (76.7%) | **25/32 (78.1%)** | 140.7 s | **26.47 s** | **5.32×** | 25% |
116
+ | BRIGHT | 23/28 | **24/28** | 35.5 s | **9.19 s** | **3.86×** | 27% |
117
+ | LongCodeQA | 57/114 | **57/114** | 42.5 s | **10.5 s** | **4.05×** | 27% |
118
+ | LongBench-v2 | 7/12 | 3/12 *(4 cap)* | 27.5 s | **8.17 s** | **3.37×** | 31% |
119
 
120
+ ### 8K–11K Threshold Suite (70 items)
121
 
122
+ | configuration | avg TTFT | med TTFT | speedup vs full | LongMemEval-10k (18) | NoLiMa-10k (16) | QASPER-10k (18) | QuALITY-10k (18) | **macro** |
123
+ |---|---:|---:|---:|---:|---:|---:|---:|---:|
124
+ | full prefill | 7.30 s | 7.35 s | 1.00× | 0.8889 | 0.3750 | 0.3383 | 0.8333 | **0.6089** |
125
+ | PFlash v2 (`r=0.35`) | 3.93 s | 3.55 s | 1.86× | 0.8889 | 0.3750 | 0.3312 | 0.7778 | 0.5932 |
126
+ | **PFlash v3 default (adaptive)** | **4.90 s** | **4.18 s** | **1.49× avg / 1.76× med** | **0.8889** | **0.3750** | **0.3875** | **0.8333** | **0.6212** |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
 
128
  ### Agentic & Lucebox Mix Coding Workloads (Default Launch)
129
 
 
134
 
135
  ## Limits
136
 
137
+ - Even with the one-sided adaptive safety net, compression is still lossy on sharp queries (`eff < 0.38`): a
138
  rare edge case can drop a detail if both Stage-1 and the reranker under-rank it.
139
+ - Diffuse/global prompts (`eff >= 0.46`) intentionally fall back to full prefill (when within `max_ctx`),
140
  trading speedup for exact lossless coverage.
141
  - All four GGUFs are bound to the pinned `Qwen3.5-0.8B-BF16.gguf` drafter (`cedf89af…`).
seg-reranker.gguf CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:597be36ea17ec70650b3598e1eb59008661332af98d592e9425f28bd43a93c6f
3
- size 23439904
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:978bcb34c443927708fe25321704f67a969cf381660475f103f2bb2d6264c7a0
3
+ size 25012768