# llm.LoRAFinetune

``` python
llm.LoRAFinetune(
    epochs=50,
    head_epochs=100,
    lr=0.001,
    adapter_lr=0.0003,
    weight_decay=0.0005,
    batch_size=20,
    noise=0.001,
    hessian_approx=None,
    prior=lk.priors.Isotropic(),
)
```

Fine-tune the adapters and the head, then the head alone, then fit the Laplace approximation.

This is the training of Kristiadi et al. 2024: AdamW on the mean squared error, first on the adapters and the head together, then on the head with the adapters frozen. The Laplace approximation then covers the adapters and the head (`lk.transformers.laplace_lora`), and the marginal likelihood tunes the prior.

The noise is fixed by default. With a few dozen outcomes and a million parameters, the marginal likelihood explains the outcomes away as noise if it may tune it too.

## Parameters

| Name | Type | Description | Default |
|----|----|----|----|
| epochs | int | Passes over the data, adapters and head together. | `50` |
| head_epochs | int | Passes over the data, head alone. | `100` |
| lr | float | The head’s learning rate. | `0.001` |
| adapter_lr | float | The adapters’ learning rate. | `0.0003` |
| weight_decay | float | AdamW’s weight decay. | `0.0005` |
| batch_size | int | Texts per step. | `20` |
| noise | float \| None | The noise variance of the standardized outcomes. `None` tunes it. | `0.001` |
| hessian_approx | Any | As in `lk.transformers.laplace_lora`. | `None` |
| prior | Any | As in `lk.transformers.laplace_lora`. | `lk.priors.Isotropic()` |
