# How to fine-tune an LLM with LlamaFactory

To fine-tune an LLM with LlamaFactory, pick a base model, a dataset and a method such as LoRA, QLoRA or full fine-tuning in its LlamaBoard web UI; on NVIDIA Brev, the LlamaFactory (LlamaBoard) Launchable runs LlamaFactory with Qwen/Qwen3-8B as the default base model on one NVIDIA L40S 48GB GPU.

Updated: 2026-12-03

## What does the LlamaFactory Launchable run?

It runs LlamaFactory v0.9.5 with its LlamaBoard web UI from the official `hiyouga/llamafactory:0.9.5` container image, pinned by digest. A Launchable is a reproducible, shareable environment configuration on NVIDIA Brev: GPU, disk, container setup and ports in one link ([NVIDIA Brev Launchables](https://docs.nvidia.com/brev/latest/concepts/launchables.md)).

| Setting | Default |
|---|---|
| GPU | 1x NVIDIA L40S 48GB |
| Instance type | AWS `g6e.xlarge` |
| Disk | 256 GiB |
| Price | about $2.23/hr (Brev console, 2026-11-15) |
| Base model | `Qwen/Qwen3-8B` |
| LlamaBoard port | `7860` |
| Licences | LlamaFactory Apache-2.0; `Qwen/Qwen3-8B` Apache-2.0 |

The README of the [LlamaFactory (LlamaBoard) Launchable](https://www.9owls.com/launchables/llama-factory/) also lists `Qwen/Qwen3-4B-Instruct-2507` and `meta-llama/Llama-3.1-8B-Instruct` as base model options, and you can set any Hugging Face model path in LlamaBoard. Each model keeps its own licence. For other training stacks, see [fine-tuning](https://www.9owls.com/topics/fine-tuning/).

## LoRA vs QLoRA vs full fine-tuning: which should I pick?

Pick LoRA or QLoRA when you want to train small adapters on a frozen base model; pick full fine-tuning when you need to update every weight. LlamaFactory supports full-tuning, freeze-tuning, LoRA and QLoRA, among other methods ([LlamaFactory README](https://github.com/hiyouga/LlamaFactory)).

| Method | What it trains | Source |
|---|---|---|
| LoRA | Freezes the pre-trained weights and trains small low-rank matrices injected into each Transformer layer | [LoRA paper](https://arxiv.org/abs/2106.09685) |
| QLoRA | Backpropagates through a frozen, quantized base model into LoRA adapters, to use less GPU memory than LoRA on full-precision weights | [QLoRA paper](https://arxiv.org/abs/2305.14314) |
| Full fine-tuning | Updates all model weights; it needs far more GPU memory than LoRA or QLoRA | [Launchable README](https://github.com/ashishsalve/gpu-launchables/blob/main/llama-factory/README.md) |

A LoRA or QLoRA run produces an adapter that you can merge into the base model at export. For LoRA on image models instead of LLMs, read [train a FLUX LoRA on a cloud GPU](https://www.9owls.com/guides/train-a-flux-lora-on-a-cloud-gpu/).

## How do I run a first fine-tune in LlamaBoard?

Open LlamaBoard, set the model path, pick a method and a bundled dataset, and start training. These steps follow the Launchable README:

1. Open the LlamaBoard link, or forward the port with `brev port-forward INSTANCE_NAME --port 7860:7860`.
2. Wait for the base model download; its log is `/root/workspace/llamafactory/logs/model-fetch.log`.
3. Set the model path and select a fine-tuning method, for example LoRA.
4. Choose a dataset; bundled examples such as `identity` work without uploads.
5. Start training.
6. Chat with the result in LlamaBoard, then export the trained model.

Datasets, checkpoints, downloaded models, the Hugging Face cache and the LlamaBoard settings live under `/root/workspace/llamafactory/`.

## How do I serve the result?

Export the model, then serve it through an OpenAI-compatible API. The LlamaFactory README gives the commands ([LlamaFactory README](https://github.com/hiyouga/LlamaFactory)):

1. Merge a LoRA adapter into the base model with LlamaBoard's export step, or with `llamafactory-cli export examples/merge_lora/qwen3_lora_sft.yaml`.
2. Serve it with the vLLM backend: `API_PORT=8000 llamafactory-cli api examples/inference/qwen3.yaml infer_backend=vllm vllm_enforce_eager=true`.
3. Or load the exported model into your own vLLM server, as in [serve an OpenAI-compatible API with vLLM](https://www.9owls.com/guides/serve-an-openai-compatible-api-with-vllm/).

The Launchable exposes LlamaBoard on port `7860`; check which other ports you open before you serve an API from the instance.

## How do I deploy it on NVIDIA Brev?

Deploy it from its Launchable page and open LlamaBoard on port `7860`. The full flow is in [how to deploy a Launchable on NVIDIA Brev](https://www.9owls.com/guides/deploy-a-launchable-on-nvidia-brev/).

1. Open the [LlamaFactory (LlamaBoard)](https://www.9owls.com/launchables/llama-factory/) page and click its launch button.
2. Deploy and wait for the instance to show Running.
3. Open LlamaBoard on port `7860`, or forward the port with the `brev` CLI.
4. Wait for the base model download before you start training.

## What happens when I stop or delete the instance?

Stop keeps your files; Delete removes them. Read [how to stop, start and delete an NVIDIA Brev instance](https://www.9owls.com/guides/stop-start-and-delete-an-nvidia-brev-instance/) for the console and CLI steps.

- Stop the instance when you are not training. Datasets, checkpoints and exports are written under `/root/workspace/llamafactory/` inside the container; Delete removes them. Copy exports off the instance before you stop or delete it.
- Storage is still billed while the instance is stopped.
- Delete removes the instance and every file on it, including datasets, checkpoints and exported models.

> **Warning:** Delete cannot be undone. Copy exported models off the instance first.

## How does this relate to NightKeeper?

This Launchable is a finished environment you deploy yourself. NightKeeper is a separate 9owls product for your own code: it packages your repository as an NVIDIA Brev Launchable, proves it on a fresh GPU and keeps it running.

- [Read about NightKeeper](https://www.9owls.com/nightkeeper/).
- [Create your Launchable](https://www.9owls.com/nightkeeper/start/).

## Sources: where do these facts come from?

- [LlamaFactory (LlamaBoard) Launchable README](https://github.com/ashishsalve/gpu-launchables/blob/main/llama-factory/README.md), read 2026-11-22
- [LlamaFactory README](https://github.com/hiyouga/LlamaFactory), read 2026-11-22
- [LoRA: Low-Rank Adaptation of Large Language Models](https://arxiv.org/abs/2106.09685), read 2026-11-22
- [QLoRA: Efficient Finetuning of Quantized LLMs](https://arxiv.org/abs/2305.14314), read 2026-11-22
- [NVIDIA Brev Launchables](https://docs.nvidia.com/brev/latest/concepts/launchables.md), read 2026-11-22

## Related pages

- [LlamaFactory (LlamaBoard)](https://www.9owls.com/launchables/llama-factory/)
- [Fine-tuning](https://www.9owls.com/topics/fine-tuning/)
- [Serve an OpenAI-compatible API with vLLM](https://www.9owls.com/guides/serve-an-openai-compatible-api-with-vllm/)
- [Train a FLUX LoRA on a cloud GPU](https://www.9owls.com/guides/train-a-flux-lora-on-a-cloud-gpu/)

[All guides](https://www.9owls.com/guides/)
