ANTIGRAVITY LABJP
Articles/AI Tools
AI Tools/2026-04-22Advanced

Running Multiple Gemma 4 LoRAs in Production — A Practical Guide to Merging and Dynamic Adapter Switching

You've trained three LoRAs on Gemma 4 — one for summarization, one for translation, one for code review. Now the real question: how do you serve them in production without tripling your GPU bill? This is my working notebook on merging and dynamic switching, written with Antigravity alongside.

gemma-419lora4mergekitpeft2multi-taskantigravity430

Premium Article

The morning after I finished training three LoRAs

Summarization, English-Japanese translation, code review. I spent a weekend training separate LoRAs on top of Gemma 4 for three different internal use cases. Each one posted respectable benchmark numbers. I went to bed satisfied.

The next morning, a product engineer asked me the question that mattered: "Can you put all three on one server and switch between them per request?" Inference cost had to stay low. The chat UI had to flip from summary mode to translation mode fluidly. Running three LoRAs on three separate servers is a luxury that doesn't fit a solo developer's budget, and honestly not a small team's either.

This article is the working notebook from that week. It covers two practical approaches — LoRA merging and dynamic adapter switching — and walks through the places I actually got stuck, with Antigravity's agent riding along. If you've already done some fine-tuning and are wondering how to graduate to multi-task serving, this is for you.

If you haven't trained a LoRA yet, start with my earlier piece on LoRA / QLoRA fine-tuning for Gemma 4 first — the current article assumes you have at least two LoRA checkpoints ready.

Three paths — and how I decide between them

When you have multiple LoRAs trained for different tasks, your options collapse into three:

  • Strategy A: Merge them into a single model. You combine the adapter weights into one, then deploy it as an ordinary Gemma 4 checkpoint. Your inference path stays simple, and vLLM, TGI, or Ollama run it without modification.
  • Strategy B: Keep one base model and swap adapters per request. Gemma 4 stays loaded. The LoRA adapter is what changes, driven by task routing. You save memory but pay a switching cost and inherit a concurrency headache.
  • Strategy C: Activate multiple adapters in parallel with a weighted router. Frameworks like S-LoRA or peft's multi-adapter mode can serve several LoRAs simultaneously, mixing them per request. Maximum flexibility, maximum operational complexity.

My rule of thumb, after running all three in production:

  • Two or three tasks that are adjacent in nature (EN→JA translation and JA→EN translation, or summarization and extraction) → Strategy A (merge)
  • Four or more independent tasks (summary, code review, SQL generation, OCR post-processing) → Strategy B (dynamic switching)
  • Tasks whose boundaries blur (technical-document translation vs. casual-voice translation) → Strategy C (multi-adapter)

The rest of this article is about Strategies A and B. Strategy C tends to require running your own optimized inference server, and for a solo developer it's rarely the right starting point. I'll touch on its conceptual shape at the end.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
If you've trained several LoRAs but weren't sure how to actually serve them, you'll walk away with three concrete production patterns you can choose between today
You'll learn how Weighted, TIES, and DARE merges really differ — not as theory, but as trade-offs you can verify on your own data within an afternoon
You'll build a dynamic-LoRA inference server with Antigravity's help, so one Gemma 4 base model can power multiple products without multiplying your GPU cost
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

AI Tools2026-04-21
Tuning Gemma 4 for Yourself — A Realistic LoRA / QLoRA Workflow on a Solo Developer's Budget
Full fine-tuning of Gemma 4 is out of reach for most individuals, but LoRA / QLoRA makes personalization realistic on a solo budget. This guide walks through data prep, training settings, evaluation, and wiring the result into an Antigravity workflow — from hard-earned practical experience.
AI Tools2026-06-12
Cutting Down 'Plausible but Wrong' RAG Answers — A Retrieval Evaluation Harness for Gemma 4 and Antigravity
Replace gut feeling with recall@5, MRR and faithfulness scores — a 30-question golden dataset and a small Python harness for evaluating a local Gemma 4 RAG stack.
AI Tools2026-05-10
Gemma 4 on Antigravity: Picking Q4 vs Q5 — What I Found After a Week on M2 Mac
A hands-on comparison of Gemma 4 quantization variants (Q4_K_M / Q5_K_M / Q8_0 / fp16) running locally with Antigravity on a 16GB M2 Mac, measured across speed, memory, and output quality.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →