An adapter is a separate set of trainable weights that adjusts a pretrained model while its base weights remain frozen. Training this small parameter set reduces the cost of fine-tuning and helps preserve the base model’s existing knowledge. section 7.1
Choose how to use a trained adapter:
- Merge it into the base model with merge_and_unload() for a standard model without PEFT dependencies; this suits a single specialization where inference speed matters. section 7.3.6
- Keep it separate and load it onto a shared base model when different specializations are needed. Adapter switching adds operational overhead, so routing requests into batches can reduce switching frequency. section 7.3.6
Listing 7.15 Dynamic Adapter Loading over the Base Model
from peft import PeftModel
base_model2 = AutoModelForCausalLM.from_pretrained(
MODEL_NAME,
quantization_config=bnb_config,
device_map="auto",
) #1
model_with_adapter = PeftModel.from_pretrained(
base_model2,
"./qdora_adapter"
) #2
model_with_adapter = PeftModel.from_pretrained(
base_model2,
"./qlora_adapter"
) #3
Shows loading an adapter over a base model with PeftModel.from_pretrained(). section 7.3.6



