fix(pflash): adaptive anchor_radius eliminates 64K NIAH cliff#357
Merged
davide221 merged 3 commits intoJun 10, 2026
Conversation
Tiers (chunk_size=32): <1024->{2,8}; <2048->{4,16}; >=2048->{8,32}.
DRY: extract resolve_anchor_params() pure helper; both call sites use it.
Env precedence: PFLASH_COMPRESS_ANCHOR_RADIUS > legacy DFLASH_ > tier.
Unit test: 28 checks covering tier boundaries, env overrides, sentinels.
Contributor
There was a problem hiding this comment.
1 issue found across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
easel
pushed a commit
to easel/lucebox-hub
that referenced
this pull request
Jun 9, 2026
easel
pushed a commit
to easel/lucebox-hub
that referenced
this pull request
Jun 10, 2026
Both anchor-scan loops now use vector<int>(max_anchor_hits) instead of int[8]; write guard and iteration bound follow max_anchor_hits throughout.
Contributor
|
I cant reproduce the cliff, can you give some more instruction about it? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-carved from #274 (commit
1d0baa2), with a DRY refactor + the unit test the original lacked.At >=32K the needle text straddles multiple 32-token chunks and the fixed
anchor_radius=2window (~160 tokens) drops the back half of the needle → truncated/hallucinated retrieval. Scales the window withn_chunks: <32K → (radius 2, hits 8); 32-64K → (4, 16); >=64K → (8, 32). Overridable viaPFLASH_COMPRESS_ANCHOR_RADIUS/PFLASH_COMPRESS_MAX_ANCHOR_HITS(legacyDFLASH_COMPRESS_*still accepted).Refactor: both call sites now use a pure
resolve_anchor_params()helper (server/src/qwen3/anchor_params.h) — removes the duplicated block and makes the tier/override logic unit-tested (28 checks: tier boundaries, override precedence, -1 sentinels). Sub-32K behavior is byte-identical to the previous hardcoded defaults. Source commit validated at 49K (needle correctly retrieved; truncated before the fix).4 files, +122/-4.