From c0578faf8b94dbc1892603621902f77c322e3227 Mon Sep 17 00:00:00 2001 From: JamePeng Date: Mon, 16 Mar 2026 06:19:12 +0800 Subject: [PATCH 1/2] Update Submodule vendor/llama.cpp d23355a..892e3c3 --- vendor/llama.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/llama.cpp b/vendor/llama.cpp index d23355afc3..892e3c333a 160000 --- a/vendor/llama.cpp +++ b/vendor/llama.cpp @@ -1 +1 @@ -Subproject commit d23355afc319f598d0e588a2d16a4da82e14ff41 +Subproject commit 892e3c333a634f818acc195dc699468c08ff5e80 From 077f9bd1c768fdbc19aec1dd412ae9cc8b0d7601 Mon Sep 17 00:00:00 2001 From: Pathos <29135741+Pathos14489@users.noreply.github.com> Date: Wed, 18 Mar 2026 03:30:19 -0700 Subject: [PATCH 2/2] weird edge case is causing completions to throw out the whole prefix when appending to it. I think this'll fix it --- llama_cpp/llama.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/llama_cpp/llama.py b/llama_cpp/llama.py index eda22164a5..40a2b811f2 100644 --- a/llama_cpp/llama.py +++ b/llama_cpp/llama.py @@ -1243,10 +1243,18 @@ def generate( if longest_prefix == len(tokens): if self.is_hybrid and (self._hybrid_cache_mgr is None or self._hybrid_cache_mgr.max_checkpoints <= 0): if self.verbose: - print(f"Llama.generate: Full match on disabled hybrid cache. Skipping prefix-- to use existing fresh logits.", file=sys.stderr) + print(f"Llama.generate: Full match(tokens) on disabled hybrid cache. Skipping prefix-- to use existing fresh logits.", file=sys.stderr) else: if self.verbose: - print(f"Llama.generate: Full match. Forcing prefix-- to evaluate 1 token.", file=sys.stderr) + print(f"Llama.generate: Full match(tokens). Forcing prefix-- to evaluate 1 token.", file=sys.stderr) + longest_prefix -= 1 + if longest_prefix == self.n_tokens: + if self.is_hybrid and (self._hybrid_cache_mgr is None or self._hybrid_cache_mgr.max_checkpoints <= 0): + if self.verbose: + print(f"Llama.generate: Full match(n_tokens) on disabled hybrid cache. Skipping prefix-- to use existing fresh logits.", file=sys.stderr) + else: + if self.verbose: + print(f"Llama.generate: Full match(n_tokens). Forcing prefix-- to evaluate 1 token.", file=sys.stderr) longest_prefix -= 1 # Physically erase trailing "ghost" tokens from the C++ KV cache