Skip to content
lishenghuiPublic

About

[EACL 2027] FraQ: Efficient Coordinate-Space Recompression for Federated Low-Rank Adaptation

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

FraQ: Efficient Coordinate-Space Recompression for Federated Low-Rank Adaptation

Official implementation · EACL 2027

arXiv

Shenghui Li1 · Thiemo Voigt1,2

1 Uppsala University · 2 Research Institutes of Sweden

FraQ combines federated LoRA updates in a compact coordinate space. It supports clients with different adapter ranks and selects the smallest rank per layer that retains a chosen fraction of the update energy, without forming the full weight update.

🛠️ Installation

From the repository root, install PyTorch and safetensors for aggregation. The implementation supports Python 3.10 or newer and was tested with Python 3.12 and PyTorch 2.11.

python -m pip install -r requirements.txt

For federated training and the full test suite, install the additional dependencies.

python -m pip install -r requirements-training.txt pytest
python -m pytest tests

🚀 Quick start

Aggregate two client adapters, using local sample counts as weights.

from fraq import aggregate_fraq

aggregate_fraq(
    client_dirs=["client_a", "client_b"],
    output_dir="global_adapter",
    global_rank=8,
    client_weights=[120, 300],
)

Each client directory contains a PEFT adapter configuration and weights. Pass local sample counts as weights, or omit them for equal weighting. The example produces a rank-8 adapter. Set threshold=0.95 to choose the smallest rank per layer that retains 95% of the energy. In threshold mode, use max_rank for an optional cap.

For tensor inputs, use fraq_factors on a weighted stack of B and A factors. For returning clients, fraq_compress_patches combines missed updates into one patch.

⚙️ Baselines and federated training

Both trainers support the following method names.

Method Training flag
FedIT (factor averaging) fedavg
LoRA-A² lora_a2
FLoRA flora
FedEx-LoRA fedexlora
FlexLoRA flexlora
FLoRG florg
FLoRIST florist
FraQ fraq

Install the training dependencies with python -m pip install -r requirements-training.txt. The trainers expose client sampling, local training, aggregation and checkpointing through their command lines.

  • Classification trainer accepts --methods. Run python fed_lora_simulation.py --help for model and dataset options.
  • Reasoning trainer accepts --method. Run python commonsense_fed_lora.py --help for rank, participation and training options.
  • Server aggregation operates directly on saved adapters. Run python aggregate.py --help for supported standalone modes. FLoRG implements the client adapter and shared bases.
  • Reasoning evaluation uses vLLM 0.23.0 as an optional dependency.

⏱️ Batched decomposition and GPU timing

aggregate_fraq groups layers with matching stacked factor shapes through fraq_layer_groups. Each group makes one call to fraq_factors with B shaped [layers, rows, stack_rank] and A shaped [layers, stack_rank, cols]. It applies Householder QR on the smaller side, forms a compact Gram matrix per layer, calls batched torch.linalg.eigh, and lifts the selected eigenvectors with torch.ormqr. With an energy threshold each layer selects its own rank. Implementation

The MAGMA timing runs used a MAGMA-enabled PyTorch build on GH200. The linear algebra backend can materially affect batched eigendecomposition latency. MAGMA support is a property of the PyTorch binary. Check it in the environment used for timing:

python -c "import torch; print(torch.__version__, torch.version.cuda, torch.cuda.has_magma)"

The verified timing environment used conda-forge PyTorch 2.14.1 (CUDA 13.4), Python 3.11 and libmagma 2.10.0. The training container used PyTorch 2.11.0+cu130 and reported has_magma=False. Look for True in the check above before selecting --backend magma. FraQ also runs with the default PyTorch backend. The backend flag sets PyTorch's preferred library for supported operations; individual kernels follow PyTorch's dispatch rules. In the verified build PyTorch marked the MAGMA preference deprecated and reported that QR attempts cuSOLVER even with this preference.

On a CUDA GPU, compare a batch against a loop over the same FP32 factors. Supply the dimensions and ranks for your workload. For example:

python measure.py --layers 8 --rows 192 --cols 128 --stack-rank 32 --rank 8 \
  --backend magma --warmup 3 --repeats 20

measure.py reports synchronized wall time (mean and sample standard deviation), peak additional memory allocated by PyTorch, GPU model, PyTorch and CUDA versions, and MAGMA availability. Inputs are generated on the GPU before timing. This measures recompression on resident factors and excludes loading adapters, stacking clients, and writing checkpoints. The same measure_cuda(callable) helper can time a baseline on preloaded inputs.

✒️ Citation

If you use FraQ in your research, please cite the paper. arXiv record

@misc{li2026fraqefficientcoordinatespacerecompression,
  title         = {{FraQ}: Efficient Coordinate-Space Recompression for Federated Low-Rank Adaptation},
  author        = {Shenghui Li and Thiemo Voigt},
  year          = {2026},
  eprint        = {2608.03605},
  archivePrefix = {arXiv},
  primaryClass  = {cs.AI},
  url           = {https://arxiv.org/abs/2608.03605}
}

About

[EACL 2027] FraQ: Efficient Coordinate-Space Recompression for Federated Low-Rank Adaptation

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages