Sanity check on my hybrid RAG settings

Hi all, I’d love a quick review of my RAG retrieval settings and some advice on the vector store.

Current stack

  • Backend: FastAPI (Python) with Docker workers for ingestion
  • Vector DB: ChromaDB (one collection per project)
  • Keyword search: PostgreSQL full-text search (tsvector, ts_rank_cd)
  • Cache: Redis
  • Embeddings: Mistral, OpenAI, Jina (via Ollama)
  • LLMs: OpenAI, Mistral, Gemini
  • Reranker: BAAI/bge-reranker-base
  • Chunking: LlamaIndex SentenceSplitter

Indexing

  • Chunks of 1,000–1,500 characters with 200 overlap. Tables are split by whole rows.
  • A title/breadcrumb header (up to 200 characters) is added before embedding.
  • Normalized embeddings with cosine distance.

Retrieval

  • sim=1−dsim=1−d, with threshold τ=0.3τ=0.3 (range 0.2–0.45). If nothing passes, retry at 0.5τ0.5τ.
  • Small collections (300 chunks or fewer): score=0.65⋅sim+0.35⋅kwscore=0.65⋅sim+0.35⋅kw
  • Large collections: RRF, score=∑w/(60+rank)score=∑w/(60+rank). Vector, keyword and exact-ID lists each have w=1w=1, and structured records have w=2w=2.
  • Results found only by keyword search are kept if sim≥0.75×sim≥0.75× the best vector similarity.

Reranking

  • Reranks the top 30 within an 800 ms budget, reading up to 256 tokens per chunk, with d=1−σ(s)d=1−σ(s).
  • Skipped when the top result has sim≥0.75sim≥0.75 and leads the second by at least 0.10.

Final context

  • top-k = 5, with near-duplicates removed and at most 3 chunks per page.
  • Confidence requires top-1 similarity of at least 0.16 and a top-3 average of at least 0.20. Otherwise it retries with the original query.

Questions

  1. Is a weighted mix for small collections and RRF for large ones sensible, or should I use one method everywhere?
  2. Are 256 tokens per chunk too few for bge-reranker-base when chunks are about 1,400 characters?
  3. Are the confidence floors (0.16 / 0.20) too low for production?
  4. Since keyword search already runs in Postgres, would you move vectors to Postgres + pgvector, or switch to OpenSearch / Elasticsearch for native hybrid search (BM25 plus vectors) at multi-tenant scale? Which works better in production?

Thanks!

honestly your stack is fine, the part I’d worry about is the glue - Chroma + Postgres FTS + Redis workers means 3 places that can drift when a doc gets re-ingested. pgvector is the easy win if you already run Postgres, keeps keyword + vector in one place. we hit the same thing and ended up keeping chunks, embeddings and indexes in one table that updates incrementally in Pixeltable.. we wrote up a side by side vs Celery+Postgres+pgvector here if useful: github.com/pixeltable/showcase-call-intelligence

Thanks a lot, this is really helpful! You’re right about the glue. Keeping Chroma, Postgres FTS and Redis in sync during re-ingestion is exactly the kind of drift I’ve been worried about. Consolidating on Postgres + pgvector makes a lot of sense since we already run Postgres. I’ll go through your Pixeltable side-by-side and definitely try it out.

Appreciate you sharing it!

If you have any thoughts on the reranker token limit or the confidence thresholds, I’d love to hear them too.

glad it helped! on the reranker.. I’d cap what you feed it per chunk rather than per query, most cross-encoders top out around 512 tokens so anything longer just gets truncated silently. if chunks run long, rerank on a trimmed window (heading + first ~400 tokens) and pass the full chunk to the LLM after. for thresholds I wouldn’t trust one fixed number, scores shift with the query. what worked better for us is logging the top-k scores per query for a week and picking the cutoff from that distribution, plus a “no confident answer” path when even the best one is low. lmk how the side-by-side goes

Nice stack — and writing the formulas down puts you ahead of most hybrid setups.

The weak spot could be the units, not the weights. Cosine similarity and ts_rank_cd live on different scales, so 0.65·sim + 0.35·kw mixes two currencies. RRF works on ranks and skips the problem — I would run it everywhere and drop the 300-chunk switch, so ranking behavior stays the same the day a project grows past it.

On the reranker: chunks run ~1,400 characters (~350 tokens) and it only reads 256, so every chunk’s tail is judged unseen. Give it ~384 tokens, or pull chunks toward 1,000 characters.

The floors are corpus-relative, and three embedding models feed the same collections — their score distributions differ, so one floor can’t be right for all three. A quick log check settles it: do 0.16/0.20 ever engage, and does the retry help when they do?

On the store: you already run Postgres, so pgvector keeps one backup story and both indexes in one transaction. OpenSearch earns its place when hybrid needs to get more expressive or much bigger. Until then, the single store is the calmer production choice.

The reranker and RRF points above are spot on. Three things I’d add:

1. Build a small eval set before tuning anything else. Take 30–50 real questions from users, mark the chunk(s) that should answer each one, and track recall@k for retrieval alone, before the LLM is involved. Then every change (τ, chunk size, the 0.65/0.35 weights, switching to pgvector) gets a number instead of a feeling. It also answers your threshold question directly: you can see where good matches actually score.

2. Keep one embedding model per collection. With Mistral, OpenAI and Jina all available, make sure a collection is never written with one model and queried with another. Vectors from different models aren’t comparable, and the failure is silent. Store the model name in the collection metadata and assert it at query time.

3. Make re-ingestion idempotent. Give each chunk an ID from doc_id + content hash, upsert only changed chunks, and delete orphaned IDs for that document in the same job. That removes most of the Chroma/Postgres drift you mentioned. For tables split by rows, repeat the header row in every chunk so each row keeps its meaning.

There’s a write-up of the same idea for business assistants, on testing an assistant with real questions before launch, if that’s useful. (Disclosure: I work with Nexstair AI.)

Building on the eval-set point, I would also log the retrieval decision for each question, not just the final answer. For a small set of real questions, record which chunks were retrieved, their vector and keyword ranks, whether the reranker changed the order, and whether the top chunk actually answered the question. That makes the confidence floors much easier to judge: if low-scoring answers are usually wrong, raise the floors; if good answers are being dropped, the problem is more likely retrieval coverage or chunk boundaries than the threshold itself. One embedding model per collection is also worth enforcing early, since mixing models makes those scores hard to compare at all.