Sibling Drafting: Speculative Decoding Across Device-Specific Layout Variants

Android apps run on thousands of screen sizes and many operating-system versions. A fix for a layout bug therefore often has to be written several times: once per API level, screen-width bucket, or orientation, each as its own resource file. These copies are nearly identical. They share the same repair, such as a new wrapping container or a replaced attribute, and differ only in a few device-sensitive values. Today an LLM repair pipeline writes each copy token by token, as if it had never written the others. We propose to speed this up with speculative decoding, in which a cheap proposer guesses several upcoming tokens and the large model checks all of them in one parallel pass, keeping exactly what it would have produced anyway. The new element is the source of the guesses: each variant draws its draft from the variants being written alongside it, its "siblings," rather than from a separate small model or only from the original buggy file.

The idea rests on two claims. First, output that is already written for one device configuration should be an unusually good draft for the next one. That draft carries the new repair tokens, which the original file cannot supply. Because verification preserves the target model's output exactly, the speedup does not change what the repair says. Second, the positions where a sibling draft gets rejected are informative in their own right. Those rejection points mark where the target model decided a given device needs something different, so decoding produces, at no extra cost, a map of which attributes are sensitive to fragmentation. That is useful because LLMs are known to be good at repairing but poor at localizing these bugs.

Core Claim

We claim that jointly decoding the $N$ configuration-specific variants of a layout repair gives a large speedup over existing edit-oriented speculative decoding, with output identical to generating each variant independently. The mechanism is a verification tree that pools three draft sources: the original file, the in-progress outputs of sibling variants, and a small draft model. Earlier siblings act as drafts for later ones, and parallel siblings draft for each other. The gain over reuse-only drafting should concentrate in the tokens that were edited, which is exactly where reuse-only drafting falls back to slow generation. The rejection positions across siblings should also agree with the ground-truth device-sensitive attributes well above chance.

Relation to Prior Work

The closest work is EFFICIENTEDIT. It observes that about 70% of tokens in a code edit are copied from the input, passes those original tokens to the target model as a free draft, and treats the first rejected position as the edit location. At that point it switches to a fine-tuned edit draft model. It reports a 10.38x speedup on CanItEdit and 13.09x on CodeIF-Bench with DeepSeek-Coder-33B. We supply a missing draft source rather than replace this method. EFFICIENTEDIT's reuse phase cannot predict new tokens, and each edit is decoded on its own. In the multi-variant setting, the new tokens of one variant are the best available prediction of the new tokens of the next. EFFICIENTEDIT was also evaluated only on Python editing, not on declarative layout markup.

The repair setting comes from LLM-CompDroid. It repairs Android XML configuration compatibility bugs across API levels 21–31 using ConfFix-style dynamic analysis plus Repairer, Checker, and Optimizer agents, and it reaches 92.5% repair success on 77 bugs. It motivates this proposal in two ways. Its multi-agent loop is expensive to decode. Its finding that standalone GPT-4 is a poor localizer ("surgeons, not detectives") is what makes a free localization signal worth having. Detection and evaluation borrow from Nighthawk, a Faster-RCNN detector of display bugs trained on synthetically injected Rico bugs. It reports 0.84 AP against OwlEye's 0.59. We use it only to check that repaired variants render cleanly on their target geometry, not as part of the decoder.

For verifying several drafts at once we reuse existing methods. Sequoia builds hardware-aware token trees with dynamic programming. Tree-based sampling that keeps the target distribution intact, as in Accelerated Speculative Sampling Based on Tree Monte Carlo, lets us merge sibling, original, and model drafts into one tree without distorting sampled outputs. DuoDecoding varies the number of draft sequences according to draft uncertainty, which is close to our policy for how much tree budget each source receives. Its contribution is heterogeneous CPU–GPU placement, which we do not study.

The mobile-hardware line of work concerns a different kind of fragmentation. sd.npu, EdgeLLM, and FlexSpec adapt speculation to the device that runs the model. We are concerned with the fragmentation of the artifact the model writes, so these papers limit where we would deploy but do not compete with the core claim.

Research Program

The system takes a buggy layout file, a bug report, and a set of $N$ target configurations, for example API 21, API 26, and API 31, or the default, sw600dp, and land screen buckets. It decodes $N$ streams in one batch. Each stream conditions the target model only on the original file and its own configuration description. Sibling outputs never enter the prompt; they are used only as drafts, which is what keeps every stream lossless relative to independent generation.

At each step, the drafter for stream $j$ assembles candidate continuations from three places. The first is the original file, aligned by the usual reuse pointer. The second is each sibling $k$'s committed output, aligned to stream $j$'s position through a lightweight token-level alignment such as longest-common-suffix matching over the last few committed tokens. The third is a small draft model. These candidates are merged into one prefix tree and verified in a single forward pass. The number of tree nodes per source is set by a Sequoia-style budget. Its acceptance estimates are updated online per source and per region, because sibling drafts should dominate inside edited spans and original-file drafts outside them.

We study two schedules. In the sequential schedule, one "lead" variant is decoded first with ordinary edit-oriented drafting, and followers draft from its complete output. In the parallel schedule, all streams advance together and the stream furthest ahead drafts for the rest. The parallel schedule has lower latency; the sequential schedule gives the simplest analysis.

The second output is the divergence map. It records every position where a sibling draft was rejected in some stream while the original-file draft was also rejected. We project these positions back onto XML elements and attributes and compare them with ground-truth bug locations.

Baselines

The naive reference is plain autoregressive decoding of each variant with DeepSeek-Coder-33B, the target model used by EFFICIENTEDIT. We run it on one A100, the same GPU used by Sequoia, with batch size equal to $N$. Every speedup is measured against this.

The strongest existing competitor is EFFICIENTEDIT run independently on each variant, with the edit-oriented draft model it describes fine-tuned on InstructCoder. It is the strongest because it already exploits reuse of the original file, which accounts for most tokens in a layout edit. The only reported number on Lacuna is 10.38x latency speedup on CanItEdit with DeepSeek-Coder-33B, from EFFICIENTEDIT. No reported result was found on Lacuna for speculative decoding of Android XML layout repair, so we will re-measure EFFICIENTEDIT on our layout tasks with the same target model, hardware, prompts, and draft-model training data. We also reproduce its CanItEdit number to confirm the reimplementation is faithful. To beat it, sibling drafting must deliver lower wall-clock time for the complete set of $N$ variants at identical outputs. We will report the result as a function of $N$, and we expect the margin to grow with $N$.

The ablation that isolates the key ingredient is our full tree with the sibling source removed, keeping only the original file and the draft model under the same tree budget. A second ablation removes the original-file source to see how much siblings can do alone.

For repair quality, the reference is LLM-CompDroid's 92.5% success rate on its 77-bug benchmark, as reported in LLM-CompDroid. Because our decoding is lossless, the question is only whether our target-model pipeline preserves the quality of the pipeline we plug it into. It should do so by construction, and we will check that token for token.

For the divergence map, the baseline is prompting the same target model to name the faulty attribute. This is the localization-by-asking approach that LLM-CompDroid found unreliable.

Why not just…?

Why not just run EFFICIENTEDIT once per variant? This is the main threat, and it wins if the variants rarely share new tokens. If most repairs change one attribute value that differs per configuration, the original file already covers nearly everything, and siblings add little. The ablation settles it. We will report acceptance length separately inside and outside edited spans. The proposal succeeds only if sibling drafts raise acceptance inside edited spans substantially, for example on wrapping-container repairs of the kind ConfFix's templates cannot express. If they do not, we will report that the multi-variant structure is already exploited by reuse-only drafting.

Why not just have the model write one repair and then emit per-variant diffs? This cuts output tokens without any decoding trick and is a serious alternative. It changes the output, however. Diffs against a model-written base are a different generation task from writing each configuration's file in full, and they add a patch-application step that can fail on malformed hunks. We will run this as a separate system and report both wall-clock time and repair success on rendered devices. If diff-emission matches our speed without losing repair success, the practical case for sibling drafting shrinks to settings where full files are required, and we will say so.

Why not just put the sibling outputs into the prompt and use a copy-from-context n-gram drafter? This reuses the sibling text too, but it changes what the target model conditions on, so the outputs are no longer those of independent per-variant generation. It may also bias later variants toward copying earlier ones, which hides the device-specific differences we are trying to preserve. No reported result was found on Lacuna for this baseline. We will run it and measure speed, token-level divergence from independent outputs, and rendered repair success. That will show whether keeping siblings out of the prompt costs speed and whether it buys correctness.

Proposed Experiments

The primary benchmark is the Android configuration compatibility set from LLM-CompDroid: 77 confirmed bugs across 13 apps and API levels 21–31. Each bug becomes an $N$-variant task over the API levels on which it manifests, with API-qualified resource files. The second benchmark is built from Rico. Following Nighthawk's injection procedure, we inject occlusion and truncation bugs into view hierarchies and require repairs for three to five screen-width and orientation buckets. Correctness is judged by rendering each variant on a matching emulator profile and running the Nighthawk detector, backed by manual review of a sample. CanItEdit serves as a single-variant sanity check, where sibling drafting should reduce to EFFICIENTEDIT.

The metrics are wall-clock latency for the full variant set, mean accepted tokens per verification step broken down by draft source and by edited versus unedited region, exact-match agreement with plain decoding (which must be 100% under greedy decoding), and repair success on rendered devices. For the divergence map we report top-k localization precision against ground-truth attributes.

We have two decisive checks. The first is the sibling ablation on edited-region acceptance. If sibling drafts do not beat the original-file draft in edited spans, the core claim fails regardless of end-to-end numbers. The second is the scaling curve of speedup against $N$. The per-variant cost should fall roughly as the fraction of edit tokens that siblings share, because only unshared tokens need slow generation. A flat curve would mean the sibling mechanism is not doing the work.