laser  by pratyushasharma

Research paper code for improving LLM reasoning via layer-selective rank reduction

Created 1 year ago
388 stars

Top 73.9% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This repository provides code for LASER (Layer-Selective Rank Reduction), a method to improve Large Language Model (LLM) reasoning capabilities by replacing specific weight matrices with their low-rank approximations. It targets researchers and practitioners seeking to enhance LLM performance on tasks like question answering without extensive retraining.

How It Works

LASER intervenes in transformer layers by applying Singular Value Decomposition (SVD) to selected weight matrices, then reconstructing them using a specified fraction of the largest singular values. This process is controlled by three hyperparameters: the target layer (ℓ), the parameter type (τ, e.g., MLP or attention weights), and the rank retention fraction (ρ). This approach is advantageous as it can significantly boost performance with minimal computational overhead and no additional training.

Quick Start & Requirements

  • Install dependencies: pip3 install -r requirements.txt
  • Requires PyTorch and Hugging Face datasets and transformers.
  • Example run command: python3 intervention_gptj_fever.py --lname fc_in --rate 9.9 --lnum 26
  • Official website for results and discussions: https://pratyushasharma.github.io/laser/

Highlighted Details

  • Achieves performance improvements on question-answering tasks without additional model training.
  • Supports layer-selective intervention across MLP and attention weight matrices.
  • Codebase includes scripts for reproducing paper results on various LLMs and benchmarks.
  • Encourages community contributions for new LLM/dataset results to a public leaderboard.

Maintenance & Community

  • The project is in early development with a planned major refactor in January 2024.
  • Open to issues and pull requests.
  • Discussions page available on the project website.

Licensing & Compatibility

  • The repository does not explicitly state a license in the README.

Limitations & Caveats

  • The code is described as an "early development release" and is undergoing refactoring.
  • Adding support for new LLMs requires manual adaptation of the laser package and wrapper code.
  • Some experiments may require separate hyperparameter selection on validation sets.
Health Check
Last Commit

1 year ago

Responsiveness

Inactive

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

Explore Similar Projects

Starred by Junyang Lin Junyang Lin(Core Maintainer at Alibaba Qwen), Shizhe Diao Shizhe Diao(Author of LMFlow; Research Scientist at NVIDIA), and
1 more.

LMaaS-Papers by txsun1997

0%
549
Curated list of LMaaS research papers
Created 3 years ago
Updated 1 year ago
Starred by Yaowei Zheng Yaowei Zheng(Author of LLaMA-Factory), Shizhe Diao Shizhe Diao(Author of LMFlow; Research Scientist at NVIDIA), and
2 more.

rome by kmeng01

0.1%
668
Model editing research paper for GPT-2 and GPT-J
Created 3 years ago
Updated 1 year ago
Feedback? Help us improve.