Binary Vector Scoring with Lookup Tables

Medium · Solved in PyTorch · Machine learning coding practice

Problem

Score packed binary codes of shape (N,\lceil D/8\rceil) against a float query of shape (D,) using lookup tables.

Encoding: feature j is bit j\bmod8 of byte \lfloor j/8\rfloor. Bit 1 represents +1; bit 0 represents -1. Ignore bits beyond D, even if nonzero.

Topics: vector-search, binary-quantization, lookup-tables

The full statement, worked examples, hints and the test suite are available once you sign in. You can then solve Binary Vector Scoring with Lookup Tables in the browser and run it against the tests.

Related problems