UPSTREAM PR #18730: lookahead: fix n_seq_max and kv_unified configuration - #874
Open
loci-dev wants to merge 1 commit into
Open
UPSTREAM PR #18730: lookahead: fix n_seq_max and kv_unified configuration#874loci-dev wants to merge 1 commit into
loci-dev wants to merge 1 commit into
Conversation
llama-lookahead has been broken since PR #14482 (July 2025) which changed seq_id validation from LLAMA_MAX_SEQ constant to context-specific n_seq_max. Two lookahead-specific issues: 1. n_seq_max: Lookahead needs W + G + 1 = 31 sequences for parallel Jacobi decoding, but params.n_parallel defaulted to 1. Fix: Set params.n_parallel = W + G + 1 before context creation. 2. KV unified: Batch splitting with coupled sequences requires unified KV cache mode, but lookahead didn't enable it. Fix: Set params.kv_unified = true. Bug timeline: - Nov 2023: lookahead.cpp created, worked with LLAMA_MAX_SEQ constant - July 2025: PR #14482 changed to n_seq_max validation, broke lookahead Note: This PR depends on #18729 for the batch init fix (params.n_ctx -> llama_n_ctx). Both PRs are needed for lookahead to fully work. Tested with Qwen2.5-Coder-0.5B: lookahead generates output with n_accept > 0. Bug history researched with Claude.
loci-dev
temporarily deployed
to
PROD__AL_DEMO
January 10, 2026 00:49 — with
GitHub Actions
Inactive
|
Explore the complete analysis inside the Version Insights Perfect! I was able to retrieve the summary report for your project. Here's what the analysis shows: Summary Report for llama.cpp PR #874Project Information:
Key Findings: ✅ No significant performance changes detected The performance analysis comparing the two versions shows that:
Conclusion: Would you like me to provide more detailed information about specific functions or any other aspect of this comparison? |
loci-dev
force-pushed
the
main
branch
27 times, most recently
from
January 13, 2026 23:09
8e509d5 to
63d526f
Compare
loci-dev
force-pushed
the
main
branch
30 times, most recently
from
January 21, 2026 13:23
48924ee to
fb5dc2f
Compare
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.
Mirrored from ggml-org/llama.cpp#18730
Summary
Fixes
llama-lookaheadconfiguration issues that have been broken since PR #14482 (July 2025).Note: This PR depends on #18729 for the batch init fix. Both PRs are needed for lookahead to fully work.
Root Cause
Two lookahead-specific configuration issues:
1. Sequence count (n_seq_max)
PR #14482 changed seq_id validation from
LLAMA_MAX_SEQ(large constant) ton_seq_max(context-specific). Lookahead needsW + G + 1 = 31sequences for parallel Jacobi decoding, butparams.n_paralleldefaulted to 1.2. KV unified mode
Batch splitting with "coupled sequences" requires unified KV cache. Lookahead didn't enable this, causing:
Fix
Bug Timeline
Testing
With both this PR and #18729 applied:
Dependencies
params.n_ctx→llama_n_ctx(ctx))Bug history researched with Claude.