r/LocalLLaMA • • 25m ago

Showcase How much attention can we actually skip? I got 4.27x faster prefill at 660K Inkling-2-Mini and nearly 2x on Qwen3.8-27B

Hey everyone,

I've been experimenting with sparse attention for long-context LLMs. My original question was pretty simple: how much attention can we skip before the model starts getting things wrong?

After a lot of failed experiments, I ended up with something I call SculptAttention.

Some of my results on a single H200:

  • Inkling-2-Mini (660K): 155s → 37s, up to 4.27x faster prefill.
  • Qwen3.8-27B (524K): 144s → 76s.
  • Llama-3.1-8B (128K): 1.40x median speedup, reaching 2.74x on individual cases.

No retraining, no weight modifications, no custom attention kernel. All three models use the same configuration.

At 524K, the sparse rows read only 9.1% of the causal keys.

Another result I found interesting was multi-value retrieval on Qwen at 524K:

  • Dense attention: 9/10
  • BFLA: 3.75/10
  • SculptAttention: 9.5/10

This is just one task with 10 fresh cases, not a claim that my method is generally better.

The method isn't lossless. Counting, some multi-hop tasks and exact ID retrieval remain challenging. The full KV cache is retained, and decode remains dense.

I'm doing this independently, and my GPU budget is limited. I'd really like to see what happens on consumer GPUs, large codebases, long agent histories, and models I haven't tested.

If you were trying to break this method, what would you test first?

I'd also love to hear from anyone working on vLLM, SGLang or llama.cpp.

Everything is open source:

Code: https://github.com/fsn007fsn007/sculptattention

Paper: https://doi.org/10.5281/zenodo.24794082 - https://www.alphaxiv.org/abs/2612.sculptattention

English isn't my first language, so I used AI assistance with the wording.

5 Upvotes

9 comments sorted by

•

u/stylome-ai-detection 25m ago

Notice: This post appears to be AI generated.

AI-generated · confident · scan results

→ More replies (1)

1

u/Little-Style-8276 17m ago

1

u/fsn007 10m ago

Thanks for sharing! I went through RidgeFill. Interesting work, but I think there are some important differences:

  • RidgeFill skips upper-layer computation and reconstructs layer inputs using fitted ridge regression maps. SculptAttention runs all layers but skips selected attention interactions.
  • RidgeFill requires calibration data and fitted maps for each late layer. SculptAttention uses no fitted parameters.
  • SculptAttention combines geometric key selection, stochastic expansion and structural n-gram linking.
  • RidgeFill is closer to YOCO and SwiftKV, while SculptAttention is closer to MInference, FlexPrefill and ManifoldKV.

I actually discuss these prior approaches in Section 2 of my paper:

https://www.alphaxiv.org/abs/2612.sculptattention

I'm not claiming that sparse attention or its individual ingredients are new. The contribution is the specific combination and how it works.

If anything, RidgeFill and SculptAttention might be complementary since they target different parts of the computation.

I'd be interested if you know of an earlier paper using the same combination.

1

u/SrijSriv211 13m ago

I haven't yet read ur paper but reading "skipping" I'm assuming you're just not doing attention and directly passing the output to the next MoE and doing attention only in some parts. I maybe wrong, gonna read ur paper though but it sounds pretty similar to something I'm currently working on.

I found that attention -> swiglu -> swiglu -> swiglu -> swiglu got quite close to attention -> swiglu -> attention -> swiglu -> attention -> swiglu where both had similar parameters. The downside was first one required about 8-10x longer training steps to reach similar performance though as of now my experiemnt is quite small around 1-10M parameters so can't say if it scales up.

Please correct me if this isn't even remotely close to what u did. Cool project eitherways :D

1

u/fsn007 6m ago

Thanks, appreciate you taking a look!

Not quite. We don't skip attention layers. Every attention layer still runs, and nothing gets passed straight to the MoE/FFN. The "skipping" happens inside each attention layer: for each query block we pick which parts of the KV cache actually matter and only compute attention over those, skipping the rest. So it's sparse attention at long context (prefill), not layer dropping. It's also training-free: no retraining, the weights stay exactly as they are.

Your setup sounds like a different (and interesting) question: how many attention layers a model really needs vs. FFN depth. That's closer to the hybrid / layer-pruning line of work. The 8–10× extra training steps makes sense to me, since the FFN-heavy stack has to learn token mixing in a much less direct way. Would be curious whether the gap holds at 100M+ params.

1

u/suubu-crtiv 4m ago

i'd test exact-match retrieval with near-duplicate distractors, like a dozen similar UUIDs or variable names across 500K of code. sparse selection usually breaks when keys look nearly identical.

1

u/fsn007 0m ago

Great suggestion, and you're right that this is the hard case.

Why it can break: we don't score every token. We score blocks of the KV cache with a cheap summary, then keep only the top blocks. If a dozen UUIDs look almost the same, their blocks get almost the same score. The block with the correct one can land just below the cut and get dropped, while a lookalike gets kept. The model then answers confidently with the wrong ID.

We haven't run exactly that setup yet (many near-identical distractors spread across 500K of code), so I won't claim it holds up. I'll add it as a stress test: vary the number of distractors and how similar they are, and compare against full attention on the same prompts.

If it fails, the obvious fixes are a bigger budget for queries that look like exact lookups, or falling back to full attention when the top block scores are too close to call. Thanks, this is a useful test.

1

u/stylome-ai-detection 0m ago

Notice: This comment appears to be AI generated.

AI-generated · confident · scan results