Skip to content

[feat] Add binary & scalar embedding quantization support to Transformers.js #681

@jonathanpv

Description

@jonathanpv

Feature request

Add binary & scalar quantization support

We should extract the algorithm to quantize the embeddings from the PR below from sentence-transformers and add it transformers.js so the feature-extraction pipeline can support binary vector search

Either adding a quantize-output or binary-output to the pipeline or we can have helper method that quantizes the tensor so this solution can be applied to other parts of the codebase.

huggingface/sentence-transformers#2549

Motivation

Given performance gains for binary vector embeddings additional quantization helper methods can be useful for client-side vector search to reduce memory footprint

Your contribution

I plan on making a PR, but note, I am slow to open source world still and learning the transformers.js repo as fast as I can.

@xenova may be able to more quickly parse the repo from above and add the methods along with test cases in the style of the repo quicker than me.

However I am working on a poc for using vector embeddings on a side project so I can contribute that work and repo or readme when I finish it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions