microsoft / microsoft/onnxruntime-genai
LORA speed degradation
- Dominant language
- C++
- Stars
- 1.1k
- Forks
- 354
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 85
Description
**Describe the bug**
Experiments show that enabling lora on onnx formatted base models via the olive (onnx-live) framework, results in a signficant drop in prefill & generation performance. While some slowdown is expected due to the added parameters, the hit we observe is significant - ex: **rank 8 adapter (~11M params) causes a 30% slowdown in token generation vs. vanilla onnx model with no lora enabled**
Moreover in our experiments we use `meta-llama/Llama-3.2-1B-Instruct` as a representative base model, and observe that degradation in token generation is superlinear with respect to adapter rank (regardless whether the adapter is swapped on/off)
Snapshot of matmul kernel
**To Reproduce**
```bash
olive auto-opt \
--model_name_or_path $adapter_base_model \
--adapter_path $adapter_path \
--device cpu \
--provider CPUExecutionProvider \
--use_ort_genai \
--output_path $output_folder \
--log_level 1 \
--precision int4 \
--use_model_builder
rm -rf ./.olive-cache
```
**Desktop (please complete the following information):**
- OS: validated on macOS (m3) and linux x86
- backend: CPU
- quantization: 4bit
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running the provided olive auto-opt command with the listed CPU settings and Llama-3.2-1B-Instruct, then compare vanilla and LoRA-enabled token generation across adapter ranks. Use the attached matmul-kernel snapshots as context while locating the source of the superlinear slowdown. Done means reproducing the degradation and identifying or documenting its cause; no source file or test is named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend, machine-learning, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100