← Latest papers
💻 computer science

LCG: Long-Context Consistent Image Generation with Sparse Relational Attention

This paper proposes Long-Context Generation (LCG), a framework utilizing Sparse Relational Attention and a Routing Consistency Constraint to achieve consistent, scalable multi-image synthesis for long visual narratives, validated by a new large-scale dataset and superior performance over baselines in character and semantic consistency.

Original authors: Zihao Wang, Yijia Xu, Haoze Zheng, Xuran Ma, Haokun Gui, Harry Yang

Published 2026-06-26
📖 5 min read🧠 Deep dive

Original authors: Zihao Wang, Yijia Xu, Haoze Zheng, Xuran Ma, Haokun Gui, Harry Yang

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are an artist trying to draw a comic book. You have a script with 20 different scenes. The challenge isn't just drawing one beautiful picture; it's drawing 20 pictures in a row where the main character looks exactly the same in every single panel, even though they are wearing different clothes, standing in different places, and doing different things.

Current AI art tools are like talented artists who can draw a single stunning portrait. But if you ask them to draw a whole story, they tend to "drift." In panel 1, the hero has blue eyes and a scar. By panel 10, the hero might suddenly have green eyes and no scar, or the villain might look like the hero. This paper, LCG, introduces a new way to fix this problem.

Here is how the paper's solution works, broken down into simple concepts:

1. The Problem: The "Memory Overload"

To keep a character consistent across 20 images, the AI needs to look at all 20 images at the same time to remember what the character looks like.

  • The Old Way: Imagine trying to hold a conversation with 20 people at once, where everyone is shouting at everyone else. As the group gets bigger, the noise becomes impossible to manage, and your brain (the computer's memory) crashes. This is what happens when AI tries to look at all images "densely" (connecting every pixel of every image to every other pixel).
  • The Result: The AI gets confused, the character changes appearance, or the computer runs out of memory.

2. The Solution: "Sparse Relational Attention" (SRA)

The authors created a new mechanism called Sparse Relational Attention (SRA). Think of this as giving the AI a smart highlighter instead of a floodlight.

  • How it works: Instead of the AI trying to connect every part of Image A to every part of Image B, it asks: "What is the most important thing in Image B that I need to see to keep Image A consistent?"
  • The Analogy: Imagine you are writing a sequel to a book. You don't need to re-read the entire library of 1,000 books to remember the hero's name. You just need to look at the specific character index card. SRA acts like that index card. It picks out only the "core features" (like the hero's face or a specific outfit) from other images and ignores the rest. This keeps the computer fast and prevents it from getting overwhelmed, even with long stories.

3. The Safety Net: "Routing Consistency Constraint" (RCC)

Even with the smart highlighter, the AI might still get confused. For example, if two characters are both wearing red coats, the AI might accidentally swap their faces.

To stop this, the authors added a rule called Routing Consistency Constraint (RCC).

  • The Analogy: Imagine a strict editor who has a "character sheet" (a mask) for every person in the story. The editor tells the AI: "When you draw the hero in Panel 5, you must look at the hero's face in Panel 1, NOT the villain's face, even if they are wearing the same color."
  • How it works: The system uses these "masks" to force the AI to route information correctly. If the AI tries to copy the wrong person's features, the system says, "No, that's the wrong path," and corrects it. This ensures the hero stays the hero and the villain stays the villain, even in crowded scenes.

4. The Training Ground: LCCD Dataset

To teach the AI how to do this, the researchers couldn't just use random photos from the internet (because of privacy and copyright issues). Instead, they built a massive, custom-made training set called LCCD (Long-Context Consistency Dataset).

  • The Scale: They created 600,000 fake story sequences. Each sequence has 6 to 20 images.
  • The Variety: Some stories have one character, others have many. They used AI to generate these images and then used another AI to check: "Did the character look the same in every picture?" If the character changed too much, that story was thrown out. This left them with a "perfect" dataset to train the model.

5. The Results

When they tested their new system (LCG) against other methods:

  • Better Consistency: The characters looked much more consistent across long sequences (up to 20 images).
  • Better Storytelling: The AI followed the specific instructions for each scene (e.g., "sitting on a bench" vs. "standing in a library") without losing the character's identity.
  • Efficiency: Because of the "smart highlighter" (SRA), the system could handle long stories without crashing the computer's memory, whereas older methods failed when the story got too long.

In summary: The paper presents a new framework that allows AI to generate long, consistent visual stories (like comics or storyboards) by using a "smart highlighter" to focus only on important details and a "strict editor" to ensure characters don't get mixed up, all while keeping the computer running efficiently.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →