← All articles
Guide · 2026-11-13

Local model fine-tuning for beginners: the LoRA workflow and pitfalls to avoid

Published 2026-11-13
Local model fine-tuning for beginners: the LoRA workflow and pitfalls to avoid
LoRA trains only a small set of added parameters, which suits running the full fine-tuning flow locally at a small scale: prepare a clean small dataset and a small base model first, then follow the official PEFT flow to write the config, train, save the weights, and load them for inference.

1. Conclusion: get a small run working first, then talk about results

The idea behind LoRA is to train only a small set of added parameters instead of touching the whole model. The Hugging Face PEFT documentation says PEFT fine-tunes only a small number of extra parameters, which cuts compute and storage costs markedly while keeping results close to full fine-tuning. When starting out, run the whole flow with a small model and small data first.

This guide is for people who want to try model fine-tuning locally once: a complete chain — prepare data, write the LoRA config, train, save the weights, and load them for inference, following the PEFT quicktour and the Unsloth documentation.

2. What to prepare

Prepare a machine that can run training, with a Python environment. Unsloth supports macOS, Linux, and Windows, along with NVIDIA, AMD, and other hardware; on desktop you can download Unsloth Desktop. Set memory and data size according to your chosen base model and the documentation guidance.

Then prepare two more things: a small, clean dataset, where a few dozen to a few hundred examples are enough to verify the flow; and a small base model, at the scale of Llama-3.2-1B used in the PEFT quicktour.

3. Step by step: from dataset to a first set of LoRA weights

Install PEFT and Transformers first, and prepare the tokenized dataset. The PEFT quicktour boils down to three steps: write a LoraConfig, wrap the model with get_peft_model, and hand it to a Trainer. The config must state target_modules, for example adapting only q_proj, set task_type to CAUSAL_LM, and give parameters such as r, lora_alpha, and lora_dropout.

The example config is LoraConfig(target_modules=["q_proj"], task_type=TaskType.CAUSAL_LM, inference_mode=False, r=8, lora_alpha=32, lora_dropout=0.1). Wrap the base model and the config with get_peft_model to create a PeftModel, then call print_trainable_parameters to see the share of trainable parameters: in the official example, Llama-3.2-1B trains only 524,288 parameters, 0.0424% of the total.

Next, set up TrainingArguments with the learning rate, number of epochs, and save strategy, create a Trainer with the model, arguments, and dataset, and call train. When it finishes, save with save_pretrained, which stores only the trained weights, for example the two files adapter_config.json and adapter_model.safetensors.

For inference, load the adapter with AutoPeftModelForCausalLM.from_pretrained, or attach the weights back to the base model with PeftModel.from_pretrained. Test with a few prompts you know well and confirm the output style changed without breaking the format.

4. Common problems and fixes

If training fails at once for lack of memory, switch to a smaller base model, halve the data, and cut the epochs to the minimum that verifies the flow.

If results show no visible change, check the data first: are there too few examples, is the format inconsistent, is the link between prompts and target answers clear? Do not adjust parameters such as r first; data problems cannot be fixed by tuning.

If saved weights fail to load, the base model path and the adapter usually do not match: inference must use the same base model as training, and loading the adapter with from_pretrained must point at the saved directory or Hub path. Switching base models means retraining; old weights cannot be attached directly.

5. Notes

Fine-tuning is not a cure-all. Knowledge the base model lacks is hard to teach with a small amount of data; style, format, and task-specific phrasing are where LoRA usually shows results.

Keep data sources clean: do not train on data of unknown origin or data with privacy or copyright concerns. Before publishing weights to the Hub, confirm the base model license allows it, and document the data and config so others can reproduce the run.

The steps in this article were checked against the official pages on 2026-11-13; if platform rules change, the official pages apply.

Sources

  1. PEFT
  2. Quicktour
  3. Unsloth Docs

This article is compiled from the public sources above and does not reproduce the originals in full; see the official sources for details.

Sign in to Lumo

Sign in with a one-time code sent to your email — no password. Your saved tools will sync across your devices.

The code is only used to sign you in. We store just your email and saved list (privacy policy, in Chinese).

—

Signed in. Your saved tools sync across all your devices.

0saved
View saved tools

Send feedback

Found a mistake, missing something, or have a suggestion? Tell us.