Skip to content

Research Agent: open-source paper search

Role: AI Research Contributor (volunteer)

Search backend rebuild for the B2 Foundation

Problem
Long searches stalled for 24+ minutes and then crashed, and 50.8% of the corpus had no embeddings.
What was done
Merged SQLite, FAISS and BM25 into one index, traced the crash to five bugs, and backfilled embeddings for 196,082 rows.
What changed
After the fixes, a search that had stalled 24+ minutes and crashed finished in 47.7 seconds with zero errors.
Long search, stall and crash fixed (zero errors after)
24+ min to 47.7 s
Papers in the corpus (2026-07-22 build)
385,655
Two slow queries after the embedding backfill
185.2 s to 14.3 s and 10.4 s
Reranker speed on CPU
about 3x faster
Reranker MTEB score, new vs old
0.584 vs 0.553
Reranker size
568M to 150M parameters
Cloud Run peak memory
100% (OOM) to about 55% of 8 GiB
Ranking baseline, Kendall's tau over 16 queries (built, not shipped)
0.316
NDCG@10 over 19 queries (built, not shipped)
0.81

Step through a search, then compare search times

Retrieval stages, one search

385,655

papers in the corpus, 2026-07-22 build

The stored library of computer science papers from arXiv and Semantic Scholar, in one LanceDB index on Cloudflare R2.

One dot is 100 papers.

Stage 1 of 4: 385,655 papers in the corpus, 2026-07-22 build.

Search time, before and after

  • Before the fixes24+ minutes, then a crash
  • After the fixes47.7 s, zero errors
One linear scale per comparison. The dashed run marks a stall past 24 minutes that ended in a crash.

The stall and crash traced to five bugs in LLM timeouts and connection pooling.

Long search: stalled 24+ minutes and crashed before the fixes, 47.7 s with zero errors after.

Problem

Research Agent searches a stored library of about 385,000 to 390,000 computer science papers from arXiv and Semantic Scholar. Search ran across SQLite, FAISS and BM25. Long searches stalled and crashed, 50.8% of the corpus had no embeddings, and ran out of memory.

Approach

A query parser reads the brief, with a 4-tier fallback from Groq to OpenRouter to Ollama Cloud to rules. LanceDB hybrid full-text and vector search on Cloudflare R2 fuses results with to 1,200 candidates. them to 200, then a gte-reranker-modernbert-base ranks the reading list and MiniLM picks evidence sentences. FastAPI streams results over .

Highlights

  • Merged SQLite, FAISS and BM25 into one LanceDB index of 385,000+ papers.
  • Traced a 24+ minute crash to five bugs in LLM timeouts and connection pooling.
  • After the fix, the same search finished in 47.7 seconds with zero errors.
  • Cut two slow queries from 185.2 s to 14.3 s and 10.4 s.
  • Backfilled embeddings for 196,082 rows in a 14-hour checkpointed run.
  • Swapped a 568M cross-encoder for a 150M ModernBERT model, about 3x faster on CPU.
  • The new reranker scores higher on MTEB, 0.584 vs 0.553.
  • Cut Cloud Run peak memory from out-of-memory crashes to about 55% of 8 GiB.
  • Rebuilt two broken filters that matched only 21 and 2 of about 390,000 papers.
  • Built, not shipped: an ranking evaluation, 0.316 over 16 queries.
  • That evaluation caught a scoring change that would have cut tau to 0.080.