Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vector search: add float16 support #1679

Merged
merged 5 commits into from
Aug 22, 2024
Merged

vector search: add float16 support #1679

merged 5 commits into from
Aug 22, 2024

Conversation

sivukhin
Copy link
Contributor

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

  • Implement all necessary float16 functions
  • Add support float FLOAT16 / F16_BLOB column names
  • 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)

@sivukhin sivukhin marked this pull request as ready for review August 19, 2024 18:56
@sivukhin sivukhin requested review from penberg and haaawk August 20, 2024 07:03
@sivukhin sivukhin added this pull request to the merge queue Aug 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 21, 2024
@sivukhin sivukhin force-pushed the vector-search-float16 branch from 9bb0ead to 6ed738e Compare August 21, 2024 20:48
@sivukhin sivukhin added this pull request to the merge queue Aug 22, 2024
Merged via the queue into main with commit 243bd75 Aug 22, 2024
19 checks passed
@sivukhin sivukhin deleted the vector-search-float16 branch August 22, 2024 07:33
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.

2 participants