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

# FLUX.2 [klein] Training

> Fine-tune FLUX.2 [klein] models with custom datasets using LoRA training for specialized image generation.

<img noZoom src="https://cdn.sanity.io/images/2gpum2i6/production/e09038959c1ec2beaa3aeb077974ffd7b928471b-1440x1072.png" style={{ borderRadius: '24px' }} alt="FLUX.2 Klein Training" />

This guide covers how to train LoRAs and fine-tune FLUX.2 \[klein] models on your own datasets. With open weights available under Apache 2.0 (4B) and FLUX Non-Commercial License (9B), you can create custom models tailored to your specific needs.

## Overview

FLUX.2 \[klein] Base models are ideal for fine-tuning due to their undistilled architecture, which preserves the full training signal. This makes them perfect for:

* **LoRA Training**: Lightweight adapters for style transfer and character consistency
* **Full Fine-tuning**: Complete model adaptation for specialized domains
* **Research**: Experimentation with novel training techniques

## Why Train FLUX.2 \[klein] Models?

<CardGroup cols={2}>
  <Card title="Style Transfer" icon="palette">
    Create custom artistic styles that can be applied to any subject matter. Perfect for consistent branding or artistic projects.
  </Card>

  <Card title="Character Consistency" icon="user">
    Train models to generate specific characters or people with consistent features across different scenes and poses.
  </Card>

  <Card title="Domain Specialization" icon="microscope">
    Adapt models for specialized domains like medical imaging, technical illustrations, or specific art movements.
  </Card>

  <Card title="Concept Learning" icon="lightbulb">
    Teach the model new concepts, objects, or visual patterns not well-represented in the base training data.
  </Card>
</CardGroup>

## Community Tools

Open-source frameworks provide full control over the training process:

<CardGroup cols={2}>
  <Card title="AI-Toolkit" icon="robot" href="https://github.com/ostris/ai-toolkit">
    All-in-one training suite with GUI and CLI. Optimized for consumer GPUs with 12GB+ VRAM.
  </Card>

  <Card title="Diffusers" icon="sparkles" href="https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/README_flux2.md">
    Official Hugging Face library with DreamBooth and LoRA training examples for FLUX.2.
  </Card>
</CardGroup>

## Model Variants

Choose the right \[klein] variant for your use case:

| Variant                                                                            | **Best For**                      | **License**         |
| ---------------------------------------------------------------------------------- | --------------------------------- | ------------------- |
| [**klein 4B Base**](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-4B) | Quick iterations                  | Apache 2.0          |
| [**klein 9B Base**](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9B) | Maximum quality, complex concepts | FLUX Non-Commercial |

<Note>
  Base models are undistilled and provide higher output diversity, making them ideal starting points for fine-tuning. The 4B variant is recommended for most users due to lower hardware requirements.
</Note>

## System Requirements

### Minimum Hardware

<CardGroup cols={2}>
  <Card title="For klein 4B Base Training" icon="microchip">
    * **GPU**: NVIDIA with 12GB VRAM (RTX 3060 12GB, RTX 4060 Ti 16GB)
    * **RAM**: 32GB system memory
  </Card>

  <Card title="For klein 9B Base Training" icon="server">
    * **GPU**: NVIDIA with 22GB VRAM (RTX 3090, RTX 4090)
    * **RAM**: 64GB system memory
  </Card>
</CardGroup>

## Training Types

### LoRA Training

**Low-Rank Adaptation (LoRA)** is the most popular training method:

* ✅ Lightweight (typically 10-200MB)
* ✅ Fast training (1-3 hours on consumer GPUs)
* ✅ Easy to share and combine
* ✅ Minimal hardware requirements

**Use cases**: Style transfer, character consistency, concept learning

### Full Fine-tuning

Complete model adaptation for maximum control:

* ⚠️ Large file sizes
* ⚠️ Longer training times (days to weeks)
* ⚠️ High-end hardware recommended
* ✅ Maximum flexibility and quality

**Use cases**: Specialized domains, production deployments, checkpoint training, research

## Getting Started

<Card title="Step-by-Step Training Example" icon="play" href="/flux_2/flux2_klein_training_example">
  Follow our complete hands-on guide with a real dataset example. Learn how to prepare data, configure training, and use your trained LoRA.
</Card>

### Quick Start Resources

<CardGroup cols={2}>
  <Card title="Download Base Weights" icon="download" href="https://huggingface.co/black-forest-labs">
    Get FLUX.2 Klein base models from Hugging Face.
  </Card>

  <Card title="Prompting Guide" icon="message" href="/guides/prompting_summary">
    Learn how to prompt Klein models effectively.
  </Card>
</CardGroup>

## Training Best Practices

### Dataset Preparation

<AccordionGroup>
  <Accordion title="Image Quality">
    * Use high-resolution images (1024px or higher)
    * Ensure consistent quality across all training images
    * Remove artifacts and low-quality samples
  </Accordion>

  <Accordion title="Caption Writing">
    * Use descriptive, detailed captions
    * Include your trigger word consistently: `[trigger]`
    * Describe everything visible except the style/concept you want to teach the model
  </Accordion>

  <Accordion title="Dataset Diversity">
    * Vary poses, angles, and compositions
    * Include different lighting conditions
    * Mix close-ups with full scenes
    * Avoid repetitive backgrounds
  </Accordion>
</AccordionGroup>

### Training Parameters

<Accordion title="Learning Rate">
  * **LoRA Training**: 8e-5 to 1e-4
  * **Full Fine-tuning**: 1e-5 to 5e-5
  * Lower rates for style, higher for characters
</Accordion>

<Accordion title="Training Steps">
  * **Style LoRAs**: 1500-2500 steps
  * **Character LoRAs**: 1500-3000 steps
  * Monitor sample outputs to avoid overfitting
</Accordion>

<Accordion title="Resolution">
  * Start with 512px for faster iterations
  * Use 1024px or higher for final training
  * Use higher resolution if you want to capture macro details
</Accordion>

## Using Your Trained LoRA

After training, you can use your LoRA with various tools:

<Tabs>
  <Tab title="Python (Diffusers)">
    ```python theme={null}
    import torch
    from diffusers import Flux2KleinPipeline

    pipe = Flux2KleinPipeline.from_pretrained(
        "black-forest-labs/FLUX.2-klein-base-9B", torch_dtype=torch.bfloat16
    )
    pipe.load_lora_weights("path/to/your_lora.safetensors")
    pipe.to("cuda")

    image = pipe(
        "a photo of ohwx in a garden on a sunny day",  # Use your trigger word
        num_inference_steps=50,
        guidance_scale=4.0,
    ).images[0]
    ```
  </Tab>

  <Tab title="ComfyUI">
    1. Place `.safetensors` file in `ComfyUI/models/loras/`
    2. Add "Load LoRA" node to your workflow
    3. Connect to your FLUX Klein model
    4. Use trigger word in prompts
  </Tab>
</Tabs>

## Next Steps

<CardGroup cols={2}>
  <Card title="Training Example" icon="play" href="/flux_2/flux2_klein_training_example">
    Complete step-by-step guide with real dataset.
  </Card>

  <Card title="Prompting Guide" icon="sparkles" href="/guides/prompting_summary">
    Learn effective prompting techniques.
  </Card>

  <Card title="Model Downloads" icon="download" href="https://huggingface.co/black-forest-labs">
    Download \[klein] Base models.
  </Card>

  <Card title="Try Playground" icon="play" href="https://playground.bfl.ai">
    Test FLUX.2 in the playground.
  </Card>
</CardGroup>
