Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

IP-Adapter: Text Compatible Image Prompt Adapter for Text-to-Image Diffusion Models

Image prompt adapter adds image conditioning to frozen text-to-image diffusion models

  • Problem Text prompts are hard to write and cannot carry every scene detail. Existing image prompt methods need costly fine-tuning that removes text generation, or support only image prompts.
  • Method IP-Adapter adds a separate cross-attention branch for image features beside each text cross-attention layer. Only these branches are trained while Stable Diffusion stays frozen, and their output is added to the text output.
  • Results IP-Adapter reaches 0.588 CLIP-T and 0.828 CLIP-I on the COCO validation set with about 22M trainable parameters. SD Image Variations scores 0.548 and 0.760.

Image prompts for text-only diffusion models

Stable Diffusion (SD) and similar text-to-image diffusion models take their conditioning from a text encoder, so a user who wants a specific look has to describe it in words, often through prompt engineering. Words cannot capture every scene or concept, whereas a reference image carries far more detail, which makes an image prompt an appealing second input.

The open question is whether these pretrained, text-conditioned models can accept an image prompt without being rebuilt for it.

One route fine-tunes a text-conditioned model directly on image embeddings, as SD Image Variations and Stable unCLIP do. That route needs large computing resources, removes the model's ability to generate from text, and yields models that do not carry over to other custom models from the same base or work with ControlNet.

A lighter route replaces the text encoder with an image encoder and leaves the diffusion model untouched, but it supports only image prompts, so text and image cannot be combined. Tuning only the image encoder may also fail to keep image quality and can generalize poorly.

Why concatenated image features fall short

Several adapters map CLIP image features through a trainable network and concatenate them with the text features, so the merged features take the place of the original text features in the UNet. T2I-Adapter's style adapter and Uni-ControlNet's global control branch both follow this pattern, and their outputs stay only partly faithful to the reference image.

The authors place the cause in the cross-attention layers. Their key and value projections were trained to read text, so pushing image features through them mainly aligns the image with text. Image-specific information is lost along the way, and the resulting control stays coarse, for example limited to image style.

This points toward giving image features their own attention path while the text path stays as it is.

A parallel attention branch for image tokens

Every cross-attention layer of the UNet receives one extra cross-attention layer that serves only the image features. In the original layer, the query is computed from the latent features and the keys and values come from the text features, so the output is \\( Z' = \\mathrm{Softmax}(QK^\\top/\\sqrt{d})V \\) with \\( Q = ZW_q \\), \\( K = c_t W_k \\) and \\( V = c_t W_v \\).

The image branch reuses the same query \\( Q \\) but takes its keys and values from the image features \\( c_i \\), through the new matrices \\( W'_k \\) and \\( W'_v \\).

The final layer output adds the softmax-weighted text term and the softmax-weighted image term: \\[ Z^{new} = \\mathrm{Softmax}\\left(\\frac{QK^\\top}{\\sqrt{d}}\\right)V + \\mathrm{Softmax}\\left(\\frac{Q(K')^\\top}{\\sqrt{d}}\\right)V' \\] Here \\( K' = c_i W'_k \\) and \\( V' = c_i W'_v \\), so the image branch contributes on top of the text branch.

Each layer adds only two matrices, \\( W'_k \\) and \\( W'_v \\), which start from the pretrained \\( W_k \\) and \\( W_v \\) to speed up convergence. Because the UNet is frozen, these two matrices per layer are the only trainable attention weights in the decoupled design. Concatenating the image and text features into one attention call was tried first and judged insufficiently effective.

The model has 16 cross-attention layers in SD, and each one receives an image cross-attention layer.

From one global CLIP embedding to four image tokens

The image prompt is encoded by a frozen CLIP image encoder, which is OpenCLIP ViT-H/14 in this study. The global image embedding from this encoder is used because the authors regard it as well aligned with image captions and able to represent the content and style of the image.

A small projection network turns the single global vector into a sequence of N = 4 features, with the same dimension as the pretrained text features. The network consists of one linear layer followed by Layer Normalization. The stated aim of this step is to decompose the global embedding effectively.

The choice of a global embedding is later tested against a variant that uses finer grid features.

Training only the image branch

Training uses the same noise prediction objective as SD, with the text and image conditions both passed to the noise predictor: \\[ L_{simple} = \\mathbb{E}_{x_0,\\epsilon,c_t,c_i,t}\\left\\| \\epsilon - \\epsilon_\\theta(x_t, c_t, c_i, t)\\right\\|^2 \\] Only the IP-Adapter parameters are optimized, while the SD parameters stay fixed, and the CLIP image encoder stays frozen as well.

Image conditions are dropped at random during training, so that classifier-free guidance can be applied at inference, and the CLIP image embedding is set to zero when it is dropped. Guidance then mixes the two noise predictions with the guidance weight \\( w \\): \\[ \\hat{\\epsilon}_\\theta(x_t, c_t, c_i, t) = w\\,\\epsilon_\\theta(x_t, c_t, c_i, t) + (1 - w)\\,\\epsilon_\\theta(x_t, t) \\] Text and image are dropped individually with probability 0.05, and both together with probability 0.05.

The training data is about 10 million text-image pairs drawn from LAION-2B and COYO-700M. Images have their shortest side resized to 512 and are center cropped to 512 × 512. The experiments use SD v1.5 as the base model.

Weighting the image branch at inference

At inference the image cross-attention output is scaled by a weight factor \\( \\lambda \\) and added to the text cross-attention output: \\[ Z^{new} = \\mathrm{Attention}(Q,K,V) + \\lambda \\cdot \\mathrm{Attention}(Q,K',V') \\] Setting \\( \\lambda = 0 \\) returns the original text-to-image model.

Because the two branches are separate, the weight can be changed at inference without retraining the adapter. For image-only generation the text prompt is set to empty and \\( \\lambda = 1.0 \\).

Sampling uses the DDIM sampler with 50 steps and a guidance scale of 7.5.

COCO comparison with fine-tuned and scratch-trained models

The evaluation uses the COCO2017 validation set of 5,000 images with captions. For each sample, 4 images are generated from the image prompt, giving 20,000 generated images per method. CLIP-I measures the similarity between the CLIP image embeddings of generated images and the image prompt, and CLIP-T is the CLIPScore of generated images against the captions of the image prompts.

Open unCLIP (0.608 and 0.858, 893M) and Kandinsky-2-1 (0.599 and 0.855, 1229M) score higher than IP-Adapter on both metrics. Against Versatile Diffusion (0.587 and 0.830, 860M), IP-Adapter's CLIP-T of 0.588 is marginally higher, while its CLIP-I of 0.828 is marginally lower.

Uni-ControlNet's global control (0.506 and 0.736, 47M), T2I-Adapter's style adapter (0.485 and 0.648, 39M) and ControlNet Shuffle (0.421 and 0.616, 361M) score lower than IP-Adapter on both metrics. SeeCoder and ControlNet Reference-only were only evaluated qualitatively, because the first is used with added structural controls and the second runs in a web framework.

In the qualitative comparison, the authors judge IP-Adapter mostly better than the other adapters, slightly better than the fine-tuned models, and comparable to the scratch-trained models in most cases. For each image prompt, four samples were drawn and the best one was kept per method, so the qualitative picture depends on that selection.

Reuse on custom models and with structural controls

The adapter was trained once on SD v1.5 and was applied without retraining to Realistic Vision V4.0, Anything v4 and ReV Animated, which are all fine-tuned from SD v1.5. It was also applied to SD v1.4, which the authors note is the earlier base of SD v1.5. These custom-model results are visual examples, and no metric is reported for them.

Because the adapter leaves the network structure unchanged, it can be combined with ControlNet and T2I-Adapter to generate from an image prompt and a structure map together. Figure 5 shows such samples, with the first two rows generated by ControlNet models and the last row by T2I-Adapters.

In the structure control comparison, T2I-Adapter and Uni-ControlNet use their default composable multi-conditions, SeeCoder and IP-Adapter use ControlNet, and ControlNet Shuffle and ControlNet Reference-only use multi-ControlNet. The authors report that IP-Adapter gives better image quality and images that align better with the reference image.

Replacing the text prompt with an image prompt also gives image-guided image-to-image and inpainting with SDEdit.

Image and text prompts together

The authors note that fully fine-tuned image prompt models almost lose the original text-to-image ability. IP-Adapter accepts image and text prompts together, and the authors found this to work particularly well on community models.

With the Realistic Vision V4.0 model, text edits can change attributes of the subject from the image prompt or change the scene around it. The weight factor λ is adjusted in this setting to balance the image prompt against the text prompt.

Figure 9 compares multimodal outputs with Versatile Diffusion, BLIP Diffusion, Uni-ControlNet, T2I-Adapter, ControlNet Shuffle and ControlNet Reference-only, and the authors judge the IP-Adapter results better in image quality and in alignment with the multimodal prompts.

Decoupled branch and feature granularity ablations

The simple adapter concatenates image and text features and embeds them into the pretrained cross-attention layers, without a decoupled branch. Both adapters were trained for 200,000 steps under the same configuration.

In the visual comparison, the decoupled adapter produces higher-quality images than the simple adapter and images that are more consistent with the image prompts. This comparison is visual, and it uses no metric.

To test whether the global embedding loses detail, the authors build a variant that takes grid features from the penultimate layer of the CLIP image encoder. A query network with 16 learnable tokens extracts information from these grid features with a lightweight transformer, and the resulting token features feed the cross-attention layers.

The finer variant yields images that are more consistent with the image prompt, but the authors note that it can also learn spatial structure and so reduce the diversity of generated images. Additional conditions such as text prompts and structure maps can restore diversity, and human poses are one example.

Limits on subject consistency and evidence

The authors state that IP-Adapter reproduces the content and style of a reference image but does not synthesize images that stay highly consistent with the subject of that image, as Textual Inversion and DreamBooth do. They aim to develop stronger image prompt adapters for subject consistency.

The quantitative comparison uses only the COCO validation set with CLIP-based metrics. The ablations are visual and trained for 200,000 steps, while the main model was trained for 1M steps. The custom-model and structure-control results are visual examples.

The CLIP-based metrics do not capture the diversity loss of the finer-grained variant, and the qualitative comparisons rely on the best of four samples per method.

Paper info

Authors
Hu Ye, Jun Zhang, Sibo Liu, Xiao Han, Wei Yang
Venue
arXiv · Preprint
First published
2023-8-13
Added
2026-11-12
Updated
2023-8-13
Version
v1
arXiv
2308.06721
Category
cs.CV · cs.AI
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Hu Ye, Jun Zhang, Sibo Liu, Xiao Han, Wei Yang (2023). IP-Adapter: Text Compatible Image Prompt Adapter for Text-to-Image Diffusion Models. arXiv:2308.06721v1. https://arxiv.org/abs/2308.06721v1

BibTeX
@misc{ye2023adapter,
  title = {{IP-Adapter: Text Compatible Image Prompt Adapter for Text-to-Image Diffusion Models}},
  author = {Hu Ye and Jun Zhang and Sibo Liu and Xiao Han and Wei Yang},
  year = {2023},
  eprint = {2308.06721},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.06721v1}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up