Skip to content

Support for f16 vector metrics #4110

@generall

Description

@generall

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions