Skip to content
nikhilgshPublic

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

1 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

❄️ PoLoRA

This repo contains the official implementation of the PoLoRA optimizer from the paper PoLoRA: A Preconditioned Orthogonalized LoRA Optimizer — a drop-in, PEFT-compatible optimizer for LoRA fine-tuning.

Install

pip install -e .                  # the optimizer (torch only)
pip install -r requirements.txt   # + transformers/peft/datasets for the training pipeline

Usage

from peft import LoraConfig, get_peft_model
from polora import Polora

model = get_peft_model(model, LoraConfig(r=256, lora_alpha=256, target_modules="all-linear"))
model.to("cuda")  # move to the target device BEFORE constructing the optimizer
opt = Polora(model, lr=1e-2)
# opt = Polora(model, lr=1e-2, compile=True)  # torch.compile the optimizer kernels
# opt = Polora(pairs=[(A, B), ...], lr=1e-2)  # non-PEFT use: pass factor pairs directly

for batch in loader:
    model(**batch).loss.backward()
    opt.step()
    opt.zero_grad()

Training

The configs used in the experiments for the paper are in configs/:

python prepare_data.py --dataset openmath --model_name meta-llama/Llama-3.2-1B \
    --max_train_samples 2_000_000 --max_eval_samples 1024 --tokenize_num_proc 8
python train.py --config configs/llama32_openmath_r256.json
  • Any config field can be overridden on the CLI, booleans included (--no-compile).
  • --optimizer adamw runs the Adam baseline.
  • The data/ cache defaults to the repo folder; pass an absolute --out or --data_dir to keep it elsewhere.

Citation

@misc{ghosh2026polora,
  title         = {PoLoRA: A Preconditioned Orthogonalized LoRA Optimizer},
  author        = {Ghosh, Nikhil and Parshakova, Tetiana and Gower, Robert M.},
  year          = {2026},
  eprint        = {2607.17620},
  archivePrefix = {arXiv},
  primaryClass  = {cs.LG},
  url           = {https://arxiv.org/abs/2607.17620}
}

License

Apache-2.0

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages