Stylus: Automatic Adapter Selection for Diffusion Models

Michael Luo, Justin Wong, Brandon Trabucco, Yanping Huang, Joseph E. Gonzalez, Zhifeng Chen, Russ Salakhutdinov, Ion Stoica

Abstract

The proliferation of specialized adapters, such as Low-Rank Adaptations (LoRAs), has created a powerful but fragmented ecosystem for diffusion models. Selecting and combining these adapters manually is a labor-intensive process often resulting in suboptimal image quality. We present Stylus, a three-stage framework that automates adapter selection and composition. By refining adapter metadata with vision-language models and utilizing long-context LLMs for intelligent task assignment, Stylus significantly enhances image fidelity, diversity, and prompt alignment. Our evaluations demonstrate a 2:1 human preference for Stylus over standard base models.

Introduction

The open-source AI community has produced over 100,000 adapters designed to teach base models like Stable Diffusion specific styles, characters, or objects. Despite their potential, effective utilization requires extensive trial-and-error. Most adapters suffer from poor documentation, and naive "stacking" often leads to "task blocking"—where adapters interfere with one another—or "image saturation," resulting in visual artifacts. Stylus addresses these challenges by automating the pipeline from raw prompt to high-fidelity image.

The Stylus Framework

Stylus operates through a modular pipeline consisting of three primary stages: Refine, Retrieve, and Compose.

1. Refiner

To overcome the "garbage in, garbage out" problem of human-written metadata, the Refiner employs a Vision-Language Model (VLM). The VLM analyzes an adapter's model card and generated example images to produce a concise, accurate description of its actual capabilities. These refined descriptions are then stored as vector embeddings.

2. Retriever

Upon receiving a user prompt, the Retriever performs a vector search against the StylusDocs dataset—a collection of 75,000 LoRAs—to identify the top 150 most relevant candidates.

3. Composer

The Composer serves as the system's decision-making core. Using a long-context Large Language Model (LLM), it segments the user prompt into specific keywords and assigns the most appropriate adapters to each. It also filters out adapters that might introduce unwanted biases or low-quality artifacts.

Key Insights: Prompt Grounding and Diversity

A central innovation of Stylus is Prompt Grounding. Rather than matching a global prompt to a single adapter, Stylus decomposes the prompt into constituent parts. For instance, a prompt for a "person with a red umbrella on a cliff" triggers the selection of individual adapters for the person, the umbrella, and the landscape, ensuring each element is rendered with high fidelity.

Stylus enables precise prompt grounding by composing multiple adapters for distinct elements like the person, the red umbrella, and the cliffside environment.

Furthermore, Stylus employs a Masking strategy to generate diverse combinations of selected adapters and a Weighting scheme to normalize their strengths, preventing the "over-cooked" appearance typical of multi-LoRA setups.

Evaluation and Results

The authors introduced StylusDocs, featuring 75,000 refined LoRA descriptions, to power the system. Evaluation on MS-COCO and PartiPrompts revealed significant improvements:

  • Human Preference: Humans preferred Stylus-generated images 2:1 over base Stable Diffusion models.
  • Pareto Efficiency: Stylus shifts the CLIP/FID Pareto curve, achieving better textual alignment and visual quality simultaneously.
  • VLM-Based Evaluation: Using GPT-4V as a judge, Stylus achieved a 60% win rate in visual quality.
Qualitative comparison showing Stylus producing more detailed and context-accurate images than the base Stable Diffusion 1.5 model.

Limitations and Future Work

The primary bottleneck for Stylus is inference latency, with the LLM Composer adding approximately 8.5 seconds to the generation process. While this overhead is constant across batch sizes, reducing it remains a priority. Future research will explore smaller, specialized models to replace the general-purpose LLM and investigate applications in image inpainting and translation.

Summary updated

BibTeX
@inproceedings{luo2024stylus,
  author = {Michael Luo and Justin Wong and Brandon Trabucco and Yanping Huang and Joseph E. Gonzalez and Zhifeng Chen and Russ Salakhutdinov and Ion Stoica},
  title = {{Stylus: Automatic Adapter Selection for Diffusion Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=3Odq2tGSpp},
}
Figure