# Clarification issue in ColPali late interaction article: Hamming distance vs XOR value

**URL:** <https://discuss.elastic.co/t/clarification-issue-in-colpali-late-interaction-article-hamming-distance-vs-xor-value/384510>\
**Category:** Elastic Labs\
**Created:** [January 13, 2026, 5:03pm UTC](https://discuss.elastic.co/t/clarification-issue-in-colpali-late-interaction-article-hamming-distance-vs-xor-value/384510 "2026-01-13T17:03:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohammad\_Saeed\_Dalil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohammad_saeed_dalil/32/146648_2.png) [@Mohammad\_Saeed\_Dalil](https://discuss.elastic.co/u/Mohammad_Saeed_Dalil)\
**Post date:** [January 13, 2026, 5:03pm UTC](https://discuss.elastic.co/t/clarification-issue-in-colpali-late-interaction-article-hamming-distance-vs-xor-value/384510/1 "2026-01-13T17:03:05Z")

</div>

I would like to report a conceptual inconsistency in the following article:

> **[Late interaction models: How to scale & optimize in Elasticsearch -...](https://www.elastic.co/search-labs/blog/late-interaction-model-colpali-scale)**
>
> Explore techniques to scale late interaction models like ColPali for large-scale vector search in Elasticsearch.

### Issue summary

In the section describing binary quantization and similarity scoring, the article states:

> “Simple binary quantization will transform D into 10101101 and Q into 11111011. For hamming distance, we need direct bit math—it's extremely fast. In this case, the hamming distance is 01010110, which is 86. So, scoring then becomes the inverse of that hamming distance.”

This description conflates **Hamming distance** with the **XOR bitmask interpreted as an integer** , which are not the same thing.

* * *

### Technical clarification

Given:

- D = 10101101

- Q = 11111011

The XOR result is:

```auto
D XOR Q = 01010110

```

However:

- The **true Hamming distance** is the **number of differing bits** , which here is **4**

- The value **86** is the **integer interpretation of the XOR bitmask** , not the Hamming distance

Using `1 / 86 ≈ 0.012` therefore inverts the XOR mask value, not the Hamming distance.

---

<div class="post-metadata">

**Author:** ![BenTrent](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bentrent/32/33915_2.png) [@BenTrent](https://discuss.elastic.co/u/BenTrent)\
**Post date:** [January 13, 2026, 6:08pm UTC](https://discuss.elastic.co/t/clarification-issue-in-colpali-late-interaction-article-hamming-distance-vs-xor-value/384510/2 "2026-01-13T18:08:12Z")

</div>

Yep! this is a bug in the blog for sure.

The principle is the same, but indeed, the math example is broken. We should instead do a `popCount` and inverse.

Thanks for finding this!

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 14, 2026, 10:11am UTC](https://discuss.elastic.co/t/clarification-issue-in-colpali-late-interaction-article-hamming-distance-vs-xor-value/384510/3 "2026-01-14T10:11:06Z")

</div>

Welcome!

The blog post has been updated. Thanks for your feedback!
