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.
Add support for compress_neighbors=float16 vector index parameter
Add test which check that our conversion f16 <-> f32 works the same as reference implementation from python/numpy (see test_libsql_f16.c and test_libsql_f16.py; note that test_libsql_f16.py generates test_libsql_f16_table.h required for the test to work)
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 off16
- 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_formatChanges
float16
functionsFLOAT16
/F16_BLOB
column namescompress_neighbors=float16
vector index parameterf16 <-> f32
works the same as reference implementation from python/numpy (seetest_libsql_f16.c
andtest_libsql_f16.py
; note thattest_libsql_f16.py
generatestest_libsql_f16_table.h
required for the test to work)