> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/de/modelle/qwen3.8/train.md). Agents can also search and read this documentation through its [MCP server](https://unsloth.ai/docs/~gitbook/mcp).

# Qwen3.8-Fine-Tuning-Leitfaden

Erfahre, wie du Qwen3.8-27B mit Unsloth feinabstimmst.

Qwen3.8-27B kann jetzt mit Reinforcement Learning (RL) feinabgestimmt und trainiert werden – mit [Unsloth](https://github.com/unslothai/unsloth). Es handelt sich um ein dichtes, einheitliches Vision-Language-Modell mit 27B Parametern, nativer Unterstützung für Text, Bilder und Videos, steuerbarem Denkmodus und einem Kontextfenster von 262K.

* Unsloth trainiert Qwen3.8 **\~1,5-mal schneller** mit **\~50 % weniger VRAM** als FA2-Setups (ohne Genauigkeitsverlust)
* Qwen3.8-27B feinabstimmen über unsere **kostenlosen** **Kaggle-Notebooks**:

| [**Konversationell**](https://www.kaggle.com/notebooks/welcome?src=https://github.com/unslothai/notebooks/blob/main/nb/Kaggle-Qwen3.8_\(27B\)-Conversational.ipynb\&accelerator=nvidiaTeslaT4) (Vision kann aktiviert werden) | [**RL GRPO**](https://www.kaggle.com/notebooks/welcome?src=https://github.com/unslothai/notebooks/blob/main/nb/Kaggle-Muse_Glimmer_\(30B\)-GRPO.ipynb\&accelerator=nvidiaTeslaT4) |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

* **QLoRA funktioniert mit 24 GB** und LoRA benötigt >36 GB
* Qwen3.8 lässt sich auch mit [Reinforcement Learning](#reinforcement-learning-rl) (RL) kostenlos oder mit 24 GB VRAM trainieren.
* **Vollständige Feinabstimmung (FFT)** funktioniert ebenfalls, benötigt aber viermal so viel VRAM.
* Unsloth nutzt **Flash-Linear-Attention-Kernels** für ein effizientes Training von Qwen3.8
* Verwende [`Qwen3.8-27B-unsloth-bnb-4bit`](https://huggingface.co/unsloth/Qwen3.8-27B-unsloth-bnb-4bit) für 4-Bit-QLoRA und **exportiere** anschließend nach NVFP4, FP8, GGUF usw.
* Wenn du die Fähigkeit zum Schlussfolgern erhalten möchtest, kombiniere Beispiele im Stil von Schlussfolgerungen mit direkten Antworten und achte darauf, dass mindestens 75 % der Daten Schlussfolgerungen enthalten.

Verwende bitte die neueste Version von Transformers v5. Qwen3.8 verwendet die `qwen3_5` -Architektur. Beim ersten Lauf kann es länger dauern, während die Gated-DeltaNet-Kernels kompiliert werden.

{% hint style="success" %}
Für die kostenlose Feinabstimmung von Qwen3.8-27B über [Unsloth](https://github.com/unslothai/unsloth)stellen wir mehrere Kaggle-Notebooks bereit, die **30 Stunden kostenlose GPU-Nutzung mit 2× Tesla-T4-GPUs**bieten. Kaggle ist ein Google-Produkt, ähnlich wie Google Colab, und ermöglicht es bequem, Feinabstimmungs-Workflows auszuführen, ohne eigene GPU-Hardware zu benötigen.
{% endhint %}

### 🦥 Unsloth-Anleitung

{% columns %}
{% column %}
Qwen3.8 kann in [Unsloth](https://unsloth.ai/docs/de/neu/studio.md) Desktop ausgeführt und feinabgestimmt werden, unserer neuen Open-Source-Weboberfläche für lokale KI.

Mit Unsloth Studio kannst du Modelle lokal auf **macOS, Windows**, Linux ausführen und auf NVIDIA-GPUs trainieren. Unterstützung für das Training mit Intel, MLX und AMD kommt noch diesen Monat.
{% endcolumn %}

{% column %}

<div data-with-frame="true"><figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FD7qpbGJLY5YMv0E0QgrB%2Ftrainingrun_LLM-unsloth.gif?alt=media&amp;token=feb766a7-1a7b-4f47-b5f4-b38e3a0d1470" alt=""><figcaption></figcaption></figure></div>
{% endcolumn %}
{% endcolumns %}

{% stepper %}
{% step %}

#### Unsloth installieren

Am einfachsten gelingt der Einstieg, indem du die [Unsloth-Desktop-App](https://unsloth.ai/docs/de/desktop.md)herunterlädst. Funktioniert auf [macOS](https://unsloth.ai/docs/de/loslegen/install/mac.md), [Windows](https://unsloth.ai/docs/de/loslegen/install/windows-installation.md) und [Linux](https://unsloth.ai/docs/de/loslegen/install/linux.md).

<a href="https://unsloth.ai/download" class="button primary" data-icon="down-to-bracket">Unsloth herunterladen</a>

* <i class="fa-apple">:apple:</i> [Für macOS herunterladen](https://unsloth.ai/download/mac)
* <i class="fa-windows">:windows:</i> [Für Windows herunterladen](https://unsloth.ai/download/windows)
* <i class="fa-linux">:linux:</i> [Für Linux herunterladen](https://unsloth.ai/download/linux)

Oder, wenn Sie die manuelle Installation bevorzugen:

macOS, Linux, WSL:

```bash
curl -fsSL https://unsloth.ai/install.sh | sh
```

Windows PowerShell:

```bash
irm https://unsloth.ai/install.ps1 | iex
```

{% endstep %}

{% step %}

#### Qwen3.8 trainieren

Wechseln Sie zum Tab „Train“, suchen Sie dann in der Suchleiste nach Qwen3.8-27B und wählen Sie das gewünschte Modell und Dataset aus. Passen Sie anschließend die Hyperparameter und die Kontextlänge nach Bedarf an.

<figure><img src="https://797013937-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FD7qpbGJLY5YMv0E0QgrB%2Ftrainingrun_LLM-unsloth.gif?alt=media&amp;token=feb766a7-1a7b-4f47-b5f4-b38e3a0d1470" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Trainingsfortschritt überwachen

Nachdem Sie auf „Start training“ geklickt haben, können Sie den Trainingsfortschritt des Modells überwachen und verfolgen. Der Trainingsverlust sollte stetig sinken.\
Sobald das Training abgeschlossen ist, wird das Modell automatisch gespeichert.
{% endstep %}

{% step %}

#### Ihr feinabgestimmtes Modell exportieren

Nach Abschluss des Trainings können Sie mit Unsloth Studio das Modell in Formate wie GGUF und Safetensors exportieren.
{% endstep %}

{% step %}

#### Feinabgestimmtes und ursprüngliches Modell vergleichen

Klicken Sie auf `Compare Mode` um den LoRA-Adapter mit dem ursprünglichen Modell zu vergleichen.
{% endstep %}
{% endstepper %}

### SFT-Rezept

Unten finden Sie ein minimales SFT-Rezept für die Feinabstimmung von reinem Text. Ihr Dataset benötigt eine `text` Spalte, die bereits mit der Qwen-Chatvorlage formatiert ist.

{% code expandable="true" %}

```python
from unsloth import FastModel
from datasets import load_dataset
from trl import SFTTrainer, SFTConfig

max_seq_length = 2048

dataset = load_dataset(
    "json",
    data_files = "train.jsonl",
    split = "train",
)

model, tokenizer = FastModel.from_pretrained(
    model_name = "unsloth/Qwen3.8-27B-unsloth-bnb-4bit",
    max_seq_length = max_seq_length,
    load_in_4bit = True,
    full_finetuning = False,
    offload_embedding = True,
)

model = FastModel.get_peft_model(
    model,
    finetune_vision_layers     = False,
    finetune_language_layers   = True,
    finetune_attention_modules = True,
    finetune_mlp_modules       = True,

    r = 16,
    lora_alpha = 16,
    lora_dropout = 0,
    bias = "none",
    use_gradient_checkpointing = "unsloth",
    random_state = 3407,
    use_rslora = False,
    loftq_config = None,
)

trainer = SFTTrainer(
    model = model,
    tokenizer = tokenizer,
    train_dataset = dataset,
    args = SFTConfig(
        dataset_text_field = "text",
        max_seq_length = max_seq_length,
        per_device_train_batch_size = 1,
        gradient_accumulation_steps = 4,
        warmup_steps = 10,
        max_steps = 100,
        learning_rate = 2e-4,
        logging_steps = 1,
        optim = "adamw_8bit",
        output_dir = "outputs_qwen38",
        seed = 3407,
        dataset_num_proc = 1,
        report_to = "none",
    ),
)

trainer.train()
```

{% endcode %}

`offload_embedding=True` ist optional und reduziert den belegten VRAM, indem die große, nicht gebundene Eingabe-Embedding-Tabelle im RAM gehalten wird. Unsloth deaktiviert diese Option auf nicht unterstützten Plattformen automatisch.

Wenn nicht genügend Speicher vorhanden ist (OOM), verringere `max_seq_length` und behalte die Batchgröße 1 bei; verwende außerdem `"unsloth"` für das Gradient Checkpointing.

### Vision-Fine-Tuning

Qwen3.8 unterstützt nativ Bild- und Videoeingaben. Aktiviere für multimodales Training die Vision-Layer und verwende einen konversationellen Vision-Datensatz mit `UnslothVisionDataCollator`.

{% code expandable="true" %}

```python
model = FastModel.get_peft_model(
    model,
    finetune_vision_layers     = True,
    finetune_language_layers   = True,
    finetune_attention_modules = True,
    finetune_mlp_modules       = True,

    r = 16,
    lora_alpha = 16,
    lora_dropout = 0,
    bias = "none",
    use_gradient_checkpointing = "unsloth",
    random_state = 3407,
    use_rslora = False,
    loftq_config = None,
)
```

{% endcode %}

Setze `finetune_vision_layers=False` wenn dein Datensatz nur Text enthält.

### Reinforcement Learning (RL)

Qwen3.8 verwendet dieselbe `qwen3_5` Architektur. Verwende daher den Unsloth-RL-Pfad für Qwen3.5 und deaktiviere die schnelle vLLM-Inferenz:

```python
from unsloth import FastModel

model, tokenizer = FastModel.from_pretrained(
    model_name = "unsloth/Qwen3.8-27B-unsloth-bnb-4bit",
    max_seq_length = 2048,
    load_in_4bit = True,
    fast_inference = False,
)
```

### Fine-getuntes Modell speichern/exportieren

Verwende bei der Bereitstellung dieselbe Chat-Vorlage und dasselbe EOS-Token wie beim Training.

**Als GGUF speichern**

```python
model.save_pretrained_gguf(
    "qwen38_gguf",
    tokenizer,
    quantization_method = "q4_k_m",
)

# model.push_to_hub_gguf(
#     "hf_username/qwen38_gguf",
#     tokenizer,
#     quantization_method = "q4_k_m",
# )
```

**Für vLLM speichern**

```python
model.save_pretrained_merged(
    "qwen38_finetuned",
    tokenizer,
    save_method = "merged_16bit",
)
```

So speichern Sie nur die LoRA-Adapter:

```python
model.save_pretrained("qwen38_lora")
tokenizer.save_pretrained("qwen38_lora")
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://unsloth.ai/docs/de/modelle/qwen3.8/train.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
