Skip to content

fix(gguf): cancel through Llama.abort() instead of a logits processor - #39

Merged
duckyshell merged 2 commits into
duckyshell:mainfrom
Bloodborne9876:fix-gguf-cancel-speed
Sep 29, 2026
Merged

duckyshell merged 2 commits into
duckyshell:mainfrom
Bloodborne9876:fix-gguf-cancel-speed

Conversation

@Bloodborne9876

Copy link
Copy Markdown
Contributor

Fixes #38.

Problem: Direct GGUF passes a cancel logits_processor on every request. In llama-cpp-python 0.3.48 this makes the sampler loop over the full vocabulary (~248K for Qwen) in Python for every token. Qwen3.8-27B decode ran at 7.7 tok/s in Writer against 26–28 tok/s in other nodes.

Change: When the runtime has Llama.abort() (0.3.37+), Writer passes no logits processor and cancels through abort(). A small watcher keeps setting the abort flag until the call returns, because _create_completion clears it after MTMD media evaluation. Runtimes 0.3.34–0.3.36 keep the existing path.

Tests:

  • Unit tests pass, plus a new test for the abort watcher. test_frontend_regressions fails locally only because happy-dom is not installed; it fails the same way on unmodified main.
  • Real run: FL2VA with 2 images, Qwen3.8-27B Q4_K_P, RTX 4090, went from 7.7 tok/s / 299s to 32.0 tok/s / 58.6s.

🤖 Generated with Claude Code

cucu and others added 2 commits September 27, 2026 21:30
llama-cpp-python 0.3.48 wraps any logits_processor in a CustomSampler
adapter that loops over the full vocabulary in Python for every token,
cutting Direct GGUF decode speed 3-4x. Use Llama.abort() (0.3.37+) when
the runtime provides it and keep the logits processor for older runtimes.

Fixes duckyshell#38

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@duckyshell
duckyshell merged commit 8292bb4 into duckyshell:main Sep 29, 2026
1 check passed
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.

Direct GGUF generation 3-4x slower because the cancel logits_processor walks the full vocabulary per token

3 participants