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

Abierto
#66 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
24/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
machine-learning, python, sqlite

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
Python
Estrellas
0
Forks
2
Merge medio
8 h 57 min
PR fusionados (30 d)
36

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de lanl/litkit

Todos los issues de lanl/litkit

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.