Repository navigation
fix(embed): respect physical batch limits for non-causal embeddings - #2387
original4422 wants to merge 13 commits into
Conversation
|
AI-assisted maintenance update (2026-11-23): merged current main Previous validation receipts (retained unchanged): AI-assisted maintenance update (2026-11-23): merged current main Validation on this retained tree: shell syntax and six offline fixtures running the real upstream script with real jq pass (only curl metadata responses substituted; valid/missing/null/malformed hashes and non-wheel filtering). All 13 owning embedding/native/build inputs match the prior validation. The 2026-11-22 native result, 41 passed in 9.88s, and four cache/server lifecycle controls are reused, not rerun; server controls used a settings fixture and do not validate the full server. No current hosted-CI or other-platform pass is claimed. Previous validation receipts (retained unchanged): Current-main synchronization in Validation on macOS arm64 / Python 3.12.14 reused the exact unchanged Current-main synchronization in Validation on macOS arm64 / Python 3.12.14: the exact unchanged AI-assisted native-sync receipt (2026-11-22 UTC): merged current main Rebuilt the original package against exact vendor Earlier dated receipts retained unchanged below: AI-assisted native-sync receipt (2026-11-21 UTC): merged current main Rebuilt the original native package against exact vendor Previous receipts retained unchanged below (their dates/vendor-specific results are historical): AI-assisted CI-sync receipt: merged current main All owning Python, tests, native vendor Previous release-sync and native validation receipts (retained unchanged): AI-assisted release-sync receipt: merged current main The actual native build and 41 passed in 15.76s result below were reused, not rerun for this metadata-only synchronization. The current package imports as 0.3.37 with the existing native library; Ruff check/format of all 30 Python files and whitespace checks pass. No new hosted-CI or other-platform validation is claimed. Previous native validation receipt (2026-11-14, retained unchanged): AI-assisted maintenance update: merged current main Rebuilt the native library against actual vendor @abetlen, when convenient, could you review the non-causal embedding batch-limit change? |
|
AI-assisted follow-up: Hi @abetlen, when convenient, could you review this non-causal embedding batch-limit fix and let me know whether changes are needed? The earlier native validation remains recorded above. Thank you! |
|
Hi @abetlen, could you review the non-causal embedding microbatch fix for #1762 when convenient, or advise on any changes needed? This is an AI-assisted follow-up. The Nov 14 native run recorded above passed 41 tests on macOS arm64; that is historical validation, not a test of the latest vendor update or a current CI claim. Thank you! |
|
Hi @abetlen, when convenient, could you review the non-causal embedding batch-limit fix for #1762 and let me know whether changes are needed? The AI-assisted update records the Nov 23 native run (41 tests on macOS arm64) and its platform limits; those tests have not been rerun today, and no hosted-CI pass is claimed. Thank you! |
Summary
Fixes #1762. A 513-token BGE-M3 input with
n_batch=513currently reaches a native assertion because the omittedn_ubatchstays at 512.Resolve defaults before native context creation, including
n_ctx=0and logical batch clamping. Keep logical truncation unchanged, preserve causal microbatch splitting, and cache the fixed long-context model for the native CI regressions. No vendor changes.Evidence
0c1e57098, real BGE-M3 F16, actual non-causal context: one 513-token sequence and two sequences totaling 256+257 tokens both terminate isolated processes with SIGABRT (encoder requires n_ubatch >= n_tokens). The initial regression set has 5 failures and 3 passing controls.python -m pytest --full-trace -v: 41 passed. This includes real long embeddings, aggregate batches, explicit limits/zero,n_ctx=0, clamping, causal generation/embedding controls, and the existing model tests. Long embeddings retain every token and have finite output values.python -m ruff check llama_cpp testsandpython -m ruff format --check llama_cpp tests: pass;git diff --check: pass.Local environment: macOS arm64, Python 3.12.14, original native build with Metal available; the new regression cases explicitly use CPU model layers (
n_gpu_layers=0). BGE-M3 F16 revision:9379ce497e8814b200f2dc0d18eb4045426dcb8c.Merge Danger
Door: two-way
Blast Radius: embeddings
Omitted embedding microbatches now follow the logical batch size. Explicit physical limits remain supported; a sequence that cannot fit raises a Python error instead of aborting the process. Ordinary generation retains its 512-token default microbatch.