Skip to content
All conferences

PyTorch Day Japan

27×

faster prefill on a second turn: Qwen3-1.7B on ExecuTorch, reusing 1,192 tokens

Tokyo, 10 December 2026

When the KV Cache Cannot Roll Back: Prefix Reuse on Android.

How a phone skips re-reading a 2,050-token agent prompt, built twice because the app's two runtimes have different cache constraints.

The talk

An agent prompt on a phone can open with about 2,050 tokens of harness, 1,700 of them tool definitions. On a Dimensity 9500s, a 1,036-token prefix takes 9.3 s to prefill on LFM2.5-1.2B and 45 s on SmolLM3-3B; faster decode does nothing to that wait. We solved it with prefix reuse, built twice because our open source app ships two runtimes with different cache constraints.

ExecuTorch's Android API exposes prefill and full reset, but no partial rollback. We prefill the shared head at model load, then feed only the unmatched suffix while the prompt is an exact extension. On our llama.cpp path, LFM2.5's recurrent state cannot rewind without per-token snapshots, so we snapshot the warmed 12 MB state and restore it.

Correctness depends on byte identity. The date is pinned per conversation, history replays the engine's own bytes, changing reasoning mode invalidates the prefix, and truncated replies are never reused. The talk shows the cache rules, the failures and the regression tests; measurements and logs are public.

The evidence

What prefix reuse saves

Runtime and modelWhat was comparedBeforeAfter
ExecuTorch, Qwen3-1.7BPrefill on the first turn against the second, which reused 1,192 tokens5,852 ms215 ms
llama.cpp, LFM2.5-1.2BCold prefill of the head against a fresh chat's first token9,326 ms235 ms

ExecuTorch ran Qwen3-1.7B q8da4w on 2026-08-31, feeding 903 tokens on the first turn and 20 new ones on the second. llama.cpp ran LFM2.5-1.2B Q4_K_M on 2026-09-03 on a synthetic 1,036-token prefix, restoring a 12 MB snapshot. The two rows measure different things and do not compare with each other. Both ran on the same POCO X8 Pro Max.

Where and when

Conference
PyTorch Day Japan, hosted by the PyTorch Foundation, Hugging Face, IBM and Mitsubishi Electric
Date
Thursday 10 December 2026, 5:15 PM to 5:35 PM JST
Room
2F Hall, Bellesalle Akihabara, Tokyo
Track
Physical AI/Edge AI

Watch and read

Keep reading

All conferences
  • PyTorch Day Korea

    1 in 5

    replies from the compiled 1.2B cited a search it never made, on our first test set. As a GGUF, none of 640

    Seoul, 21 November 2026

    The Search It Never Made

    Whether a small model on a phone searches when it must, on 160 public questions, four phones and two builds of the same weights.

    Xynil Jhed Lacap

  • GitHub Universe

    24 tasks

    of real work on ten setups. Each bar is tasks finished; the bright ones ran locally

    San Francisco, 28 October 2026

    When is local Copilot worth it?

    The same Copilot CLI agent on the same real tasks: open-weight models you serve yourself against hosted Copilot.

    Alpha Romer Coma

  • PyTorch Conference Europe

    Compiler Tax

    what surprises developers moving PyTorch workloads to ASICs

    Paris, 8 April 2026

    De-mystifying PyTorch for ASICs

    A code-first check on moving PyTorch from GPUs to Google TPUs and AWS Trainium, and when it is worth doing.

    Alpha Romer Coma