Improve retrieval quality: measure, then rerank, adapt queries and upgrade embedders in one rebuild

Aperta
#66 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
24/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
machine-learning, python, sqlite

Direzione di ricerca

Start by reading src/litkit/embeddings/specter2.py and src/litkit/embeddings/sbert_mpnet.py, then inspect the FTS5 issue and the build record work in #65. First establish a retrieval test set and evaluation command covering the stated document types; record recall and nDCG for the current configuration before comparing reranking, query adaptation, lexical fusion, and replacement embedders. Done means adopted changes show measured gains and any re-embedding changes ship together with model revisions recorded.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

Retrieval uses models and methods from around 2021–22:

  • Paper search: allenai/specter2_base without SPECTER2's ad hoc query adapter (src/litkit/embeddings/specter2.py). Short typed queries are embedded the way abstracts are.
  • Passage search: sentence-transformers/all-mpnet-base-v2 (src/litkit/embeddings/sbert_mpnet.py). It is a general-domain model, behind current embedding models and not trained on biomedical text.
  • Two stages: passages are searched only within a Stage 1 shortlist of papers chosen by title and abstract. A relevant passage in a paper whose abstract is about something else is missed (exact mode avoids this).
  • Lexical matching: exact-token matching, with no ranked keyword scoring (such as BM25) and no rank fusion with the semantic results.
  • Reranking: none in LitKit. Chatty has an optional LLM reranker in its chat path only.

Constraint

Re-embedding PMC OA takes about a day on roughly 20 GPUs and about a month on modest hardware. Changes that need re-embedding should be measured first and then shipped together in one rebuild.

Proposal

  1. Measure. Build a retrieval test set: queries with known relevant passages, covering biomedical papers and non-scientific documents (manuals, policies). Report recall and nDCG at fixed cutoffs for each configuration.
  2. Cheap wins (no re-embedding).
    • A cross-encoder reranker over the top candidates, for example MedCPT's cross-encoder or a bge reranker. It runs on CPU for a few dozen passages per query.
    • SPECTER2's ad hoc query adapter for query embeddings.
    • BM25 scoring and reciprocal rank fusion, once the FTS5 index is maintained at scale (see the FTS5 issue).
  3. Changes that need a rebuild. Compare these on the test set:
    • a newer chunk embedder (for example MedCPT for biomedical text, or a current general model such as Qwen3-Embedding or BGE-M3);
    • contextual chunks (paper title and section heading prepended before embedding).
  4. One rebuild. Ship the winners together with the other changes that need a rebuild: the FTS5 index, the build record from #65, and the duplicate-vector fix.

Done when

  • The test set and an evaluation command are in the repository, and results for the current configuration are recorded.
  • Each adopted change shows a measured gain on the test set.
  • Changes that need re-embedding are released together, with the model revisions recorded in the build record.
Lingua principale
Python
Stelle
0
Fork
2
Merge medio
8h 57m
PR unite (30g)
36

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di lanl/litkit

Tutte le issue di lanl/litkit

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.