Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lora-inference-runtime

Python 3.10+ PyTorch PEFT License: MIT

Production-oriented demonstration of Multi-LoRA adapter management with sub-3ms hot-swap latency.

Efficient serving of multiple specialized adapters sharing a single base model.


What It Does

This project demonstrates the Multi-LoRA Serving pattern used in production systems (e.g., LoRAX, vLLM). It allows an inference engine to serve multiple "specialist" models (SQL, Chat, Code) by swapping small LoRA adapters on top of a shared base model nearly instantaneously.

  • Note on Adapters: This benchmark uses dummy adapters (random weights) to validate runtime architecture and infrastructure efficiency. It is not intended for semantic output evaluation.

Performance Benchmarks (NVIDIA RTX 2070 8GB)

Configuration: Qwen2-0.5B-Instruct (FP16) | Rank-8 LoRA | Median of 10 iterations.

1. Memory & Hot-Swap Efficiency

Metric Value Context
Base Model VRAM 942.32 MB FP16 weights
Per-Adapter Cost ~2.07 MB Rank-8 (q_proj, v_proj)
Average Swap Time 2.30 ms O(1) pointer updates

2. Inference Overhead

Does adding LoRA layers slow down generation?

Config Median Latency (25 tokens) Overhead vs Base
Base Only 438.12 ms 1.00x
Base + LoRA 445.21 ms 1.01x

Insight: Inference overhead is negligible (~1.6%), making Multi-LoRA an extremely efficient way to achieve multi-tenancy.


Related Work & Context

Multi-LoRA serving is a standard pattern in high-scale LLM infrastructure:

  • vLLM: Uses PagedAttention and adapter routing for multi-LoRA support.
  • LoRAX: A dedicated framework by Predibase for serving thousands of adapters.

Related Projects

This runtime is part of a larger LLM systems portfolio:

Serving & Runtime:

Kernel-Level Work:


Quick Start

# 1. Install dependencies
pip install -r requirements.txt

# 2. Create dummy adapters locally
python tools/create_local_adapters.py

# 3. Run benchmarks
export PYTHONPATH=.
python benchmarks/latency_memory.py

License

MIT - Joao Felipe De Souza, 2026

About

High-performance Multi-LoRA inference runtime for serving multiple fine-tuned adapters over a shared base model. Features sub-3ms hot-swapping latency and ~2MB memory footprint per adapter. Optimized for multi-tenant LLM serving.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages