tursodatabase / libsql

libSQL is a fork of SQLite that is both Open Source, and Open Contributions.
https://turso.tech/libsql
MIT License
11.21k stars 286 forks source link

vector search: add float16 support #1679

Closed sivukhin closed 2 months ago

sivukhin commented 2 months ago

Context

We are continue adding compression support and now float16 is on the way!

This PR implements float16 support as a vector column table and vector index compression parameters in the LibSQL.

In current implementation we are basically implement conversion f16 <-> f32 and this way supports all important operations (distance calculation + conversion). This is not that optimal from the performance perspective - but since the main purpose of f16 - is the compression (without much sacrifice in the precision) - I think this is fine to start with.

Reference of the float16 format: https://en.wikipedia.org/wiki/Half-precision_floating-point_format

Changes