Text Classification
Transformers
lora
fine-tuning
adaptive
research
nested-lora
synaptic-plasticity
rank-adaptation
Run this model with HF Jobs
Run Simo76/Unified-LoRA on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Simo76/Unified-LoRA. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Simo76/Unified-LoRA on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Simo76/Unified-LoRA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Simo76/Unified-LoRA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Simo76/Unified-LoRA")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Simo76/Unified-LoRA", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files123456789101112131415161718192021222324# Unified-LoRA**Adaptive LoRA fine-tuning with nested orbital rank control.**A closed-loop controller that dynamically adjusts LoRA rank during training based on observed stress, using a single adapter with sliced dimensions — no cold start, no capacity loss on transitions.---## Key results### Stress test: task switch (MRPC → SST-2, DistilBERT, 3 seeds)| | Baseline (r=16 fixed) | Unified (orbital) | Delta ||------------------------|-----------------------|-------------------|-----------|| SST-2 Acc (new task) | 0.736 | 0.740 | **+0.004** || MRPC F1 (retention) | 0.526 | 0.515 | -0.011 || Effective rank | 16.0 | 13.6 | || Rank saving | 0% | **15%** | |Under distribution shift, the controller adapts capacity dynamically with 15% rank saving and no performance loss.---### Rank trace under shock (Seed 1)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142# Unified-LoRA**Adaptive LoRA fine-tuning with nested orbital rank control.**A closed-loop controller that dynamically adjusts LoRA rank during training based on observed stress, using a single adapter with sliced dimensions — no cold start, no capacity loss on transitions.## Key results### Stress test: task switch (MRPC → SST-2, DistilBERT, 3 seeds)| | Baseline (r=16 fixed) | Unified (orbital) | Delta ||------------------------|-----------------------|-------------------|------------|| SST-2 Acc (new task) | 0.736 | 0.740 | **+0.004** || MRPC F1 (retention) | 0.526 | 0.515 | -0.011 || Effective rank | 16.0 | 13.6 | || Rank saving | 0% | **15%** | |Under distribution shift, the controller adapts capacity dynamically with 15% rank saving and no performance loss.### Rank trace under shock (Seed 1)```[ 0] r4 r4 r4 r8 r8 r8 r8 r16 r16 r16[ 10] r16 r16 r16 r16 r16 r16 r16 r16 r16 r16...[ 60] <<<SHOCK r16 r16 r16 r16 r16 r16 r16 r16[ 68] r8 r8 r8 r8 r8 r8 r4 r4 r4 r4[ 80] r4 r4 r4 r4 r4 r4 r4 r4 r4 r4[ 92] r8 r16 r16 r16 r16 r16 r16 r16 r16 r16```The controller exhibits **disturbance rejection**: detects the shock, stabilizes, then reallocates capacity only when needed.### Stable task (MRPC only, 120 steps, 3 seeds)| | Baseline (r=16) | Unified | Delta ||--------------|-----------------|---------|--------|| F1 mean | 0.818 | 0.820 | +0.002 || σ | 0.008 | 0.008 | = |On stable training, the controller stays at max rank. Zero degradation.---## How it works### Architecture: nested orbitals (r4 ⊂ r8 ⊂ r16)Unified-LoRA uses a single pair of matrices with rank slicing:```pythonself.lora_A = Parameter(shape=[max_rank, in_features])self.lora_B = Parameter(shape=[out_features, max_rank])h = x @ A[:r, :].Tdelta = h @ B[:, :r].T```Lower ranks reuse learned weights. No reset, no cold start.---### Controller```Stress → increase rankStable → decrease rankNeutral → hold```Stress signal:```φ(t) = |loss - EMA(loss)| + 2.0 × max(0, loss - prev_loss)```Adaptive thresholds (μ ± kσ) → no manual tuning.---## Quick start```pythonfrom controller import setup_unified_lora, set_rankmodel, ctrl = setup_unified_lora(model, max_rank=16)optimizer = torch.optim.AdamW(model.parameters(), lr=5e-5)for batch in train_loader:loss = model(**batch).lossr = ctrl.step(loss.item())set_rank(model, r)loss.backward()optimizer.step()optimizer.zero_grad()```---## Where it helps- Distribution shift- Noisy training- Black-box fine-tuning APIs## Where it doesn't- Clean stable training (no benefit, no harm)---## OverheadO(1) per step. Negligible.---## Control view| Method | Control | Rank ||---------------|------------|---------------|| LoRA | None | constant || AdaLoRA | Open-loop | f(step) || Unified-LoRA | Closed-loop| f(stress) |---## Structure```controller.pyexperiments/docs/notebooks/```---## AuthorSimona Vargiu
README.md+127-9