Skip to content

Training, adaptation, compression, and systems techniques · Training, fine-tuning, adaptation, compression, and systems techniques · TRN028 · Architecture

ControlNet

Adds spatial conditioning such as edges, pose, depth, or segmentation to a pretrained diffusion generator.

Needs a data type CodeSplash doesn't load yet Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

Running this needs images, audio, video, graphs or another data type CodeSplash doesn't load yet.

Availability
Needs a data type CodeSplash doesn't load yet
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Adds spatial conditioning such as edges, pose, depth, or segmentation to a pretrained diffusion generator.

Question / hypotheses

Does this intervention improve the intended quality, adaptation, resource, or reliability objective under a controlled comparison? It defines a method, not an intrinsic null-hypothesis test.

Architecture / computational structure

A trainable copied/conditioned branch connects to a frozen backbone through zero-initialized projections, allowing conditioning residuals to grow during adaptation.

Assumptions

Condition maps and target images must align; preprocessing conventions and conditioning availability at inference must match training.

Formula / computational definition

h′=hfrozen(x)+Zϕ(hcontrol(x,c)),Zϕ initialized to zero.h^\prime=h_{frozen}(x)+Z_{\phi}(h_{control}(x,c)),\quad Z_{\phi}\text{ initialized to zero}.

Parameters and notation

Learned: control branch and zero-convolution projections; backbone often frozen. Hyperparameters: condition type, injection layers, strength, dropout, learning rate, dataset resolution, training schedule.

Fitting, fine-tuning, and adaptation

Prepare paired condition/target data, initialize the control branch from compatible backbone weights, and optimize the denoising objective. Validate control adherence separately from visual quality.

How to use and calibrate

Inspect edge/pose alignment and behavior when controls conflict with text. Example: guide image generation with a supplied pose map.

Example application

guide image generation with a supplied pose map.

Interpretation / pitfalls

Watch out

A zero-initialized connection does not guarantee the final model is harmless to quality. Incorrect control normalization can silently break conditioning. The code shows only the zero-residual property.

Python and R code examples

Scope: numerical mechanism demonstration. Validation: Python executed successfully on the supplied synthetic inputs; R reviewed but not executed (Rscript unavailable).

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — numerical mechanism demonstration. · needs numpy

import numpy as np
base=np.array([1.,2.]); control=np.array([.4,.8]); zero=np.zeros((2,2))
print(base+zero@control)
R

Component demo, not a trained model — numerical mechanism demonstration.

base <- c(1,2); control <- c(.4,.8); zero <- matrix(0,2,2)
print(base+as.vector(zero%*%control))

Sources

From the CodeSplash reference, entry TRN028.