Skip to content

fix: defer to native LIK backends in PyLate & colpali-engine#105

Merged
h-tonywu merged 5 commits into
mainfrom
fix/pylate-native-lik-noop
Jun 8, 2026
Merged

fix: defer to native LIK backends in PyLate & colpali-engine#105
h-tonywu merged 5 commits into
mainfrom
fix/pylate-native-lik-noop

Conversation

@h-aurelien-lac

@h-aurelien-lac h-aurelien-lac commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

What

Both downstreams now ship a native LIK backend, released today:

  • PyLate 1.5.1 (pylate#222) — pip install "pylate[lik]", via auto / PYLATE_SCORES_BACKEND.
  • colpali-engine 0.3.17 (colpali#412, our PR) — pip install "colpali-engine[lik]", via auto / COLPALI_SCORES_BACKEND.

So patch_pylate() / patch_colpali_engine() are now redundant there — and on PyLate the patch actively breaks: native ColBERTScores forwards backend= to colbert_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.

  • Shared _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).
  • 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.yaml pins < 0.3.17 so it keeps exercising the patch.
  • The native backends call maxsim / maxsim_pairs / maxsim_mps by keyword → those signatures are now pinned by a test.

Test plan

  • no-op-on-native tests for both patches (force the version check, assert no patch + DeprecationWarning + safe unpatch).
  • public-API signature freeze.
  • existing pylate/colpali patch-parity tests still green on the pinned pre-native versions (uv.lock colpali 0.3.13; compat sky < 0.3.17).

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 h-tonywu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest waiting for the next pylate release (should be Monday) and clean the code a bit! Other really great initiative, tsm! 🙌🏼

Comment thread late_interaction_kernels/pylate_compat.py Outdated
Comment thread README.md Outdated
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.
@h-aurelien-lac h-aurelien-lac changed the title fix(pylate): defer to PyLate's native LIK backend fix: defer to native LIK backends in PyLate & colpali-engine Jun 8, 2026
tonywu71 added 3 commits June 8, 2026 21:06
- 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 h-tonywu merged commit bd7968a into main Jun 8, 2026
8 checks passed
@h-tonywu h-tonywu deleted the fix/pylate-native-lik-noop branch June 8, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants