AutoRegressiveMaskedDiffusion<T>
Models & Types · AiDotNet.Diffusion.FastGeneration
Autoregressive Masked Diffusion for hybrid discrete-continuous image generation.
Inheritance: DiffusionModelBase<T> → LatentDiffusionModelBase<T> → AutoRegressiveMaskedDiffusion<T>
For Beginners
This model works in two interleaved phases: first it decides which parts of the image to reveal (like solving a jigsaw puzzle), then it refines those revealed parts using diffusion (smoothing out the details). This two-phase approach naturally builds images from rough structure to fine detail.
How It Works
Combines masked token prediction with diffusion denoising in a unified framework. The model alternates between predicting which tokens to unmask (discrete) and refining the unmasked token values through diffusion (continuous), creating a natural curriculum from coarse structure to fine details.
Example
// Create an autoregressive masked diffusion model
var options = new DiffusionModelOptions<float> { LatentChannels = 16, DefaultInferenceSteps = 20 };
var noise = Tensor<float>.CreateRandom(new[] { 1, 16, 32, 32 });
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 AutoRegressiveMaskedDiffusion<float>(options: options))
.Build(trainX, trainY);
var generated = result.Predict(noise);
Constructors
| Constructor | Summary |
|---|---|
AutoRegressiveMaskedDiffusion(NeuralNetworkArchitecture<T> architecture, DiffusionModelOptions<T> options, INoiseScheduler<T> scheduler, SiTPredictor<T> predictor, StandardVAE<T> vae, IConditioningModule<T> conditioner, int? seed) |
Properties
| Property | Summary |
|---|---|
IConditioningModule<T> Conditioner { get; } |
|
INoisePredictor<T> NoisePredictor { get; } |
|
IVAEModel<T> VAE { get; } |
|
int LatentChannels { get; } |
Methods
| Method | Summary |
|---|---|
ModelMetadata<T> GetModelMetadata() |