Run this model with HF Jobs

Run lvladikov/MOSS-SFT-Distill-4step-LoRA on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/lvladikov/MOSS-SFT-Distill-4step-LoRA. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/lvladikov/MOSS-SFT-Distill-4step-LoRA on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

MOSS-Image SFT — 4-Step Distillation LoRA

🆕 New: a 2-step LoRA for MOSS-Image SFT: half this LoRA's model calls, good for previews, drafts and quick renders. For the best quality, this 4-step LoRA stays the one to use.

4 steps at CFG 1 instead of 50 at CFG 3 · 4 model calls instead of 100 · about 14× less GPU time per picture · fine texture 1.07× the teacher's · 12 trained resolutions up to 1824×1024 and 1024×1824 · 60,000 training samples

A LoRA for MOSS-Image SFT that renders in 4 steps without CFG what the model renders in 50 steps at CFG 3 — MOSS's own sampler and schedule, one model call per step instead of two, trained by distribution matching against the 50-step teacher, with a critic that compares its pictures with the teacher's and with real photographs.

  • ⚡ 4 steps, CFG 1 — 4 model calls against the teacher's 100 (50 steps, two calls each at CFG 3), on MOSS's own 4-step schedule
  • ⏱️ About 14× less GPU time — 26.6 s against 387.3 s for the same 22 pictures at 1024×1024 on Comfy Cloud (one job each, the whole job's billed GPU time)
  • 🎯 The teacher's fine detail, a touch lighter — against the teacher on the same 22 test prompts and noise at 1024×1024 in ComfyUI: fine texture 1.07× the teacher's, haze 0.94×, colour 0.98×; on average 3.4 L* lighter than the teacher's pictures (scale 0–100)
  • 🔤 Writes the words a prompt spells out — every requested string right on 14 of the 15 text test prompts at 1024×1024 (the teacher 15, akhaliq's 4-step LoRA 12)
  • 📐 12 trained resolutions — wide, tall and square, from 768×512 and 512×768 up to 1824×1024 and 1024×1824
  • 🔌 Two files, one LoRA — the exact LoRA for diffusers / Python, and a ComfyUI file that is right at strength 1.0 in ComfyUI's standard loader
  • 🧩 Ten ComfyUI workflows — text to image, layout, image edit and PiD 4×, plus an experimental text to image with a negative prompt at a higher CFG (CFG 2 and negative prompt), each for local ComfyUI and for Comfy Cloud
  • 🎲 34,000 prompts from Lakonik's 3M-prompt dataset and 2,877 prompts that spell out words — signs, menus, posters, labels
  • 📷 About 8,000 captioned photo crops and the teacher's own pictures in the critic's real set — 3,600, supersampled (rendered larger and shrunk back) at 768×512 and 512×768 from 30,000 samples on and at all 12 sizes from 39,000
  • 🔢 60,000 training samples in the shipped weights — rank 64, 252 modules
  • 📅 Trained on a single NVIDIA B300 to 51,000 samples (about 102 hours), then on a single NVIDIA H200 for the last 9,000 (about 11 hours)

Current published checkpoint: chk00060000 — 60,000 training samples, produced 3 Dec 2026.

💡 In ComfyUI, use the _comfyui file at strength 1.0. ComfyUI adds a LoRA to the bf16 weights and rounds the sum, and a change as small as this LoRA's loses part of itself on the way: about 7%, measured. The _comfyui file carries the measured factor (1.07) in its alpha values, so ComfyUI's standard LoRA loader at 1.0 applies the trained change. diffusers and other exact loaders take the plain file at 1.0.

The 22 test prompts, rendered by MOSS-Image SFT with this LoRA at 4 steps


Examples

Prompt
Portrait of a young woman with freckles and windswept auburn hair, soft window light, shallow depth of field, photograph, sharp detail
Prompt
A snow leopard walking along a rocky ridge in falling snow, telephoto wildlife photograph, natural light
Prompt
A fox in a red scarf reading a small book with a plain cover under a mushroom, whimsical watercolour painting, one continuous scene filling the entire frame, watercolour texture, soft edges
Prompt
Busy outdoor street market crowded with many people browsing colorful fruit and vegetable stalls, awnings, midday sun, wide shot, photorealistic
Prompt
A kingfisher bird bursting out of water with spread wings, water droplets frozen mid-air, iridescent blue and orange feathers, high-speed photography
Prompt
A curious young inventor girl with oversized goggles, 3D animated film style, subsurface skin, soft studio lighting, shallow depth of field
Prompt
A giant mecha standing in a rain-soaked city plaza, anime style, panel lining, glowing cockpit, dramatic low angle
Prompt
Rainy night city street with glowing neon shop signs and readable text, wet asphalt reflections, pedestrians with umbrellas, cinematic
Prompt
A storm sorceress channelling lightning, video-game splash art, bold rim lighting, energetic brush strokes, high contrast
Prompt
A claymation chef holding a tiny cake, visible fingerprints in the clay, miniature set, tilt-shift
Prompt
A rainy Shanghai street at night with a large red neon sign that reads "深夜食堂" above a noodle shop and a smaller blue neon sign that says "OPEN 24H", reflections on the wet pavement, people with umbrellas, cinematic photograph
Prompt
A printed paper menu card standing on a restaurant table with the title "LUNCH" and five lines below it that read "Tomato Soup $6.00", "Cheese Toast $7.50", "Fish Tacos $11.00", "Lemon Cake $5.00" and "Green Tea $3.75", a glass of water and cutlery beside it, soft daylight, photograph

This LoRA at 4 steps, CFG 1, 1024×1024, rendered in ComfyUI on Comfy Cloud; each picture's prompt is in its caption. Click a picture to open it. Side by side with the teacher and akhaliq's 4-step: Compared with the teacher.


Files

file what it is
moss_sft_4step_rank_64_lora.safetensors the LoRA, exact — diffusers / Python at strength 1.0, see diffusers
moss_sft_4step_rank_64_lora_comfyui.safetensors the same LoRA for ComfyUI's standard loader at strength 1.0 — see ComfyUI
moss_sft_4step_lora_*_local.json, moss_sft_4step_lora_*_cloud.json ten ComfyUI workflows, core nodes only: text to image and image edit in this folder; layout, PiD 4× and the higher-CFG experiment in _more_workflows/ — see ComfyUI
moss_sft_4step_rank_64_lora_checkpoint_info.md which checkpoint the files are, with their SHA-256s
LICENSE the Apache License 2.0, the base model's licence
NOTICE.txt the notice

The two LoRA files hold the same tensors; the ComfyUI file's alpha values carry the measured factor (64 → 68.5). Both carry the training details in their safetensors metadata. The file names carry no checkpoint number: both hold chk00060000, which also sits in _archive/checkpoints/.


Quick Start

diffusers

As on the official card: Python 3.10+, PyTorch 2.9+ with CUDA, then

pip install "diffusers>=0.38" "transformers>=5.3" "accelerate>=1.10" "safetensors>=0.6" "Pillow>=10"
import torch
import torch.nn.functional as F
from diffusers import DiffusionPipeline
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file


def apply_4step_lora(transformer, strength=1.0):
    """Adds this LoRA beside the transformer's weights, unmerged: y = W x + scale * up(down(x)).
    Call it after pipe.to("cuda"), so the LoRA lands on the transformer's device."""
    path = hf_hub_download("lvladikov/MOSS-SFT-Distill-4step-LoRA", "moss_sft_4step_rank_64_lora.safetensors")
    state = load_file(path)
    for key in state:
        if not key.endswith(".lora_down.weight"):
            continue
        stem = key[: -len(".lora_down.weight")]  # diffusion_model.layers.N.proj.NAME
        layer = transformer.get_submodule(stem.removeprefix("diffusion_model."))
        down = state[key].to(layer.weight.device, layer.weight.dtype)
        up = state[stem + ".lora_up.weight"].to(layer.weight.device, layer.weight.dtype)
        scale = strength * state[stem + ".alpha"].item() / down.shape[0]

        def hook(module, args, out, down=down, up=up, scale=scale):
            return out + F.linear(F.linear(args[0], down), up) * scale

        layer.register_forward_hook(hook)


pipe = DiffusionPipeline.from_pretrained(
    "OpenMOSS-Team/MOSS-Image-SFT",
    custom_pipeline="pipeline_moss_image",
    trust_remote_code=True,
    torch_dtype={"default": torch.bfloat16, "vae": torch.float32},
)
pipe.scheduler = type(pipe.scheduler).from_config(pipe.scheduler.config)
pipe.to("cuda")
apply_4step_lora(pipe.transformer)

image = pipe(
    "A snow leopard walking along a rocky ridge in falling snow, telephoto wildlife photograph, natural light",
    height=1024,
    width=1024,
    num_inference_steps=4,
    guidance_scale=1.0,
    generator=torch.Generator("cpu").manual_seed(42),
).images[0]
image.save("moss_4step.png")
  • num_inference_steps=4 and guidance_scale=1.0 are the whole configuration. The pipeline's own scheduler lands on σ = 1.0, 0.910, 0.717, 0.024 at 4 steps — the four noise levels the LoRA is trained on — and at guidance_scale=1.0 it makes one model call per step, with no negative pass.
  • Why the helper: MOSS's custom pipeline has no load_lora_weights. apply_4step_lora adds moss_sft_4step_rank_64_lora.safetensors beside the bf16 weights, as in training. Merged into bf16 weights with plain rounding, this LoRA would lose part of its change.

ComfyUI

file put it in
moss_sft_4step_rank_64_lora_comfyui.safetensors (this repo) ComfyUI/models/loras/
moss_image_sft_bf16.safetensors (Comfy-Org/MOSS-Image) ComfyUI/models/diffusion_models/
qwen3.5_9b_w4a8_gptq.safetensors (same repo) ComfyUI/models/text_encoders/
flux2-vae_small.safetensors (same repo) ComfyUI/models/vae/

Load moss_sft_4step_lora_t2i_local.json — or its _cloud twin on Comfy Cloud. Core ComfyUI nodes only; update ComfyUI first, MOSS-Image support in it is recent.

Settings: euler on MOSS's official 4-step sigmas (entered in ComfyUI's Manual Sigmas node: 1.0, 0.91, 0.717, 0.024, 0.0), CFG 1 (Basic Guider), LoRA strength 1.0 with the _comfyui file, on the bf16 MOSS file. The pictures on this page used the full-precision text encoder, qwen3.5_9b_bf16 (same repo); the workflows load the templates' 4-bit one.

⚙️ Manual Sigmas, not simple. ComfyUI's simple scheduler at 4 steps lands on other noise levels than the four the LoRA is trained on. CFG 1 is one model call per step: no negative prompt and no Skip Layer Guidance, both of which act on the negative pass.

workflow (_local.json / _cloud.json) what it does
moss_sft_4step_lora_t2i text to image, the official MOSS-Image template set up for the LoRA. Its default size, 2848×1600, is above the sizes the LoRA is trained at
moss_sft_4step_lora_layout_t2i layout-guided text to image: boxes with captions and text, the official layout template, 1024×1024
moss_sft_4step_lora_edit_i2i image edit with Comfy-Org's MOSS-Image edit LoRA on top, 4 steps at CFG 1; at some seeds the change lands on another item than the one named, and another seed sets it right
moss_sft_4step_lora_t2i_PiD a supersampled render, 1184×672, that NVIDIA's PiD then draws at 4×: 4736×2688
moss_sft_4step_lora_t2i_highercfg_experimental_negative 🧪 experimental: text to image with a negative prompt at a higher CFG (set to 2.0; any value above 1 works), 1824×1024. The LoRA is trained for CFG 1, and a CFG above 1 takes about twice the sampling time; see CFG 2 and negative prompt

The _cloud versions load this repo's _comfyui LoRA file from your Comfy Cloud library: import it once from its Hugging Face URL. Each workflow's Models note lists every file it needs.

🍎 On a Mac, large sizes can fail in VAE Decode with MPSGraph does not support tensor dims larger than INT_MAX (the text-to-image default, 2848×1600, is past that point; NVIDIA GPUs decode it directly). Switch to tiled decoding: delete Decode (MOSS VAE), add the core VAE Decode (Tiled) node, connect samples from the sampler's output, vae from Load MOSS VAE and its IMAGE to the Output node. Its defaults (tile 512, overlap 64) are fine. Or start ComfyUI with --cpu-vae: every workflow then decodes on the CPU, slower, at any size.

The workflows in ComfyUI

Each graph at its defaults, then what it made. Click a picture for full size.

Text to image — 2848×1600

The text to image workflow

The text to image result

Layout — the boxes drawn in Create Bounding Boxes, 1024×1024

The layout workflow

The layout result

Image edit — the photo, then the edit

The image edit workflow

The photo to edit The edit

PiD 4× — 4736×2688

The PiD 4x workflow

The PiD 4x result


LoRA Strength

strength what happens
below 1.0 only part of the trained change arrives; the pictures drift back toward the base model at 4 steps, which draws a blur
1.0 the trained point — the plain file in diffusers / Python, the _comfyui file in ComfyUI
above 1.0 doubled edges: about 1.4× the trained change measured 2.0× the doubled edges (2.62 against 1.30) for little more fine texture (0.85 against 0.82)

Keep 1.0: turning it up doubles edges rather than adding detail.


Recommended companion for photographs

For the most photographic skin, the community MOSS Realism Enhancer LoRA can be added beside this one — Civitai · Hugging Face copy. It is a separate LoRA by its own author under its own licence, not part of this training, and none of the pictures or numbers on this page use it. In ComfyUI it goes in a second LoRA loader after this one.

Also works well with MOSS UltraReal LoRA - Civitai. It is of course, also a separate LoRA by its own author under its own licence, not part of this training, and none of the pictures or numbers on this page use it. In ComfyUI it goes in a second LoRA loader after this one.


Method

eDMD + LADD — distribution matching with an endpoint critic (eDMD) against the 50-step teacher, plus a small LADD-style adversarial critic that compares the student's pictures with the teacher's and with about 8,000 real photo crops, so texture is anchored to real photographs as well as to the teacher. The last 9,000 samples trained the 4-step schedule alone. Details in the Detailed Model Card.


Hardware

Trained on a single NVIDIA B300 to 51,000 samples (about 102 hours; peak GPU memory 246 GB at 4 prompts per update, every activation kept), then on a single NVIDIA H200 for the last 9,000 (about 11 hours; peak 143 GB). The frozen base runs in bf16 with no quantisation, the LoRA in fp32 beside its weights.

The released LoRA is fp32 and is applied beside the bf16 weights, as in training.


Usage Notes

  • 🎯 MOSS-Image SFT only — trained against SFT's weights and its schedule
  • 🚫 CFG 1 — diffusers guidance_scale=1.0, ComfyUI CFG 1; no negative prompt
  • 📐 MOSS's own schedule — σ = 1.0, 0.910, 0.717, 0.024 at 4 steps, the noise levels the LoRA is trained on
  • 📏 Sizes — trained from 768×512 / 512×768 up to 1824×1024 / 1024×1824, in multiples of 16; larger sizes are outside the trained range
  • 📝 Long prompts at very high resolutions — the larger the picture, the more the prompt's length matters: at 3552×2000 a 21-word prompt comes out soft and hazy, while 100 words or more (about 600+ characters) comes out clean and sharp. Expand short prompts first — in the text-to-image workflow switch the prompt upsampler on (MOSS's own text encoder rewrites the prompt into a caption of about 250 words)
  • 🧮 In ComfyUI, the bf16 MOSS file (moss_image_sft_bf16) — the _comfyui file's factor is measured on it; the official template's int8 file is not measured with this LoRA

Known Limitations

Seen on the published sweep and the comparison sheets:

  • invented lettering on signs and decals where the prompt names no words — the teacher does this too; the storm sorceress gets an unasked title at 960×1280 and 1280×1280
  • the tug-of-war rope runs toward the camera instead of between the two dogs at five sizes (512×768, 768×1024, 960×1280, 1024×1824, 1280×1280)
  • extra diners at the family-of-four table: five people at 1824×1024, 1280×960 and 1280×1280, six at 1024×1824, four at the other eight
  • one string of the 15 text prompts comes out wrong: the bakery window reads "Bresd Daily" for "Fresh Bread Daily"
  • pictures sit a little lighter than the teacher's: 3.4 L* on average at 1024×1024
  • crowds can look uniform at the tall sizes

Compared with the teacher

Every sheet below: the teacher (MOSS-Image SFT, 50 steps, CFG 3 — 100 model calls), akhaliq's MOSS-Image-SFT-4-steps v2.0 (strength 1.0, CFG 1 — 4 calls) and this LoRA (the _comfyui file at strength 1.0, CFG 1 — 4 calls), at 1024×1024, the same prompt and noise in all three panels, rendered in ComfyUI on Comfy Cloud.

Portrait of a young woman with freckles and windswept auburn hair...

portrait comparison


Busy outdoor street market crowded with many people browsing colorful fruit and vegetable stalls...

market comparison


A snow leopard walking along a rocky ridge in falling snow...

snowleopard comparison


A rainy Shanghai street at night with a large red neon sign that reads "深夜食堂"...

text_shanghai comparison


A printed paper menu card standing on a restaurant table with the title "LUNCH" and five lines below it...

text_menu5 comparison


(32 more examples in the Detailed Model Card — all 37 prompts, see assets/)


Resolution Sweeps

_archive/resolution_sweeps/chk00060000/ — this LoRA at all 12 trained resolutions for the 22 test prompts, plus the 15 text prompts at 1024×1024: 279 pictures, 4 steps, CFG 1, strength 1.0 with the _comfyui file, rendered in ComfyUI on Comfy Cloud. The teacher's pictures of the same prompts at 1024×1024 are in the comparison sheets above.

Layout:

_archive/resolution_sweeps/chk00060000/
├── 512x768/       22 pictures, one per test prompt (portrait.jpg, kingfisher.jpg, ...)
├── 768x512/
├── ...            (all 12 sizes)
├── 1024x1024/     the 22 + the 15 text prompts (text_*.jpg)
└── 1824x1024/

Two ways to read it: down the sweep (does it hold at every size?) or against the teacher at 1024×1024 in the comparison sheets.


Archive

Every published checkpoint and its resolution sweep are kept under _archive/ — checkpoints/ and resolution_sweeps/, each under its number: chk00015000, chk00030000, chk00039000 and chk00060000, this one.


Detailed Model Card

The full write-up is in the Detailed Model Card:


License

This adapter is a derivative of MOSS-Image SFT and is released under its licence, the Apache License 2.0. Copy of the licence: LICENSE; notice: NOTICE.txt.

Not an official OpenMOSS product, not endorsed by the OpenMOSS team. The base model is OpenMOSS's; the adapter, the workflows and the pictures in this repo are mine. The other models the workflows load (the edit LoRA and PiD) come under their own licences.

Downloads last month
13,718
Inference Examples
Examples
This model isn't deployed by any Inference Provider. 🙋 1 Ask for provider support

Model tree for lvladikov/MOSS-SFT-Distill-4step-LoRA

Adapter
(103)
this model
Merges
1 model

Space using lvladikov/MOSS-SFT-Distill-4step-LoRA 1

Paper for lvladikov/MOSS-SFT-Distill-4step-LoRA