FLARE  by jzbjyb

Research paper implementation for active retrieval-augmented generation

created 2 years ago
643 stars

Top 52.7% on sourcepulse

GitHubView on GitHub
Project Summary

FLARE is a retrieval-augmented generation (RAG) framework designed to improve the quality and relevance of generated text by actively anticipating future content. It is targeted at researchers and developers working with large language models who need to enhance their output with external knowledge. FLARE's core innovation lies in its proactive retrieval mechanism, which can lead to more informed and contextually appropriate generations.

How It Works

FLARE employs a forward-looking approach where it predicts the next sentence to be generated. If this predicted sentence contains low-confidence tokens, FLARE uses it as a query to retrieve relevant documents. This active retrieval strategy aims to fetch information before it's explicitly needed, thereby enriching the generation process with anticipated context. The advantage is a more dynamic and potentially more accurate generation, as it doesn't solely rely on reactive retrieval triggered by current low confidence.

Quick Start & Requirements

  • Install: Follow setup.sh after creating a conda environment.
  • Prerequisites:
    • Wikipedia dump (psgs_w100.tsv.gz) from DPR repository.
    • Elasticsearch 7.17.9 for indexing the Wikipedia dump.
    • Bing Search API key (for WikiASP dataset experiments).
    • OpenAI API keys (placed in keys.sh).
  • Setup: Requires downloading a Wikipedia dump, setting up Elasticsearch, and configuring API keys. Running experiments involves multiple OpenAI API calls per example, which can be costly.
  • Links: DPR Repository, Bing Web Search API.

Highlighted Details

  • Implements "Forward-Looking Active Retrieval Augmented Generation" as described in the paper "Active Retrieval Augmented Generation."
  • Supports multiple datasets like 2WikiMultihopQA and WikiASP.
  • Allows configuration via JSON files (e.g., configs/2wikihop_flare_config.json).
  • Includes a debug mode for step-by-step walkthroughs of the retrieval and generation process.

Maintenance & Community

The project is associated with authors Zhengbao Jiang, Frank F. Xu, Luyu Gao, Zhiqing Sun, Qian Liu, Jane Dwivedi-Yu, Yiming Yang, Jamie Callan, and Graham Neubig. Further community or maintenance details are not explicitly provided in the README.

Licensing & Compatibility

The README does not explicitly state a license. Given the association with academic research and the nature of the dependencies (OpenAI API, Elasticsearch), users should verify licensing for commercial use.

Limitations & Caveats

Experiments are described as "relatively expensive" due to repeated OpenAI API calls. The setup involves several external services (Elasticsearch, Bing API) and data downloads, increasing the complexity of initial deployment.

Health Check
Last commit

1 year ago

Responsiveness

1+ week

Pull Requests (30d)
0
Issues (30d)
0
Star History
21 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems) and Elie Bursztein Elie Bursztein(Cybersecurity Lead at Google DeepMind).

LightRAG by HKUDS

1.0%
19k
RAG framework for fast, simple retrieval-augmented generation
created 10 months ago
updated 23 hours ago
Feedback? Help us improve.