Code Monkey home page Code Monkey logo

Comments (5)

jkatz avatar jkatz commented on June 17, 2024

@tvondra To be pedantic, what kinds of embeddings are these (dimensions, dimension data type (fp32?)? My rough math says 768-dim, fp32.

Also, this looks really promising 😄 But the reason I'm being pedantic is I think it'd be good to test the contexts across some different dimensionalities. VectorDBBench has a few large datasets for 768/1536 dim, it may be worth to try it out on the 1536 dim to see if you still see a similar gain (my gut says there will be a gain).

from pgvector.

tvondra avatar tvondra commented on June 17, 2024

Yes, vector(768) with FP32.

I'd probably expect this to be even more beneficial for larger vectors.

from pgvector.

ankane avatar ankane commented on June 17, 2024

Hi @tvondra, nice find! From some initial testing (and the profile), it looks like this affects the on-disk phase of the index build and can likely be applied to inserts as well. I also think we may be able to avoid copying vectors entirely if they are outside of the max candidate distance, so will take a look at that as well as part of this.

from pgvector.

ankane avatar ankane commented on June 17, 2024

Pushed a version of less copying to the hnsw-less-copy branch. Initial results for 100k, 1536-dimension random vectors on my local machine (using 4 processes and 64MB for maintenance_work_mem): 189 sec before, 165 sec after.

Edit: I think there's room for further optimization, as we don't need to load the element at all (for search or builds/inserts) if it's outside the max candidate distance.

from pgvector.

ankane avatar ankane commented on June 17, 2024

Merged the branch in the commit above. There still may be some room to tune the memory context, but this should get most of the benefit from my testing.

from pgvector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.