When an image generator illustrates a long story, it has to draw the same character in scene after scene. Current training-free methods get this consistency by letting each image look at the others while it is generated. Technically, the self-attention layers of the diffusion model (a generator that turns random noise into an image by repeated denoising) are allowed to read features from the other images in a group. That works for four images and breaks at eight. It also does not work at all when the story arrives one scene at a time. Numerical analysts faced the same structure decades ago. They wanted a solution on an infinite domain but could only afford a finite computational box. Their answer was not a bigger box. They built a boundary term that summarizes, exactly or to a controlled order, how the discarded exterior pulls on the interior. We propose to treat a story's past frames the same way. The current scene and a few recent scenes form the "interior." All older frames form an "exterior tail," and their pull on the current image is summarized by a small, recursively updated far-field term that keeps the softmax normalization correct.
The core idea in two sentences: softmax attention over all previous frames is a nonlocal operator, and dropping old frames is a naive truncation that removes both their contribution and their share of the normalization, so identity drifts. If the character's identity tokens from old frames are summarized by a mass-weighted, moment-corrected tail quadrature, borrowed from far-field boundary conditions for nonlocal equations, streaming generation of arbitrarily long stories should track full-history attention at constant memory.
Core Claim
For a query token $q$ in the image being generated, attention over the whole history splits into two parts. One part is an interior sum over the $W$ most recent frames plus the current frame, which is kept exactly. The other part is an exterior sum over all older frames:
$$ o(q)=\frac{\sum_{j\in I} e^{q\cdot k_j}v_j+\sum_{m=1}^{M} n_m\, e^{q\cdot c_m+\frac12 q^\top \Sigma_m q}\,\mu_m}{\sum_{j\in I} e^{q\cdot k_j}+\sum_{m=1}^{M} n_m\, e^{q\cdot c_m+\frac12 q^\top \Sigma_m q}}. $$
Here $I$ is the set of interior tokens with keys $k_j$ and values $v_j$. The exterior identity tokens are grouped into $M$ clusters. Each cluster $m$ stores a token count $n_m$, a key mean $c_m$, a key covariance $\Sigma_m$, and a value mean $\mu_m$. Where the exterior keys are approximately Gaussian within each cluster, the exponential factor is the exact Gaussian expectation of $e^{q\cdot k}$.
The formula has three deliberate properties, each taken from boundary-truncation practice.
First, the count $n_m$ restores the exterior's share of the softmax denominator. Plain truncation discards this share, which is the attention analogue of a zero Dirichlet condition. A single shared reference frame underweights it.
Second, the covariance term is a second-order correction. It is analogous to the step from linear to quadratic interpolation weights in far-field quadrature for the fractional Laplacian. The error of the first-order (mean-only) rule should scale with the spread of exterior keys within a cluster. The second-order rule removes the leading term of the expansion of $e^{q\cdot k}$ around $c_m$.
Third, the tail statistics are updated recursively, using running counts, means and covariances, as each frame leaves the window. No history is stored. This mirrors how recursive boundary kernels avoid expensive history convolutions.
Only identity tokens enter the tail. These are tokens whose cross-attention to the subject word exceeds a threshold. Background and pose from old scenes therefore cannot leak forward. The analogue in the numerical setting is that complex interior dynamics stay inside the box and only a clean, homogeneous exterior is summarized.
The nonlinear-PDE direction supplies the lens that makes this more than an engineering trick. Group generation with shared attention is an interacting system: each image's denoising drift depends on the states of all the others through a normalized kernel. That is a mean-field, nonlinear nonlocal evolution. It is not the linear, superposable setting in which exterior summaries are classically exact. The research question is whether a far-field summary stays accurate when the interior coupling is nonlinear and the exterior is only approximately stationary. The answer is not obvious, and it is testable.
Relation to Prior Work
The mechanism comes from artificial boundary conditions. Han and Huang build exact boundary operators for heat equations on unbounded domains, so that the truncated solution equals the restriction of the infinite one (A class of artificial boundary conditions for heat equation in unbounded domains, Exact and approximating boundary conditions for the parabolic problems on unbounded domains). Their central modelling move is to assume that all complexity sits inside and the exterior is homogeneous (Han et al.), and we reuse it directly.
Huang and Oberman split the fractional Laplacian into a local singular part and a far-field tail. They integrate the tail semi-exactly with positive weights and show that including the tail matters most when solutions decay slowly. Their rates are $O(h^{2-\alpha})$ with linear and $O(h^{3-\alpha})$ with quadratic interpolation (Numerical Methods for the Fractional Laplacian). Our first- versus second-order tail rule is a direct analogue. Their only nonlinear case is an obstacle constraint, which leaves open whether tail summaries survive fully nonlinear interior coupling.
Ji et al. show that recursive boundary kernels stay reflection-free and second-order accurate to $t\approx 9400$, where naive truncation contaminates the interior (Accurate artificial boundary conditions for semi-discretized one-dimensional peridynamics). This motivates our recursive tail update and our long-horizon evaluation.
The consistency literature both motivates and constrains the design. StyleAligned shares self-attention keys and values from a reference image and needs feature normalization to stop geometry leaking (Style Aligned). This is effectively a one-frame, unweighted exterior, and its leakage problem is why we restrict the tail to identity tokens. Group Diffusion Transformers concatenate all tokens in a group and report quality decline at group size 8 (GDTs). That is the "enlarge the box" strategy failing, and it is our main motivating negative result. BIPE rescales singular values of shared prompt embeddings and concatenates text keys (Xia et al.). It needs all prompts in advance, so it cannot stream. We work in visual attention, online. The Chosen One (The Chosen One) and OneActor (OneActor) treat identity as a dense cluster in feature space and pay minutes of tuning per character. We use the same cluster picture, but only to justify a compact tail summary, with no weight updates.
The research file's framing suggests two ideas that we reject: casting identity pockets as a bounded domain for the reverse SDE, and adding boundary conditions to operator surrogates such as DDIS. The first stays metaphorical, because no one can write down the boundary of an identity pocket. The second is a physics problem that does not touch identity. The attention-as-nonlocal-operator view gives a boundary that is literally computable: the edge of the frame window.
Research Program
The work has three parts.
The first part is a controlled calibration on a nonlinear nonlocal equation where ground truth is available. The equation is a 1D fractional Allen–Cahn equation, $u_t=-(-\Delta)^{\alpha/2}u+u-u^3$ on the line, with slowly decaying fronts. We compare four treatments of the far field: zero truncation, the Huang–Oberman asymptotic tail, a first-order moment summary, and a second-order moment summary. Each is checked against a very-large-domain reference. This isolates one question: do moment-based far-field summaries keep their order when the interior is nonlinear? That extension is the open item left by the obstacle-problem work. No reported result was found on Lacuna for fractional Allen–Cahn truncation error, so the reference solution serves as the baseline.
The second part is the streaming generator. We use SDXL with training-free extended self-attention. The window holds $W\in\{1,2,4\}$ exact frames. Identity tokens are selected through subject-word cross-attention maps. A tail of $M$ clusters per layer is updated after each frame finishes denoising. We also analyze the approximation error. Tail-induced error in $o(q)$ is bounded by the exterior softmax mass multiplied by the within-cluster key spread (first order) or by the third moment (second order). We will measure both quantities per layer so that the bound can be checked against observed identity drift.
The third part is the stress regime that existing methods cannot enter: stories of 50 to 200 frames delivered one prompt at a time, each drawing the same character.
Baselines
The do-nothing reference is independent SDXL sampling with the same character description in every prompt. It measures raw identity drift.
The naive-truncation reference is a sliding window of $W$ exact frames with no tail. This is the attention analogue of a zero boundary condition, and it is the ablation that isolates whether the exterior term matters at all.
The fixed-anchor reference shares the first frame's keys and values into every later frame, with AdaIN normalization as in Style Aligned. It is the strongest simple streaming competitor, because it costs the same memory as our method.
The "exact solution" reference is full-history extended attention over all past identity tokens. We run it up to the frame count at which it fits in memory. Matching it, measured by attention-output error and by downstream identity scores, is the primary success criterion, just as an artificial boundary condition is judged against the infinite-domain solution.
The strongest existing consistency method in the file is BIPE (Xia et al.). It ranked first among training-free methods on ConsiStory+ and reports stable identity beyond 50 images on DiverStory. No reported numeric identity score was found on Lacuna for BIPE on either benchmark, so we will rerun it. BIPE will receive all prompts offline, which is an advantage it holds by design. Beating it means matching its identity score while streaming, and exceeding it on DiverStory-style natural prompts at 100 or more frames.
As a tuning-based reference we include OneActor (OneActor), with its reported 3–6 minute tuning time counted in the cost comparison.
The key-ingredient ablations are three. The first is plain k-means compression of old identity keys and values without the count weights $n_m$. The second is the first-order rule without covariance. The third uses all tokens in the tail, which should reintroduce background leakage.
All methods share the same SDXL checkpoint, sampler, step count, seeds, prompt sets, and a small shared tuning budget for thresholds and $M$, chosen on a held-out set of stories.
Why not just…?
Why not just enlarge the window? This is the classical "push the boundary out" answer. GDTs report quality decline when the group grows to 8, and memory grows linearly with story length. In the numerical setting, Huang and Oberman and Ji et al. show that enlargement is either prohibitively expensive or, over long horizons, still wrong. Our window-size sweep, with and without the tail, tests this directly at equal memory.
Why not just keep one reference frame, or a running-mean identity embedding? This is the real threat, because it is cheap and often works. It differs from our method in two measurable ways. It gives the exterior the weight of a single frame, not its accumulated mass. It also cannot represent pose-dependent identity variation, which the multi-cluster tail keeps. If the fixed-anchor baseline matches us at 100 frames, the conclusion is that the exterior is effectively a single point and the extra machinery is unnecessary. We will report that outcome as a negative result.
Why not just fine-tune a LoRA per character? The Chosen One reports about 20 A100 minutes per identity. Fine-tuning also needs the character to be fixed before the story starts, and in interactive storytelling the character emerges from the first frames. We include OneActor as a cost-matched reference rather than dismiss this option.
Why not use generic key-value cache compression? Clustering old keys is standard. What is specific here is restricting the tail to identity tokens, keeping the mass-preserving counts, and adding the second-order moment correction. The unweighted k-means ablation shows whether these elements matter. If it performs just as well, the contribution shrinks to the error analysis alone.
Proposed Experiments
The first experiment is the fractional Allen–Cahn calibration. The prediction is that the second-order moment tail beats zero truncation by a margin that grows as the solution decays more slowly, and that it retains a higher observed order than the first-order rule.
The second experiment uses ConsiStory+ and DiverStory prompt sets extended to 50, 100 and 200 frames. We measure identity similarity (DINO and a face-embedding similarity) as a function of frame index and report its slope, which is the drift rate. We also measure CLIP-T prompt alignment, peak memory, and time per frame.
The decisive check has three conditions, all of which must hold. At lengths where full history fits, the second-order tail must track full-history attention more closely than every equal-memory baseline. The drift slope must stay near zero out to 200 frames while the sliding-window and fixed-anchor slopes do not. Removing the count weights must measurably increase drift.
As a stretch goal, we will port the same mechanism to a video backbone and evaluate on MovieBench, whose top model reports 41.3% PrecisionID. That is the external number our streaming method would need to exceed. For reference only, Magic-Me reports DINO identity 0.585 on CustomConcept101 (Magic-Me), but that is a customization setting and not directly comparable.
References
- A class of artificial boundary conditions for heat equation in unbounded domains
- Exact and approximating boundary conditions for the parabolic problems on unbounded domains
- Exact artificial boundary conditions for quasilinear elliptic equations in unbounded domains
- Numerical Methods for the Fractional Laplacian: A Finite Difference-Quadrature Approach
- Accurate artificial boundary conditions for semi-discretized one-dimensional peridynamics
- Style Aligned Image Generation via Shared Attention
- Group Diffusion Transformers are Unsupervised Multitask Learners
- Boost the Identity-Preserving Embedding for Consistent Visual Generation
- The Chosen One: Consistent Characters in Text-to-Image Diffusion Models
- OneActor: Consistent Subject Generation via Cluster-Conditioned Guidance
- Decoupled Diffusion Solver for Inverse Problems on Function Spaces
- MovieBench: A Hierarchical Movie Level Dataset for Long Video Generation
- Magic-Me: Identity-Specific Video Customized Diffusion