Qwen 3

Qwen3 are a family of open source models trained by Alibaba.

This guide shows how to fine-tune it with Axolotl with multi-turn conversations and proper masking.

Getting started

  1. Install Axolotl following the installation guide.

  2. Install Cut Cross Entropy to reduce training VRAM usage.

  3. Run the finetuning example:

    axolotl train examples/qwen3/32b-qlora.yaml
    
    # NVFP4 MoE-LoRA (~31 GiB at sequence_len 2048, ~58 GiB at 16k tokens/step)
    axolotl train examples/qwen3/30b-a3b-nvfp4-lora.yaml
    
    # bake the adapter back into a plain NVFP4 checkpoint (see docs: NVFP4 MoE LoRA)
    axolotl merge-lora examples/qwen3/30b-a3b-nvfp4-lora.yaml

Let us know how it goes. Happy finetuning! 🚀

Chat template masking a few tokens off

If you notice that the chat_template masking for assistant prompts are off by a few tokens, please ensure that you are adding the below to the yaml.

chat_template: qwen3

TIPS

  • For inference, please check the official model card as it depends on your reasoning mode.
  • You can run a full finetuning by removing the adapter: qlora and load_in_4bit: true from the config.
  • Read more on how to load your own dataset at docs.
  • The dataset format follows the OpenAI Messages format as seen here.

Optimization Guides

Please check the Optimizations doc.