Repository navigation
fix: preserve ColBERT tokenizer truncation direction - #801
j45856021-dev wants to merge 1 commit into
Conversation
Keep the resolved direction when reserving marker-token space for document and query tokenizers. Cover the shared ColBERT-family loader with local-tokenizer regressions and right-truncation controls. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to This fixes ColBERT-family tokenizers losing left truncation when marker tokens reduce the context limit. Right-truncation and default behavior are unchanged. No actionable merge risk remains. Pre-merge checks |
|
Coding-Professional
left a comment
There was a problem hiding this comment.
I reviewed the tokenizer change and ran the PR's regression test against this exact commit. Preserving the direction already resolved by load_tokenizer is the right fix when ColBERT reserves marker space; the tests cover document and query tokenizers, left and right truncation, and all four affected model classes.
Local validation: 33 passed (test_colbert_tokenizer_preserves_truncation_direction plus test_get_embedding_size). This was tokenizer-only; I did not run model inference or the full suite.
ColBERT loads its document and query tokenizers through
load_tokenizer, then reapplies the marker-adjusted context limit. Callingenable_truncationwithoutdirectionresets both to right truncation, undoing the direction resolved by #775. This also affects JinaColBERT, LateOn and mLateOn, which share the loader.Pass the already-resolved direction to both limit updates. Context-limit resolution, marker reservation, query expansion, and default/right truncation are unchanged.
The regressions use real local WordLevel tokenizer files and lazy/local-path initialization, without an ONNX session. For example, with left truncation, a 40-token limit and
word0throughword49, ColBERT should retainword13throughword49between its special tokens; unchanged main instead retainsword0throughword36.Validation
Environment: macOS arm64, Python 3.13.16, tokenizers 0.23.2, NumPy 2.5.3. Validation is tokenizer-only: no model-weight downloads, pretrained inference, full model suite, or OS/Python matrix. Pre-commit hooks were not installed; their pinned Ruff checks ran directly.
All Submissions
AI disclosure: investigation, implementation, tests and this PR text were developed autonomously with AI assistance. No human pre-review is claimed.