fix: defer to native LIK backends in PyLate & colpali-engine#105
Merged
Conversation
PyLate now ships its own LIK dispatch (pylate#222: `pip install "pylate[lik]"`, selected via `auto` / PYLATE_SCORES_BACKEND). On those versions patch_pylate() detected nothing and would shadow native routing — and break ColBERTScores, which forwards `backend=` to colbert_scores (our drop-in doesn't accept it). patch_pylate() now detects the native `backend` parameter and becomes a deprecated no-op there; older PyLate is unaffected. PyLate's backend calls maxsim / maxsim_pairs / maxsim_mps by keyword, so those signatures are pinned by a test. README + e2e bench point at the native path.
h-tonywu
reviewed
Jun 6, 2026
h-tonywu
left a comment
Collaborator
There was a problem hiding this comment.
I suggest waiting for the next pylate release (should be Monday) and clean the code a bit! Other really great initiative, tsm! 🙌🏼
ColPali merged native LIK support (colpali#412), shipped in colpali-engine 0.3.17, mirroring PyLate 1.5.1 (pylate#222). Both now route MaxSim through their own dispatch (COLPALI_SCORES_BACKEND / PYLATE_SCORES_BACKEND), so our patches are redundant there — and patching PyLate on top breaks ColBERTScores (forwards backend=). patch_pylate() and patch_colpali_engine() now detect native support by package version (per Tony's review on #105: pylate >= 1.5.1, colpali-engine >= 0.3.17) via a shared _utils.package_at_least helper, and become deprecated no-ops there. Older versions are unaffected. - README/CHANGELOG name the exact versions and the native install path. - e2e benches set the native env var for the lik variant; sky colpali-compat test pins < 0.3.17 so it still exercises the patch. - no-op tests for both patches + the maxsim signature freeze the native backends now depend on.
- Cover numeric (not lexicographic) ordering, short release tuples, and dev/rc suffixes flooring to the release - Cover absent-package returning False - CPU-safe and downstream-free, unlike the monkeypatched no-op tests that never exercise the real comparison
- Move the maxsim / maxsim_pairs / maxsim_mps kwarg freeze out of test_pylate_compat.py (gated by mark.cuda + importorskip pylate) into a downstream-free test_public_api.py so it runs on CPU CI - Freeze normalize on maxsim / maxsim_pairs too, matching the documented native-backend contract
- Reference _PYLATE_NATIVE_MIN / _COLPALI_NATIVE_MIN as the single source of truth in the compat docstrings instead of restating 1.5.1 / 0.3.17 - Genericize the colpali bench docstring + comment to "native LIK" rather than >= 0.3.17 (keeping the concrete 0.3.16 pinned-env references)
h-tonywu
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Both downstreams now ship a native LIK backend, released today:
pip install "pylate[lik]", viaauto/PYLATE_SCORES_BACKEND.pip install "colpali-engine[lik]", viaauto/COLPALI_SCORES_BACKEND.So
patch_pylate()/patch_colpali_engine()are now redundant there — and on PyLate the patch actively breaks: nativeColBERTScoresforwardsbackend=tocolbert_scores, which our drop-in doesn't accept →TypeError.Change
Both patches detect native support by package version (per @tonywu71's review) and become a deprecated no-op — they leave the native dispatch alone instead of shadowing it. Older versions are unchanged.
_utils.package_at_least()helper; thresholds named: PyLate ≥ 1.5.1, colpali-engine ≥ 0.3.17 (verified 1.5.0 / 0.3.16 don't have it).likvariant;sky_colpali_compat_test.yamlpins< 0.3.17so it keeps exercising the patch.maxsim/maxsim_pairs/maxsim_mpsby keyword → those signatures are now pinned by a test.Test plan
< 0.3.17).