arXiv:2610.29733cs.SEOct 2026

Manuscript Offprint

arXiv:2610.29733

SAKURA: Serving Attention Key-Value State Under Rate Adaptation for Private Image Editing on Phones

Shuncheng Jie, Desen Sun, Ri Hong, Yuyang Tian, Hong Zhang, Sihang Liu

Shuncheng Jie

University of Waterloo

Canada

kevin.jie@uwaterloo.ca

Yuyang Tian

University of Waterloo

Canada

y254tian@uwaterloo.ca

Desen Sun

University of Waterloo

Canada

desen.sun@uwaterloo.ca

Hong Zhang

University of Waterloo

Canada

hongzhangblaze@gmail.com

Ri Hong

University of Waterloo

Canada

r7hong@uwaterloo.ca

Sihang Liu

University of Waterloo

Canada

sihangliu@uwaterloo.ca

Abstract

Diffusion transformers are widely used in image-editing services. To preserve both efficiency and privacy, existing systems commonly rely on cloud–device collaboration. Keeping request-specific inference on the device avoids sending personal images and prompts to the cloud. These workloads often use common templates, such as in face swapping and virtual try-on, enabling KV state to be precomputed and reused across requests. However, this reusable state is large and scales with the number of templates, making it impractical to store all of them on mobile devices. Storing them in the cloud addresses this capacity issue, but cache transfer is placed onto the inference path and can even be slower than on-device computation, especially under fluctuating mobile networks.

We introduce SAKURA, a cloud–edge architecture that delivers reusable attention state to mobile devices under a bandwidth budget. It first uses a fine-grained token-importance-aware compression method to preserve image quality under limited transfer budgets. At runtime, SAKURA adaptively selects the cache representation for each upcoming shard based on network bandwidth. To enable efficient execution, we develop a pipelined runtime that overlaps cache transfer and reconstruction with on-device execution. We evaluate SAKURA using three editing tasks and two diffusion models, using a Snapdragon 8 Elite Gen 5 phone. SAKURA reduces latency by 1.82×1.82\times and 3.27×3.27\times over CacheGen adapted to DiT and on-device generation, respectively. It also reduces cache storage by 3.06×3.06\times over uncompressed cache, while preserving image quality.

1 Introduction

Diffusion transformers (DiTs) have become a leading architecture for high-fidelity image generation and editing [7, 10, 16, 47]. A widely deployed class of editing applications personalizes only part of a provider-supplied image while preserving the surrounding content. Virtual try-on [28, 58, 75], face swapping [6, 23, 70], and localized image editing [25, 43, 52] are representative examples. Personalized editing is already offered by cloud services, such as Google Shopping's photo-conditioned virtual try-on and Amazon Nova Canvas's managed virtual try-on API [3–5, 20]. These applications take two kinds of different inputs: provider-owned templates can be public and reused across users, whereas each request contains privacy-sensitive user data such as personal photographs, reference images, and editing instructions. Keeping request-specific inference on the device is therefore attractive because these inputs and the intermediate states derived from them need not be sent to a remote execution service. Recent advances in model compression, architecture optimization, and heterogeneous mobile execution have made on-device diffusion inference increasingly practical [11, 34, 77].

When requests share a template and a fixed mask defining the editable region, computation associated with the unchanged region can be reused across requests. In a DiT, the key/value (KV) state of these reusable tokens can be precomputed for each template and reused while the device computes only the request-dependent state for the edited region [25, 31, 49, 71]. Cross-request reuse can therefore substantially reduce repeated on-device computation. Every template has a different reusable state and the aggregate footprint grows with the number of templates.

This creates a mobile-specific scalability gap between execution capacity and reuse capacity: a device may have enough compute and working memory to run each edit, yet lack the storage to retain caches across a large template catalog. In our FLUX.2-klein-4B deployment [7] at 512×512512 \times 512 resolution, the reusable FP16 KV state occupies up to 1.46 GiB for a single template. A catalog with hundreds of templates would therefore require hundreds of gigabytes of persistent storage, far beyond what is practical to replicate on individual mobile devices. Cloud-only execution avoids this storage constraint but requires sending private user requests to the server. We instead consider a different cloud–edge split: request-specific inference remains on the device, while the cloud stores the much larger, provider-owned reusable templates and supplies the required cache on demand. Unlike conventional cloud-edge inference, which offloads all or part of a request to remote compute [22, 27, 68], this scheme uses the cloud for template storage. The network carries reusable template state, while user inputs and request-specific activations remain on the device.

Moving reusable state to the cloud resolves the device-side capacity problem, but places cache transfer on the inference path. At the 545 Mbps median bandwidth of the 5G trace used in our evaluation [45], transferring the full FP16 cache takes approximately 23 s, even without device-side cache reconstruction. In comparison, executing the complete model locally without cache reuse takes about 13 s on our mobile platform. Naively fetching the full cache is therefore slower than running the complete model locally. Remote reuse must both reduce the transmitted bytes and hide cache transfer behind local computation.

These requirements translate into two challenges. First, the cache must be compressed aggressively enough to arrive before use while preserving editing quality. At an approximately 10% mask ratio, only 2.3 s of local computation is available in total to hide cache transfer; even uniform 2-bit quantization requires at least 650 Mbps, above the median 5G bandwidth. Moreover, reusable cache compression must be constructed offline, before future edit requests are known. This is challenging because the importance of cached tokens depends on the request-specific query generated by the edited region. Therefore, compression must determine which tokens to preserve without knowing the future request. Second, cache transfer must adapt as mobile bandwidth changes during an edit. A representation chosen early in execution may become too large when bandwidth drops or unnecessarily compressed when bandwidth improves, requiring transfer decisions to be revised as later cache state is consumed.

Token-importance-aware cache compression. Our first key idea is to make request-dependent token importance usable for offline reusable cache compression. Although the exact attention scores depend on the specific request, We observe that, for a fixed template and mask, the reusable tokens that matter most remain largely consistent across different edit requests at the same transformer block and denoising step. This consistency allows importance measured from representative requests offline (i.e., through profiling) to guide compression for future requests. Accordingly, compression can preseve cached tokens that are consistently important with higher accuracy.

Bandwidth-adaptive streaming. Our second key idea is to make cache transfer decisions at fine granularity based on the network conditions. Each shard contains the reusable state for a group of consecutive transformer blocks at one denoising step. SAKURA can adjust its transfer decision before each shard is needed. It combines recent network measurements with device execution progress to determine how much cache data can arrive in time, then selects the highest-quality available representation that fits this budget. If an earlier transfer finishes ahead of use, the resulting lead time is carried forward to later shards. This allows cache transfer to track bandwidth changes within an edit instead of turning them into execution stalls.

We present SAKURA, a cloud-edge cache streaming system that realizes these ideas through complementary offline and online decisions. Offline, SAKURA uses transferable token importance to construct an importance-weighted low-rank factorization, preserving high-impact tokens' KV state more accurately under aggressive compression. The compressed cache can vary along two dimensions: how much low-dimensional structure is retained and how precisely it is encoded. These choices are organized into a nested representation, allowing multiple compression levels to share the same offline-constructed cache and enabling runtime adaptation without repeating compression. Online, SAKURA adaptively selects the representation of each upcoming cache shard based on current network conditions and device execution progress, ensuring that the shard can be transferred before it is needed for computation. To enable efficient mobile execution, we develop a heterogeneous mobile runtime that pipelines cache reception on the CPU, reconstruction on the GPU, and model execution on the NPU, overlapping the communication and reconstruction behind on-device computation.

This paper makes the following contributions:

  • To the best of our knowledge, we present the first cloud-edge system that enables DiT cache reuse for mobile image editing, where reusable template cache states are stored in the cloud and streamed to the device upon request.

  • We design a token-importance-aware cache compression scheme that exploits the stability of importance of the cache state across requests. We also design a cache representation that supports fine-grained adaptation across precision levels without storing a separate version for each level.

  • We develop an adaptive runtime that adjusts cache transfer to bandwidth fluctuations and overlaps cache transfer and reconstruction with on-device diffusion computation.

  • We evaluate SAKURA on three editing tasks and two diffusion models using both 5G traces and WiFi. On a Snapdragon 8 Elite Gen 5 phone, SAKURA reduces generation latency by 1.82×1.82\times and 3.27×3.27\times compared with CacheGen [36] adapted to DiT and on-device generation, respectively. It also reduces cache storage by 3.06×3.06\times compared with uncompressed caching while preserving image quality.

References (23)