> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cadenzalabs.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Fine-tuning & LoRA

> How to specialize a general policy to your robot and task — efficiently — with LoRA.

A modern [VLA model](/labs/models) starts broad and general. **Fine-tuning** is how
you specialize it: take a capable base model and adapt it to *your* robot, *your*
scenes, and *your* tasks using trajectories you've collected. It's almost always
cheaper and more reliable than training a policy from scratch.

## Why not train from scratch?

Training a large policy from zero needs enormous data and compute, and throws away
everything a pretrained model already knows about perception and motion.
Fine-tuning keeps that foundation and only teaches the model what's new about your
task — far less data, far less time.

## Full fine-tuning vs LoRA

The naive approach updates **every** weight in the model. That's expensive to
train, expensive to store, and gives you one monolithic model per task.

**LoRA** (Low-Rank Adaptation) takes a smarter route: freeze the base model and
train small **adapter** weights that slot on top of it.

```mermaid theme={null}
flowchart LR
    BASE["Frozen base model<br/>(billions of params)"] --> OUT["Output"]
    LORA["LoRA adapter<br/>(small, trainable)"] --> OUT
```

|                    | Full fine-tuning      | LoRA                      |
| ------------------ | --------------------- | ------------------------- |
| **Params trained** | All of them           | A tiny fraction           |
| **Training cost**  | High                  | Low                       |
| **Storage**        | A full model per task | One base + small adapters |
| **Swapping tasks** | Reload a whole model  | Swap an adapter           |

Because adapters are small and composable, you keep **one base model** and attach
task-specific adapters as needed — cheap to train, fast to iterate, easy to ship.

## Where the training data comes from

Fine-tuning needs trajectories, and good trajectories are the hard part — see
[Physical AI at a glance](/labs/physical-ai). Cadenza closes that gap by
generating data as a byproduct of simulation: every mission is logged tick-by-tick
and **scored automatically**, so rollouts arrive already labeled and ready to
become a training set.

## The Cadenza workflow

The full loop spans both layers of the stack — you **build** in the
[SDK](/sdk/introduction) and **operate** with the [CLI](/cli-setup/introduction):

1. **Build** the robot, scene, and policy interface in the SDK.
2. **Gather** scored rollouts by running missions in simulation.
3. **Convert** those rollouts into VLA training data.
4. **Train** a LoRA adapter on that data.
5. **Evaluate** the new policy back in simulation — and on hardware.
6. **Repeat**, each pass producing a sharper policy and more data.

From the CLI, steps 2–4 are a couple of commands:

```bash theme={null}
cadenza env run my-project --headless   # gather scored rollouts
cadenza env finetune my-project         # rollouts -> VLA training data
cadenza env lora my-project             # train a LoRA adapter
```

<CardGroup cols={2}>
  <Card title="Build with the SDK" icon="python" href="/sdk/quickstart">
    Stand up a robot and a scene to gather data from.
  </Card>

  <Card title="Run the loop in the CLI" icon="bolt" href="/cli-setup/quickstart">
    Gather rollouts and fine-tune end to end.
  </Card>
</CardGroup>
