From 6ff43ba5198e357574f4d0e5c888517a1489c69c Mon Sep 17 00:00:00 2001 From: Tai An Date: Sun, 3 May 2026 03:19:05 -0700 Subject: [PATCH 1/2] fix(_internals): correct logits index in LlamaBatch.add_sequence for multi-sequence batches --- llama_cpp/_internals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama_cpp/_internals.py b/llama_cpp/_internals.py index cde52c8c8..24f6fddc7 100644 --- a/llama_cpp/_internals.py +++ b/llama_cpp/_internals.py @@ -522,7 +522,7 @@ def add_sequence(self, batch: Sequence[int], seq_id: int, logits_all: bool): self.batch.seq_id[j][0] = seq_id self.batch.n_seq_id[j] = 1 self.batch.logits[j] = logits_all - self.batch.logits[n_tokens - 1] = True + self.batch.logits[n_tokens0 + n_tokens - 1] = True class LlamaTokenDataArray: From a3e35c4e11f5d16b3d9ceaac812df0bddd9fcdec Mon Sep 17 00:00:00 2001 From: abetlen Date: Sun, 3 May 2026 17:59:35 -0700 Subject: [PATCH 2/2] docs: update changelog for batched embeddings fix --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e2a8e329..5fb84f07f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- fix: Correct batched embedding outputs for multi-sequence `embed()` calls by @Anai-Guo in #2205 + ## [0.3.22] - feat: Update llama.cpp to ggerganov/llama.cpp@63d93d173