DoLa  by voidism

Decoding strategy research paper for improving factuality in LLMs

created 1 year ago
504 stars

Top 62.6% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

DoLa is an official implementation for a decoding strategy that enhances the factuality of Large Language Models (LLMs) without requiring additional fine-tuning or external knowledge. It targets researchers and practitioners aiming to reduce hallucinations in LLM outputs, offering improved truthfulness across various benchmarks.

How It Works

DoLa leverages the observation that factual knowledge in LLMs is often localized to specific transformer layers. It achieves improved factuality by contrasting the logit differences between projections from later (mature) layers and earlier (candidate premature) layers to the vocabulary space. This contrastive approach helps surface factual knowledge more effectively, leading to more truthful generations.

Quick Start & Requirements

  • Install: pip install -e transformers-4.28.1 datasets accelerate
  • Dependencies: Python, transformers, datasets, accelerate. OpenAI API key required for specific evaluations.
  • Hardware: Supports LLaMA-v1 models (7B, 13B, 30B, 65B), with GPU requirements scaling with model size (e.g., 1 GPU for 7B, 8 GPUs for 65B).
  • Documentation: Paper available at https://arxiv.org/abs/2309.03883.

Highlighted Details

  • Improves TruthfulQA performance by 12-17% absolute points for LLaMA models.
  • Supports evaluation on FACTOR, TruthfulQA (multiple choice and open-ended), GSM8K, StrategyQA, and GPT-4 evaluation benchmarks.
  • Decoding strategy is controlled via the --early-exit-layers argument, specifying layer indices for contrastive decoding.

Maintenance & Community

The project is associated with authors from MIT and Microsoft. Links to related repositories like FastChat and ContrastiveDecoding are provided.

Licensing & Compatibility

The repository's license is not explicitly stated in the README. Compatibility for commercial use or closed-source linking would require clarification of the licensing terms.

Limitations & Caveats

Currently supports only LLaMA-v1 models. The README mentions fine-tuning GPT-3 models via OpenAI API for certain evaluations, which incurs costs and requires API access.

Health Check
Last commit

6 months ago

Responsiveness

1+ week

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

Explore Similar Projects

Starred by Patrick von Platen Patrick von Platen(Core Contributor to Hugging Face Transformers and Diffusers), Simon Willison Simon Willison(Author of Django), and
9 more.

simple-evals by openai

0.4%
4k
Lightweight library for evaluating language models
created 1 year ago
updated 3 weeks ago
Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Elie Bursztein Elie Bursztein(Cybersecurity Lead at Google DeepMind), and
10 more.

open_llama by openlm-research

0.0%
8k
Open-source reproduction of LLaMA models
created 2 years ago
updated 2 years ago
Feedback? Help us improve.