Skip to content

Flux 2 Klein LoRA training ​

Train a Flux 2 Klein LoRA for use with the Flux 2 image generation recipe. Two size tiers, plus a special edit-training mode for image-editing LoRAs that take control / reference images at inference time.

modelVariantBaseDefault priceUse when
4b (default)FLUX.2-klein-base-4B500 BuzzCheaper / faster training. Pairs with Klein 4b inference.
9bFLUX.2-klein-base-9B1000 BuzzHigher fidelity. Pairs with Klein 9b inference.

The base checkpoint is fixed by modelVariant; there is no model field on the input. Set isEditTraining: true to train an editing LoRA — the dataset zip layout changes (see Edit training).

Submit with wait=0: a typical 2000-step run lands in single-digit minutes for 4b, longer for 9b. The request fields, training data, continuing a run and live progress are shared by every ecosystem — see the LoRA training overview.

The request shape ​

json
{
  "$type": "training",
  "input": {
    "engine":         "ai-toolkit",
    "ecosystem":      "flux2klein",
    "modelVariant":   "4b",         // 4b | 9b
    "isEditTraining": false         // optional, defaults to false
  }
}

Prerequisites ​

  • A training-data zip addressed by an AIR (accepted sources):
    • For standard training: a flat zip of training images
    • For edit training: a zip with main/, control_1/, control_2/, control_3/ subfolders

Klein 4b (default) ​

Fastest and cheapest tier. Default for most LoRAs.

http
POST https://orchestration.civitai.com/v2/consumer/workflows?wait=0
Authorization: Bearer <your-token>
Content-Type: application/json

{
  "tags": ["training"],
  "steps": [{
    "$type": "training",
    "priority": "normal",
    "retries": 2,
    "input": {
      "engine": "ai-toolkit",
      "ecosystem": "flux2klein",
      "modelVariant": "4b",
      "steps": 2000,
      "lr": 0.0005,
      "trainTextEncoder": false,
      "lrScheduler": "constant",
      "optimizerType": "adamw8bit",
      "networkDim": 2,
      "networkAlpha": 1,
      "trainingData": {
        "type": "zip",
        "sourceUrl": "urn:air:other:other:huggingface:datasets/Civitai/orchestration-samples@e86d025874700507615ae8ef74937c319ea41dfe/sample-training-dataset.zip",
        "count": 15
      },
      "samples": {
        "prompts": [
          "fruit, food, no humans, blue eyes, solo, leaf, strawberry, fangs, pokemon (creature)",
          "no humans, pokemon (creature), cup, food, solo, bird, blush, blurry, animal focus",
          "no humans, candle, pokemon (creature), blurry, animal focus, solo, food, bird, standing"
        ]
      }
    }
  }]
}
POST/v2/consumer/workflows
Set your Civitai API token via the Token button in the navbar to enable Try It.
Request body — edit to customize (e.g. swap the image URL or prompt)
Valid JSON

Klein 9b ​

Same shape, larger base model. Recommended steps: 2000+, networkDim: 32, lr: ~1e-4.

http
POST https://orchestration.civitai.com/v2/consumer/workflows?wait=0
Authorization: Bearer <your-token>
Content-Type: application/json

{
  "tags": ["training"],
  "steps": [{
    "$type": "training",
    "priority": "normal",
    "retries": 2,
    "input": {
      "engine": "ai-toolkit",
      "ecosystem": "flux2klein",
      "modelVariant": "9b",
      "steps": 2000,
      "resolution": 1024,
      "lr": 0.000102,
      "trainTextEncoder": false,
      "lrScheduler": "cosine",
      "optimizerType": "adamw8bit",
      "networkDim": 32,
      "networkAlpha": 32,
      "trainingData": {
        "type": "zip",
        "sourceUrl": "urn:air:other:other:huggingface:datasets/Civitai/orchestration-samples@e86d025874700507615ae8ef74937c319ea41dfe/sample-training-dataset.zip",
        "count": 15
      },
      "samples": { "prompts": [] }
    }
  }]
}
POST/v2/consumer/workflows
Set your Civitai API token via the Token button in the navbar to enable Try It.
Request body — edit to customize (e.g. swap the image URL or prompt)
Valid JSON

Edit training ​

Setting isEditTraining: true produces an editing LoRA — at inference time it takes one or more reference images alongside the prompt and modifies them. The dataset zip layout differs:

  • main/ — target images (what the LoRA should produce)
  • control_1/, control_2/, control_3/ — reference / source images that pair with each main/ entry

Filenames inside the subfolders must align across folders. Reading the result you'll get a LoRA that works with Flux 2 Klein → editImage.

http
POST https://orchestration.civitai.com/v2/consumer/workflows?wait=0
Authorization: Bearer <your-token>
Content-Type: application/json

{
  "tags": ["training", "edit"],
  "steps": [{
    "$type": "training",
    "priority": "normal",
    "retries": 2,
    "input": {
      "engine": "ai-toolkit",
      "ecosystem": "flux2klein",
      "modelVariant": "4b",
      "isEditTraining": true,
      "steps": 2000,
      "lr": 0.0001,
      "trainTextEncoder": false,
      "lrScheduler": "cosine",
      "optimizerType": "adamw8bit",
      "networkDim": 32,
      "networkAlpha": 32,
      "trainingData": {
        "type": "zip",
        "sourceUrl": "https://example.com/your-edit-dataset.zip",
        "count": 3
      },
      "samples": {
        "prompts": [
          "a portrait of a woman standing in a sunlit garden with flowers",
          "a landscape painting of rolling hills at sunset",
          "a painting of a cat sitting on a windowsill looking outside at a rainy day"
        ],
        "sourceImages": [
          "https://example.com/your-source-image-1.jpg",
          "https://example.com/your-source-image-2.jpg"
        ]
      }
    }
  }]
}

Placeholder URLs

Replace the https://example.com/… URLs with your own edit-training zip and reference images before submitting.

POST/v2/consumer/workflows
Set your Civitai API token via the Token button in the navbar to enable Try It.
Request body — edit to customize (e.g. swap the image URL or prompt)
Valid JSON

samples.sourceImages is required for edit training when you want preview samples — the listed URLs become the reference images for the per-checkpoint sample renders.

Klein parameters ​

Fields and defaults not listed here are as in the overview's common parameters.

FieldKlein defaultNotes
modelVariant✅ required4b or 9b.
isEditTrainingfalseWhen true, dataset zip must contain main/ + control_*/ subfolders.
epochsround(steps / 200)Each adds 10 Buzz of storage.
batchSize1For 4b, up to 2; for 9b it is fixed at 1.
continueFrom(none)A Klein (urn:air:flux2:lora:...) LoRA to resume from.
lr0.0001Klein is sensitive to high LRs — keep in 1e-4–5e-4.
trainTextEncoderfalseKlein uses Qwen-3 as its text encoder; AI Toolkit does not train it. Leave false.
networkDim32Klein LoRAs are typically 16–32.
trainingData.count✅ (zip)For edit training, count should equal the number of main/ entries.
samples.sourceImages[][]Edit-training only — reference images for sample renders.

Reading the result ​

The standard training output: each saved checkpoint yields a Klein LoRA .safetensors blob plus any sample images.

To use the trained LoRA, register it on Civitai (or reference its blob URN directly) and pass it under loras in a Flux 2 Klein generation request:

json
{
  "$type": "imageGen",
  "input": {
    "engine": "flux2",
    "model": "klein",
    "operation": "createImage",
    "modelVersion": "4b",
    "prompt": "your prompt",
    "loras": { "urn:air:flux2:lora:civitai:<id>@<version>": 1.0 }
  }
}

Runtime ​

Per-step wall time, default settings on a 10-image dataset:

VariantPer-stepTypical full run
4b~0.1–0.3 s3–10 min for 2000 steps
9b~0.3–0.6 s10–30 min for 2000 steps
4b + isEditTraining~0.2–0.5 s5–15 min for 2000 steps

Cost ​

The training cost formula with Klein rates:

price = steps × costPerStep + epochs × 10        (rounded)
costPerStep = 0.20 (4b), 0.45 (9b)
floor: never less than 80% of the default-configuration price

Each epoch adds 10 Buzz of storage. With both steps and epochs omitted the run is 2000 steps / 10 epochs (the examples at the top of the page send steps: 2000, which also resolves to 10 epochs):

  • 4b: 2000 × 0.20 + 10 × 10 = 400 + 100 = 500 Buzz (floor 400)
  • 9b: 2000 × 0.45 + 10 × 10 = 900 + 100 = 1000 Buzz (floor 800)
ConfigurationBuzz
Klein 4b, default (steps: 2000, epochs: 10)500 + samples
Klein 4b, steps: 1000, epochs: 10400 + samples (floor)
Klein 9b, default (steps: 2000, epochs: 10)1000 + samples
Klein 9b, steps: 1000, epochs: 10800 + samples (floor)

Sample-prompt rendering is billed separately at Klein image-generation rates (~8 Buzz per sample for 4b, ~16 for 9b). Preview the exact charge with whatif=true (Payments (Buzz)).

Troubleshooting ​

steps out of range, an unresolvable sourceUrl, a count mismatch and a rejected dataset are covered in the overview's troubleshooting.

SymptomLikely causeFix
400 with "modelVariant required"Missing modelVariantSet to "4b" or "9b".
400 with "isEditTraining: true requires control folders"Edit-training zip missing control_*/ subfoldersRepackage the zip with main/, control_1/, control_2/, control_3/. Filenames must align across folders.
Step failed mentioning "training data validation"Edit-training zip filenames don't match across main/ and control_*/Ensure the same basenames appear in main/ and at least one control_*/ folder.
Trained LoRA underbakedToo few steps / too low lrRaise steps to 1500–2500; keep lr ≤ 5e-4.
Trained LoRA overcooked / broken sampleslr too highDrop lr to 1e-4–2e-4.

Civitai Developer Documentation