AI Hints
Home›Fine-Tuning LLMs Tutorial›Save, Load and Merge Adapters
Fine-Tuning LLMs · Lesson 55 of 120

Saving Adapters

Small files, big results.

⏱ 2 min read▶ Video at 1:26:27🎓 Free
Watch this lesson in the Fine-Tuning LLMs courseWatch on YouTube ↗Full Fine-Tuning LLMs course

After training, we save our work. With LoRA, there's a lovely surprise. We don't save a whole model. We only save the adapter. And it's tiny.

  • Save the work
  • Only the adapter
  • And it's tiny

What's in an adapter folder?

At the end of training, trainer dot save model wrote the adapter to a folder, called ticket LoRA. Let's list each file, with its size. Run it. The adapter weights are under twenty megabytes. The full model is over five hundred. There's also an adapter config, a copy of the tokenizer, and a read me, which is a model card.

app.pypython
import os

for f in sorted(os.listdir("ticket-lora")):
    print(f"{f:28} {os.path.getsize(f'ticket-lora/{f}') / 1e6:6.2f} MB")
Output
README.md                      0.01 MB
adapter_config.json            0.00 MB
adapter_model.safetensors     19.59 MB
chat_template.jinja            0.00 MB
tokenizer.json                 3.52 MB
tokenizer_config.json          0.00 MB
training_args.bin              0.01 MB
Also uses _setup.py
import shutil
shutil.copytree('/Users/hussain/Docker Complete Course/shared-data/ft_cache/ticket-lora', 'ticket-lora')

Why small adapters are great

Small adapters change how you work. You can train a different adapter for every task, or every customer, and keep them all. They're quick to upload, and share. And one copy of the base model can serve many adapters. We'll see that later.

keyvalue
One taskone small adapter
Many customersmany adapters, one base
Sharingfast uploads
Storagemegabytes, not gigabytes

Summary

Let's recap. Trainer dot save model saves only the adapter. It's tiny, compared to the model. And you can keep many adapters for one base model. Next, loading an adapter back.

Key takeaways
  • save_model → adapter only
  • ~20 MB vs 538 MB
  • Many adapters, one base
Next up: Loading Adapters — base model + adapter