Live data from Hacker News

Vector indexing all of Wikipedia on a laptop

foojay.io

61–70 of 146 posts

Re: Vector indexing all of Wikipedia on a laptop

#61

Maybe I’m missing something but I’ve created vector embeddings for all of English Wikipedia about a dozen times and it costs maybe $10 of compute on Colab, not $5000

Also, if you’re spending $5000 to compute embeddings, why are you indexing them on a laptop?

He's not though because cohere stuck the already embedded dataset on huggingface https://huggingface.co/datasets/Cohere/wikipedia-22-12-en-em...

Re: Vector indexing all of Wikipedia on a laptop

#62

Earlier quoted context omitted.

Nothing too crazy, just downloading a dump, splitting it into manageable batch sizes, and using a lightweight embedding model to vectorize each article. Using the best GPU available on colab it takes maybe 8 hours if I remember correctly? Vectors can be saved as NPY files and loaded into something like FAISS for fast querying.

Did you chunk the articles? If so, in what way?

Yes. I split the text into sentence and append sentences to a chunk until the max context window is reached. The context window size is dynamic for each article so that each chunk is roughly the same size. Then I just do a mean pool of the chunks for each article.

Re: Vector indexing all of Wikipedia on a laptop

#63
post #17

Earlier quoted context omitted.

Ah didn’t realize it was every language. Yes I’m using a light weight open model - but also my use case doesn’t require anything super heavy weight. Wikipedia articles are very feature-dense and differentiable from one another. It doesn’t require a massive feature vector to create meaningful embeddings.

it's 35M 1024 vectors Plus the text

Still, $5000 is kind of insane. That makes no sense to me.

Re: Vector indexing all of Wikipedia on a laptop

#64

Earlier quoted context omitted.

On a planet where the heap size of the JVM is properly set.

I don't use Java often, but when I do, I have to look up again how the heap settings work.

It’s just -xXxXxX360NoScopexXxXxHeapSize=69G

Re: Vector indexing all of Wikipedia on a laptop

#67

$5000?! I indexed all of HN for ... $50 I think. And that's tens of millions of posts.

To be fair Wikipedia has over 60 million pages and this is for 300+ languages. But yeah, the value shows that they might not be using the cheapest service out there.

Re: Vector indexing all of Wikipedia on a laptop

#69

Earlier quoted context omitted.

Did you chunk the articles? If so, in what way?

Yes. I split the text into sentence and append sentences to a chunk until the max context window is reached. The context window size is dynamic for each article so that each chunk is roughly the same size. Then I just do a mean pool of the chunks for each article.

Thanks for the answer.

Wikipedia has a lot of tables so I was wondering if content-aware sentence chunking would be good enough for Wikipedia.

https://www.pinecone.io/learn/chunking-strategies/

Re: Vector indexing all of Wikipedia on a laptop

#70
post #29

>Disable swap before building the index. Linux will aggressively try to cache the index being constructed to the point of swapping out parts of the JVM heap, which is obviously counterproductive. In my test, building with swap enabled was almost twice as slow as with it off. This is an indication to me that something has gone very wrong in your code base.

> This is an indication to me that something has gone very wrong in your code base. I'm not sure on what planet all of these people here live that they have success with Linux swap. It's been broken for me forever and the first thing I do is disable it everywhere.

Linux swap has been fixed on Chromebooks for years thanks to MGLRU. It's upstream now and you can try it with a recent enough kernel with

  echo y >/sys/kernel/mm/lru_gen/enabled
Post reply on HN