AI face restoration
Generated and upscaled images often produce mangled faces — smeared eyes, asymmetric features, plastic skin. Face-restoration models repair them. GFPGAN, CodeFormer, and RestoreFormer each take a different approach, and the single most important setting is the fidelity weight that balances invented detail against staying true to the original face.
How it works
These models detect faces, crop them, run a generative restoration network, and paste the result back with a blend:
final_face = restored_face × blend + original_face × (1 − blend)
- Weight / fidelity controls how aggressively the network rebuilds. Low = more new detail, high = closer to input.
- Blend strength controls how visible the restoration is in the final composite — your defence against the “pasted-on” look.
CodeFormer exposes an explicit weight; GFPGAN uses a fixed network with a visibility slider; RestoreFormer prioritises identity by design.
Choosing the right model
GFPGAN — best general-purpose choice for lightly damaged or AI-generated faces that need smoothing without heavy reconstruction. Fast and neutral; unlikely to change the feel of the image. Use when faces look soft or slightly smeared but are not severely distorted.
CodeFormer — best for heavily degraded, warped, or severely AI-mangled faces where significant reconstruction is needed. The explicit weight slider lets you dial between “rebuild everything” (weight near 0) and “stay close to the input” (weight near 1). This model can over-smooth at high weight values, producing a slightly waxy look.
RestoreFormer — best when identity preservation matters more than sharpness. Designed to keep the original person’s features recognisable, which makes it the right choice for portraits of real people or when consistency across multiple images of the same subject is important.
Settings reference
| Goal | Model | Weight / fidelity | Blend |
|---|---|---|---|
| Light cleanup, good face | GFPGAN | — | 0.5 |
| Heavy reconstruction | CodeFormer | 0.3–0.5 | 0.8 |
| Balance detail and input | CodeFormer | 0.5–0.7 | 0.8 |
| Stay close to original | CodeFormer | 0.8–1.0 | 0.7 |
| Real portrait, identity first | RestoreFormer | — | 0.7 |
The “pasted-on” problem
The most common complaint with face restoration is that the face looks composited onto the scene — different grain, different lighting response, or unnaturally smooth skin against a textured background. The fix is to lower the blend strength below 1.0 so the original texture mixes back in, then run a light upscale pass over the whole image to re-unify the grain structure.
Workflow order: restore first, upscale after
Face-restoration models were trained on small, degraded face crops. Running restoration on the original-resolution face (before upscaling) keeps the model in the distribution it was trained on. Upscaling first locks in distortions that the restorer then tries to fix at an unfamiliar scale, which often amplifies them. The correct order is: generate → restore → upscale.
Platform steps
Automatic1111: Settings → Face restoration → select model → set CodeFormer weight slider if using CodeFormer → enable face restoration in the txt2img or img2img generation tab.
ComfyUI: Add a FaceRestore node after your KSampler node → connect to an appropriate model loader → set the weight as a float input → pipe to the output image.