Giter VIP home page Giter VIP logo

sorsa's Introduction

SORSA: Singular Values and Orthonormal Regularized Singular Vectors Adaptation of Large Language Models

This repository contains the source code of experiments we conducted in the paper.

SORSA is a novel PEFT method. A SORSA layer consists of two main parts: trainable principle singular weights $W_p = U_p \Sigma_p V^\top_p$, and frozen residual weights $W_r = U_r \Sigma_r V^\top_r$. These parts are initialized by performing singular value decomposition (SVD) on pre-trained weights. SORSA layers could be merged during inference, thus eliminating inference latency.

Empirical Test Results

Llama 2-7B

Method Trainable
Parameters
GSM-8K MATH
Full FT 6738M 49.05 7.22
LoRA 320M 42.30 5.50
PiSSA 320M 53.07 7.44
SORSA 320M 57.24 10.20

Experiments on Llama 2-7B

First, install the packages via anaconda

conda env create -f environment.yml

Download the MetaMathQA dataset from huggingface and put into ./datasets folder.

Run the run.py to train:

python3 run.py --run-path ./runs --name Llama2_SORSA_r128 --model meta-llama/Llama-2-7b-hf --lr 3e-5 --wd 0.00 --batch-size 2 --accum-step 64 --gamma 5e-4  --rank 128 --epochs 1 --train --bf16 --tf32

After training, run the following command to merge the adapter to the base model:

python3 run.py --run-path ./runs --name Llama2_SORSA_r128 --merge

Run following command to evaluate on GSM-8K:

python3 run.py --run-path ./runs --name Llama2_SORSA_r128 --test --gsm-8k --bf16

Run following command to evaluate on MATH:

python3 run.py --run-path ./runs --name Llama2_SORSA_r128 --test --math --bf16

Cite the work

You could cite the work by using the following BibTeX Code:

@software{sorsa,
	author = {Cao, Yang},
	shorttitle = {SORSA},
	title = {SORSA: Singular Values and Orthonormal Regularized Singular Vectors Adaptation of Large Language Models},
	url = {https://github.com/Gunale0926/SORSA},
	year = {2024},
	version = {0.0.1}
}

sorsa's People

Contributors

gunale0926 avatar

Stargazers

 avatar Orange avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.