MultiStepConsistencyModel<T>

Models & Types · AiDotNet.Diffusion.FastGeneration

Multi-Step Consistency Model that bridges single-step and multi-step generation.

Inheritance: DiffusionModelBase<T> → LatentDiffusionModelBase<T> → MultiStepConsistencyModel<T>

For Beginners

Single-step generation is fast but can lack detail. This model lets you trade speed for quality: use 1 step for real-time previews, 2-4 steps for high-quality results. Each additional step refines the image, similar to how an artist might do a rough sketch first, then add details in subsequent passes.

How It Works

Extends consistency models to support configurable multi-step generation with improved quality. While standard consistency models map noisy→clean in one step, this variant chains multiple consistency steps with intermediate noise injection for better quality at the cost of slightly more compute.

Reference: Based on Consistency Models (Song et al., 2023) with multi-step extensions

Example

var options = new DiffusionModelOptions<float> { LatentChannels = 4, DefaultInferenceSteps = 3 };
var noise = Tensor<float>.CreateRandom(new[] { 1, 4, 64, 64 });
var trainX = Tensor<float>.CreateRandom(4, 8);
var trainY = Tensor<float>.CreateRandom(4, 2);
var result = new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
    .ConfigureModel(new MultiStepConsistencyModel<float>(options: options))
    .Build(trainX, trainY);
var generated = result.Predict(noise);

Constructors

Constructor Summary
MultiStepConsistencyModel(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, UNetNoisePredictor<T> predictor, StandardVAE<T> vae, IConditioningModule<T> conditioner, int? seed) Initializes a new Multi-Step Consistency Model.

Properties

Property Summary
IConditioningModule<T> Conditioner { get; }
INoisePredictor<T> NoisePredictor { get; }
IVAEModel<T> VAE { get; }
int LatentChannels { get; }

Methods

Method Summary
ModelMetadata<T> GetModelMetadata()