Live data from Hacker News

Vector indexing all of Wikipedia on a laptop

foojay.io

81–90 of 146 posts

Re: Vector indexing all of Wikipedia on a laptop

#81
post #78

The source files appear to include pages from all namespaces, which is good, because a lot of the value of Wikipedia articles is held in the talk page discussions, and these sometimes get stripped from projects that use Wikipedia dumps.

I'm curious what the main value you see in the talk pages? I almost never look at them myself.

Re: Vector indexing all of Wikipedia on a laptop

#83
post #80

Earlier quoted context omitted.

I also don’t quite understand the value of embedding all languages into the same database. If I search for “dog” do I really need to see the same article 300 times? As a first step they are using PQ anyways. It seems natural to just assume all English docs have the same centroid and search that subspace with hnswlib.

It's split by language. TFA builds an index on the English language subset.

Ah, missed that.

Re: Vector indexing all of Wikipedia on a laptop

#84
post #78

The source files appear to include pages from all namespaces, which is good, because a lot of the value of Wikipedia articles is held in the talk page discussions, and these sometimes get stripped from projects that use Wikipedia dumps.

I'm curious what the main value you see in the talk pages? I almost never look at them myself.

They’re not so interesting for mundane topics, but for anything remotely controversial, they are essential for understanding what perspectives aren’t included in the article.

Re: Vector indexing all of Wikipedia on a laptop

#85

In expert topics, is vector search finally competitive with BM25-like algorithms? Or do we still need to mix the 2 together ?

ColBERT gives you best of both worlds.

https://arxiv.org/abs/2004.12832

https://thenewstack.io/overcoming-the-limits-of-rag-with-col...

Re: Vector indexing all of Wikipedia on a laptop

#86

>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.

[deleted]

Re: Vector indexing all of Wikipedia on a laptop

#87
post #34

Earlier quoted context omitted.

I routinely see Linux page memory out to swap while having 10+GB free. I can only guess that it really really really likes to cache recently used data from disk.

I've seen the same. It will sometimes prefer to swap rather than evict the disk cache. I don't know how Linux does this in particular, but intuitively swapping can make sense if part of your allocated RAM isn't being accessed often and the disk is. The kernel isn't going to know for sure of course, and seems in my case it guessed wrong.

At a very abstract level there isn't much difference between dropping a disk cache and writing anonymous memory to swap. Obviously the actual step of writing to swap is more expensive but once the data is out of memory they will both require a read to get the data back. So if you imagine that you are occasionally reading a file and an anonymous page you can thrash on either if your system doesn't have enough memory. After the initial write to swap it is effectively identical to keep reading either back in.

It is much better to swap out anonymous memory that isn't being used than to flush file data that is being used. Or another way of looking at it if you run out of memory you will thrash with or without swap enabled. The difference is that with swap the kernel can evict the most rarely accessed memory whether file-backed or anonymous. Without swap the kernel is forced to only consider file-backed memory, even if it is being used more frequently than the anonymous memory.

Re: Vector indexing all of Wikipedia on a laptop

#88

Earlier quoted context omitted.

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/

mwparserfromhell can parse the text content without including tables

Re: Vector indexing all of Wikipedia on a laptop

#89
"The obstacle is that until now, off-the-shelf vector databases could not index a dataset larger than memory, because both the full-resolution vectors and the index (edge list) needed to be kept in memory during index construction. Larger datasets could be split into segments, but this means that at query time they need to search each segment separately, then combine the results, turning an O(log N) search per segment into O(N) overall."

How is a log N search over S segments O(N)?

Re: Vector indexing all of Wikipedia on a laptop

#90

“… turning an O(log N) search per segment into O(N) overall.” Can someone explain why?

When it’s all in memory you get to amortize the cost of the initial load. Or just pay it when it’s not part of the hot path. When it’s segmented, you’re doing that because memory is full and you need to read in all the segments you don’t have. That’ll completely overwhelm the log n of the search you still get
Post reply on HN