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

Support for f16 vector metrics #4110

Open
generall opened this issue Apr 24, 2024 · 9 comments
Open

Support for f16 vector metrics #4110

generall opened this issue Apr 24, 2024 · 9 comments

Comments

@generall
Copy link
Member

Is your feature request related to a problem? Please describe.

Currently Qdrant supports storage of raw vectors with 2 datatypes: f32 and uint8.
In some applications it is also desirable to have f16 datatype support.

Qdrant VectorStorage itself is generic to the datatype and technically can store vectors of any type with no additional changes.

There is, however, a component which depends on datatype and requires specialized implementation - that is metrics.

Describe the solution you'd like

Provide SIMD-optimized implementations for the following:

impl Metric<f16> for DotProductMetric {
impl Metric<f16> for CosineMetric {
impl Metric<f16> for EuclidMetric {
impl Metric<f16> for ManhattanMetric {

for avx2, sse and neon architectures in a similar way as it is implemented for f32.

Please also include unit-tests to ensure correctness of the implementation.

Describe alternatives you've considered

  • add a compile-time option to switch VectorElementType between f32 and f16, but this approach is less flexible and requires more changes

Additional context

@generall
Copy link
Member Author

/bounty $300

Copy link

algora-pbc bot commented Apr 24, 2024

💎 $300 bounty • Qdrant

Steps to solve:

  1. Start working: Comment /attempt #4110 with your implementation plan
  2. Submit work: Create a pull request including /claim #4110 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Additional opportunities:

Thank you for contributing to qdrant/qdrant!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @TheQuantumFractal Apr 24, 2024, 6:56:51 PM #4122

@TheQuantumFractal
Copy link

TheQuantumFractal commented Apr 24, 2024

Happy to help with this. You just want SIMD implementations and tests for f16? (ie. code doesn't have to be refactored to account for f16 datatype correct?)
/attempt #4110

@generall
Copy link
Member Author

Happy to help with this.

Thanks 😃

code doesn't have to be refactored to account for f16 datatype correct?

yeah, integration of f16 into API and storage would be a separate issue.

@abhishek818
Copy link
Contributor

Found a crate based on simd for f16.

Copy link

algora-pbc bot commented Apr 26, 2024

💡 @TheQuantumFractal submitted a pull request that claims the bounty. You can visit your bounty board to reward.

@abhishek818
Copy link
Contributor

Great work @TheQuantumFractal !

Copy link

algora-pbc bot commented May 13, 2024

@TheQuantumFractal: You've been awarded a $360 bounty by Qdrant! 👉 Complete your Algora onboarding to collect the bounty.

Copy link

algora-pbc bot commented May 13, 2024

🎉🎈 @TheQuantumFractal has been awarded $360! 🎈🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants