Skip to content

Conversation

@chen2021673
Copy link
Contributor

Summary

Added LoRA (Low-Rank Adaptation) support for parameter-efficient fine-tuning. This feature significantly reduces the number of trainable parameters through low-rank decomposition, enabling efficient fine-tuning of large models.

Changes

New Features

LoRA Infrastructure (infini_train/include/nn/lora/):

  • lora_config.h/cc - LoRA configuration (rank, alpha, dropout)
  • lora_linear.h/cc - LoRA linear layer wrapper
  • lora_model.h/cc - Multi-LoRA layer management
  • lora_parallel_linear.h/cc - Tensor parallelism support
  • lora_utils.h/cc - Utility functions

Tests:

  • test/lora/test_lora.cc - Unit tests

Documentation:

  • docs/lora_usage.md - Usage documentation

Examples:

  • example/gpt2/main.cc - Added LoRA training example

Build:

  • CMakeLists.txt - Added test_lora build target

Technical Details

LoRA adds trainable low-rank adapters to frozen model weights:

- Add LoRA module infrastructure with configurable rank, alpha, dropout
- Implement LoRALinear wrapper for seamless integration with Linear layers
- Support tensor parallelism via LoRAParallelLinear
- Add LoRAModel utility for managing multiple LoRA layers
- Integrate LoRA configuration and utilities
- Add GPT2 example demonstrating LoRA fine-tuning
- Include comprehensive usage documentation and test suite

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant