Lurker News
I am curious how people are doing RAG locally with minimal dependencies for internal code or complex documents?

Are you using a vector database, some type of semantic search, a knowledge graph, a hypergraph?

Comments (156) 83 threads

Show all comments

Showing thread 4 of 83

CuriouslyC7 replies#
Don't use a vector database for code, embeddings are slow and bad for code. Code likes bm25+trigram, that gets better results while keeping search responses snappy.
lee1012#
static embedding models im finding quite fast lee101/gobed https://github.com/lee101/gobed is 1ms on gpu :) would need to be trained for code though the bigger code llm embeddings can be high quality too so its just yea about where is ideal on the pareto fronteir really , often yea though your right it tends to be bm25 or rg even for code but yea more complex solutions are kind of possible too if its really important the search is high quality
itake1 reply#
With AI needing more access to documentation, WDYT about using RAG for documentation retrieval?
CuriouslyC#
IME most documentation is coming from the web via web search. I like agentic RAG for this case, which you can achieve easily with a Claude Code subagent.
postalcoder1 reply#
I agree. Someone here posted a drop-in for grep that added the ability to do hybrid text/vector search but the constant need to re-index files was annoying and a drag. Moreover, vector search can add a ton of noise if the model isn't meant for code search and if you're not using a re-ranker.

For all intents and purposes, running gpt-oss 20B in a while loop with access to ripgrep works pretty dang well. gpt-oss is a tool calling god compared to everything else i've tried, and fast.

threecheese#
Say more!
ehsanu11 reply#
I've gotten great results applying it to file paths + signatures. Even better if you also fuse those results with BM25.
CuriouslyC#
I like embeddings for natural language documents where your query terms are unlikely to be unique, and overall document direction is a good disambiguator.
rao-v4 replies#
Anybody know of a good service / docker that will do BM25 + vector lookup without spinning up half a dozen microservices?
donkeyboy1 reply#
Elasticsearch / Opensearch is the industry standard for this
abujazar2 replies#
Used to be, but they're very complicated to operate compared to more modern alternatives and have just gotten more and more bloated over the years. Also require a bunch of different applications for different parts of the stack in order to do the same basic stuff as e.g. Meilisearch, Manticore or Typesense.

Continue this thread — 2 replies

abujazar#
Meilisearch
porridgeraisin#
For BM25 + trigram, SQLite FTS5 works well.
jankovicsandras1 reply#
You can do hybrid search in Postgres.

Shameless plug: https://github.com/jankovicsandras/plpgsql_bm25 BM25 search implemented in PL/pgSQL ( Unlicense / Public domain )
The repo includes also plpgsql_bm25rrf.sql : PL/pgSQL function for hybrid search ( plpgsql_bm25 + pgvector ) with Reciprocal Rank Fusion; and Jupyter notebook examples.

canadiantim#
Wow very impressive library great work!
Der_Einzige#
This is true in general with LLMs, not just for code. LLMs can be told that their RAG tool is using BM25+N-grams, and will search accordingly. keyword search is superior to embeddings based search. The moment google switched to bert based embeddings for search everyone agreed it was going down hill. Most forms of early enshittification were simply switching off BM25 to embeddings based search.

BM25/tf-idf and N grams have always been extremely difficult to beat baselines in information retrieval. This is why embeddings still have not led to a "ChatGPT" moment in information retrieval.