WikiChat  by stanford-oval

Improved RAG for factual LLM responses using Wikipedia grounding

created 1 year ago
1,489 stars

Top 28.2% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

WikiChat is a framework designed to mitigate Large Language Model (LLM) hallucinations by grounding responses in retrieved information from Wikipedia. It targets researchers and developers building factual, reliable chatbots, offering a robust 7-stage pipeline for enhanced accuracy and reduced factual errors.

How It Works

WikiChat employs a multi-stage pipeline that integrates information retrieval with LLM generation. It retrieves relevant passages from Wikipedia, extracts claims, grounds the LLM's response in these claims, and includes inline citations. This approach aims to ensure factual accuracy by explicitly linking generated text to verifiable sources, improving upon standard RAG systems.

Quick Start & Requirements

  • Installation: Clone the repository, install pixi (https://pixi.sh/latest/#installation), and run pixi shell to create and activate the environment. Install Docker.
  • Prerequisites: Python 3.11 (via pixi), Docker. GPU with at least 13GB VRAM is recommended for local embedding model usage.
  • Configuration: Set up LLM API keys in API_KEYS and configure llm_config.yaml.
  • Information Retrieval: Use the default rate-limited Wikipedia API or build a custom index using invoke commands.
  • Running: inv demo --engine <your_llm_engine>
  • Docs: https://wikichat.genie.stanford.edu

Highlighted Details

  • Supports over 100 LLMs via LiteLLM.
  • Enhanced information retrieval with structured data (tables, infoboxes) and state-of-the-art embedding models (e.g., BGE-M3, Snowflake Arctic).
  • Offers a free, rate-limited multilingual Wikipedia search API (25 languages).
  • Compatible with LangChain.
  • Won the 2024 Wikimedia Research Award.

Maintenance & Community

The project is developed by Stanford University. Announcements and updates are provided in the README. Links to community channels are not explicitly mentioned.

Licensing & Compatibility

Code, models, and data are released under the Apache-2.0 license, permitting commercial use and linking with closed-source projects.

Limitations & Caveats

The free Wikipedia API is rate-limited and not suitable for production. Local LLM usage requires significant GPU resources. Compatibility with non-Linux systems (Windows, macOS) may require troubleshooting. Older distilled LLaMA-2 models are not compatible with versions >= 2.0.

Health Check
Last commit

3 months ago

Responsiveness

Inactive

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

Explore Similar Projects

Feedback? Help us improve.