Skip to content

feat(leann): Add grep fusion for hybrid retrieval #26

Description

@hummat

Problem or Motivation

LEANN supports use_grep=True in its Python API for exact text matching, but this isn't exposed in papi. For technical papers, exact string hits matter: hyperparameters ("λ=0.1"), equation references ("Eq. 7"), dataset names, specific values.

Pure vector search can miss these precise matches, reducing recall on technical queries.

Proposed Solution

Expose LEANN's grep search capability for hybrid vector + exact-match retrieval:

papi ask --backend leann --leann-grep "query"

This would fuse grep + vector results for better recall on technical queries.

Alternatives Considered

  • Manual grep before querying — cumbersome, doesn't fuse with vector results
  • Use higher top_k — increases noise without targeting exact matches

Area

RAG backends (PaperQA2/LEANN)

Blockers

Blocked on upstream: LEANN's leann ask CLI does not expose --use-grep yet. Needs PR to LEANN first.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions