Repository navigation
fix(chunks): fire heading-aware split-before discount on glued headings; v0.6.2 - #7
Merged
Merged
Conversation
…gs; v0.6.2 SPEC-CHUNK-322's split-before discount keyed on _is_heading (a standalone heading chunklet), which stage 2 almost never produces because it groups a heading with its first sentences. The discount was effectively dead on real prose, so chunks packed across section boundaries. Key the split-before discount on a new _starts_with_heading predicate; keep the split-after forbid on standalone headings so a lone heading is still never stranded at a chunk's tail. On the Qasper coherence set this aligns more chunk starts with section boundaries (1908.05925: 9/12 -> 13/14 chunks) and removes glued-heading tails, without forcing extra cuts inside a section, splitting equations, or introducing tiny stubs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This branch was previously deployed
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.
Summary
_is_heading(a standalone heading chunklet). Stage 2 almost always glues a heading to its first sentences, so that predicate is rarely true on real prose — the discount was effectively dead and chunks packed across section boundaries._starts_with_headingpredicate (first block token is a heading). The split-after forbid stays on_is_heading, so a lone heading is still never stranded at a chunk's tail.Before / after (Qasper coherence set)
## Model ::: Objective and Training; formula stays intactEvery new cut lands on a section boundary; smallest new chunk is 784c (above the ~410c general-term floor), so no tiny stubs.
What this deliberately does NOT do
##rendering can't distinguish major sections from siblings).Test plan
uv run pytest— 214 passed, 20 skippedtest_split_before_glued_heading_with_bodyproven to fail on the old keying and pass with the change🤖 Generated with Claude Code