Skip to content

fix: pass current logits to stopping criteria - #2440

Open
remote-controlled-man wants to merge 4 commits into
abetlen:mainfrom
remote-controlled-man:codex/prflow-ec8c5ce5a145
Open

remote-controlled-man wants to merge 4 commits into
abetlen:mainfrom
remote-controlled-man:codex/prflow-ec8c5ce5a145

Conversation

@remote-controlled-man

@remote-controlled-man remote-controlled-man commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Stopping criteria receive unrelated scores: the Python scores buffer is not populated with the default logits_all=False, and the logits_all=True path indexes the wrong row instead of the position being sampled.

Use the stored logits at the sampled position when all logits are retained, and read the current native logits otherwise.
Completion and streaming completion now use the generator's actual termination to report finish_reason="stop", instead of invoking the callback again with stale state.

Added real-model regression coverage for both logits settings, prompt lookup on/off, generate, completion and streaming, immediate stopping, stopping after several tokens, and the token-limit control.
The checks compare callback logits with a separate model evaluated one token at a time, verify accepted prefixes and output, and confirm that evaluated draft suffixes were exercised.

Validation:

  • make test: 62 passed, including all 36 regression cases
  • make lint: Ruff lint and formatting checks passed (29 files)

Environment: macOS 26.7.3 arm64, Python 3.12.14, CPU inference with bundled llama.cpp f5e6915c2, built with GGML_NATIVE=OFF (CPU/Accelerate and Metal enabled).
Other platforms and acceleration backends were not run locally.

After syncing with upstream main at 77fbb5d, I reran make test (62 passed, including all 36 stopping-criteria cases) and make lint (Ruff lint and format checks passed).

Copilot AI balanced review requested due to automatic review settings November 23, 2026 09:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants