explaingit

harahan/meanflownft

Analysis updated 2026-05-18

61PythonAudience · researcherComplexity · 5/5LicenseSetup · hard

TLDR

Research code for MeanFlowNFT, a method that uses reinforcement learning to improve few-step AI image and video generators without slowing them down.

Mindmap

mindmap
  root((MeanFlowNFT))
    What it does
      Improves few step generators
      Uses reinforcement learning
      Keeps fast sampling speed
    How it works
      Builds on MeanFlow
      Builds on DiffusionNFT
      Optimizes reward internally
    Results
      Wins on 6 of 8 metrics
      4 step video beats 50 step
    Requirements
      Python 3.10 and CUDA
      SD3.5 Medium model
      Reward scoring models
    Audience
      AI researchers
      Generative model engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Reproduce the paper's reinforcement learning training run for the SD3.5-Medium image model.

USE CASE 2

Study how to apply reward-based fine-tuning to a fast, few-step image generator.

USE CASE 3

Use the released model weights on Hugging Face to generate images with the trained checkpoint.

USE CASE 4

Adapt the training recipe to a different few-step generator or reward model.

What is it built with?

PythonPyTorchCUDADiffusersHugging Face

How does it compare?

harahan/meanflownftalbertaworlds/japanese-corpus-syntactic-analysis-agentblue-pen5805/comfyui-krea2-negpip
Stars616161
LanguagePythonPythonPython
Setup difficultyhardhardmoderate
Complexity5/54/52/5
Audienceresearcherresearchergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1day+

Needs multiple GPUs, CUDA, a licensed SD3.5-Medium download, and several separately downloaded reward models.

Apache 2.0 License: free to use, modify, and distribute, including commercially, as long as you keep the copyright and license notices and note any changes you make.

In plain English

MeanFlowNFT is the official code release for a research paper about training AI image and video generators to follow human preferences more closely, without slowing down how fast they can create pictures. It comes out of Tencent Hunyuan and the Hong Kong University of Science and Technology, and it is published alongside a paper on arXiv, a project webpage, and models hosted on Hugging Face. The starting point is a family of generators called MeanFlow, which can produce a finished image or video in very few steps by learning an average speed of change rather than simulating every tiny step of the generation process. The problem this project solves is how to further improve those fast generators using reinforcement learning, a training method that rewards outputs humans or scoring models rate highly. Normally, adjusting a fast average-speed generator this way is awkward, because the reward signal is easiest to compute using the model's underlying step by step behavior, not its shortcut average behavior. MeanFlowNFT works around this by optimizing rewards in that step by step space internally while keeping the actual model in its fast average-speed form, so generation stays just as quick as before. It builds on a method called DiffusionNFT and carries over a guarantee that, in an ideal case, each training update can only improve the model, not make it worse. According to the results shown, MeanFlowNFT beats other few-step image generation models on six out of eight measured qualities, and a four-step video version outperforms a video model that used fifty steps and its own reinforcement learning process. The current public code covers training and running the SD3.5-Medium image model, a version for the Wan2.1 video model is being built on a separate branch. Setup requires Python 3.10, PyTorch 2.6.0, and CUDA 12.4, installed through a provided requirements file, plus a separately downloaded copy of the SD3.5-Medium model after accepting its license on Hugging Face. Training also needs several reward scoring models such as PickScore, HPSv2, and CLIPScore, most of which download automatically, with instructions for using local copies instead. The training process itself is designed to run across multiple machines with GPUs and involves first generating training data from the base model before running the actual reinforcement learning step. This is research code aimed at people already working in image and video generation, not a beginner-friendly tool.

Copy-paste prompts

Prompt 1
Explain in simple terms what problem MeanFlowNFT is solving compared to normal reinforcement learning for image generators.
Prompt 2
Help me set up the Python and CUDA environment needed to run MeanFlowNFT's training code.
Prompt 3
Walk me through downloading SD3.5-Medium and the reward models needed to train MeanFlowNFT.
Prompt 4
Explain how MeanFlowNFT keeps generation fast while still using reinforcement learning to improve quality.
Prompt 5
Help me understand the difference between MeanFlowNFT and the DiffusionNFT method it builds on.

Frequently asked questions

What is meanflownft?

Research code for MeanFlowNFT, a method that uses reinforcement learning to improve few-step AI image and video generators without slowing them down.

What language is meanflownft written in?

Mainly Python. The stack also includes Python, PyTorch, CUDA.

What license does meanflownft use?

Apache 2.0 License: free to use, modify, and distribute, including commercially, as long as you keep the copyright and license notices and note any changes you make.

How hard is meanflownft to set up?

Setup difficulty is rated hard, with roughly 1day+ to a first successful run.

Who is meanflownft for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.