首页›Jay Alammar›文章

The Illustrated Stable Diffusion

2022年10月4日

AI 摘要 AI 生成,可能有误

This article provides an illustrated, accessible explanation of how Stable Diffusion works, breaking down its three main components: a CLIP text encoder that converts prompts into token embeddings, a UNet + scheduler that gradually denoises information in latent space, and an autoencoder decoder that produces the final pixel image. It explains how diffusion models are trained to predict and remove noise, and how text conditioning allows users to control what images are generated. The article also highlights the speed benefit of running diffusion on compressed latent representations rather than raw pixels, and notes that larger language models improve generated image quality.

Translations: Chinese, Vietnamese.

(V2 Nov 2022: Updated images for more precise description of forward diffusion. A few more images in this version)

AI image generation is the most recent AI capability blowing people’s minds (mine included). The ability to create striking visuals from text descriptions has a magical quality to it and points clearly to a shift in how humans create art. The release of Stable Diffusion is a clear milestone in this development because it made a high-performance model available to the masses (performance in terms of image quality, as well as speed and relatively low resource/memory requirements).

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Jay Alammar

Moving To Substack

I’m freezing this blog and starting to post on my Substack instead. The authoring experience is much more convenient for me there. Please follow me there, and check out The Illustrated DeepSeek R-1 if you haven’t yet. And check out our How

Generative AI and AI Product Moats

Here are eight observations I’ve shared recently on the Cohere blog and videos that go over them.: Article: What’s the big deal with Generative AI? Is it the future or the present? Article: AI is Eating The World

Remaking Old Computer Graphics With AI Image Generation

AI 摘要The author recounts using AI image generation tools—Stable Diffusion (via Dream Studio), Midjourney, and DALL-E—to recreate the intro cinematic of the 1987 MSX video game Nemesis 2 in higher-resolution graphics. He describes the prompting process and the challenges encountered, such as reproducing specific poses, consistent characters, and readable text, which he addressed through prompt engineering, in-painting, outpainting, and manual Photoshop edits. He concludes with a comparison of the three services, praising Dream Studio's workflow and API, Midjourney's superior image quality, and DALL-E's outpainting capabilities.

Applying massive language models in the real world with Cohere

A little less than a year ago, I joined the awesome Cohere team. The company trains massive language models (both GPT-like and BERT-like) and offers them as an API (which also supports finetuning). Its founders include Google Brain alums in

The Illustrated Retrieval Transformer

AI 摘要The article explains DeepMind's RETRO (Retrieval-Enhanced Transformer), a language model that performs on par with GPT-3 despite being only 4% of its size (7.5 billion vs. 185 billion parameters) by augmenting its input with information retrieved from a database containing 2 trillion tokens. The model uses BERT sentence embeddings to look up nearest neighbors in a key-value database and incorporates the retrieved text through an encoder-decoder architecture that employs chunked cross-attention in special RETRO decoder blocks. This approach demonstrates that continuously scaling up model size is not the only way to improve performance, since separating factual world knowledge from language processing allows for smaller, cheaper, and faster models.