Amplifying Latency and Cost of LLM Inference via Rowhammer Attack
Organizations: Indian Institute of Technology Bombay, Mumbai, India
Abstract
Large language models (LLMs) achieve high inference efficiency using optimized GPU kernels generated by just-in-time (JIT) compilation frameworks such as Triton. Triton compiles GPU kernels through an MLIR/LLVM-based pipeline. We investigate whether a Rowhammer-induced bit-flip in the CPU's DRAM can degrade GPU-based LLM inference performance while preserving output correctness. We present LLVMhammer, the first Rowhammer attack that causes LLM inference slowdown by inducing a bit-flip in Triton's compilation pipeline. A bit-flip in a performance-critical optimization pass causes Triton to generate a functionally identical but suboptimal GPU kernel. Since Triton caches the generated kernel on disk, a single successful bit-flip causes persistent slowdown across subsequent inference executions. Triton's target-independent stages are shared across GPU vendors, which makes our attack GPU vendor-agnostic. To identify exploitable bit-flip locations without manual inspection, we build Karnage, a tool that isolates useful bit-flip locations in Triton's target-independent compilation pipeline. We evaluate LLVMHammer across a diverse set of LLMs, including Qwen2.5-7B-Instruct, Llama-3.1-8B-Instruct, Mistral-7B-Instruct-v0.3, and Deepseek-llm-7B-chat, across NVIDIA RTX 4090 and AMD RX 7900 XTX GPUs. LLVMhammer increases inference latency of an LLM inference server running on a single GPU by 4-16%, which, in turn, can translate into additional annual operating costs at the scale of multi-GPU deployments. We further show that LLVMhammer can also corrupt LLM outputs across different GPU vendors, reducing BERTScore to as low as 25%, illustrating the broader security implications of bit-flips in Triton's compilation pipeline.
Figures & tables
| Function count | NVIDIA | AMD |
| Total functions in libtriton.so | 121,735 | 122,148 |
| Target-independent functions (namespace filter) | 7,963 | 8,219 |
| Target-independent functions (Intel PT filter) | 254 | 254 |
| Instruction. A | Opcode A | Instruction. B | Opcode B |
| je | 0x74 | jne | 0x75 |
| jl | 0x7C | jge | 0x7D |
| jle | 0x7E | jg | 0x7F |
| jb | 0x72 | jae | 0x73 |
| jbe | 0x76 | ja | 0x77 |
| js | 0x78 | jns | 0x79 |
| Potentially useful bit-flip locations | Time per trial (s) | Total time (hrs) | ||||
| Stage | NVIDIA | AMD | NVIDIA | AMD | NVIDIA | AMD |
| Stage 1: Namespace filter | 1,183,008 | 1,326,122 | 30 | 30 | 9,858 | 11,051 |
| Stage 1: Intel PT filter | 38,769 | 42,996 | 30 | 30 | 323 | 358 |
| Stage 4: GPU profiling | 1,176 | 810 | 30 | 30 | 10 | 7 |
| IR level | Baseline (unmodified) | Flipped |
| Vectorized vs. Scalar inline-asm emission | ||
| LLVM IR | ⬇ ; single vectorized load (4x32-bit) % val = tail call { i32 , i32 , i32 , i32 } asm sideeffect "ld.global.v4.b32 { 1, 3 }, [ \times$ 32-bit values. | ⬇ ; four separate scalar loads % v0 = tail call i32 asm sideeffect "ld.global.b32 { 0 }, [ 1 ];" , "=r,l" ( ptr addrspace ( 1 ) % ptr0 ) #6 % v1 = tail call i32 asm sideeffect "ld.global.b32 { 0 }, [ 1 ];" , "=r,l" ( ptr addrspace ( 1 ) % ptr1 ) #6 ; ... two more scalar calls A single four-element vector load is scalarized into four scalar loads. |
| 128-bit coalesced load vs. scalar 32-bit loads | ||
| PTX | ⬇ ; 128-bit vectorized load @ % p0 ld . global . v4 . b32 { % r0 , % r1 , % r2 , % r3 }, [ % rd0 + 0 ] ; ; 128-bit vectorized store @ % p1 st . global . v4 . b32 [ % rd1 + 0 ], { % r4 , % r5 , % r6 , % r7 } ; 128-bit coalesced memory transactions; four values per instruction. | ⬇ ; four scalar 32-bit loads @ % p0 ld . global . b32 { % r0 }, [ % rd0 + 0 ] ; @ % p0 ld . global . b32 { % r1 }, [ % rd0 + 4 ] ; @ % p0 ld . global . b32 { % r2 }, [ % rd0 + 8 ] ; @ % p0 ld . global . b32 { % r3 }, [ % rd0 + 12 ] ; ; four scalar 32-bit stores @ % p1 st . global . b32 [ % rd1 + 0 ], % r4 ; @ % p1 st . global . b32 [ % rd1 + 4 ], % r5 ; One 32-bit scalar load per value, resulting in 4 more memory transactions. |
| 128-bit LDG/STG vs. 16-bit scalar LDG | ||
| SASS | ⬇ ; 128-bit vectorized global loads @P 0 LDG . E .128 R4 , [ R2 .64 ] ; @P 0 LDG . E .128 R8 , [ R6 .64 ] ; ; 128-bit vectorized global stores @P 1 STG . E .128 [ R1 0.64 ] , R4 ; @P 1 STG . E .128 [ R1 2.64 ] , R8 ; Each LDG/STG.E.128 loads/stores 128 bits in one transaction. | ⬇ ; 16-bit scalar loads replace 128-bit loads @P 0 LDG . E . U16 R4 , [ R2 .64 ] ; @P 0 LDG . E . U16 R5 , [ R2 .64+ 0x 10 ] ; @P 0 LDG . E . U16 R6 , [ R2 .64+ 0x 20 ] ; @P 0 LDG . E . U16 R7 , [ R2 .64+ 0x 30 ] ; ; ... 48 x LDG.E.U16 total ; ... 0 x LDG/STG.E.128 remain Vectorized loads are replaced with multiple scalar loads. |
| Component | Platform A | Platform B |
| CPU | Intel i7-4790 (Haswell) | Intel i7-8700 (Coffee Lake) |
| DRAM | 8 GB Kingston DDR3 @ 1600 | 8 GB Corsair DDR4 @ 2400 |
| OS | Ubuntu 20.04.6 LTS | |
| Kernel | 5.15.0-131 | 6.2.0-060200 |
| GPU | NVIDIA RTX 4090 (24 GB GDDR6X) AMD RX 7900 XTX (24 GB GDDR6) | |
| LLM Models | Qwen2.5-7B-Instruct [ 28 ] , Llama-3.1-8B-Instruct [ 29 ] Mistral-7B-Instruct-v0.3 [ 30 ] , Deepseek-llm-7B-chat [ 31 ] | |
| Vendor | Model | |||
| NVIDIA | DeepSeek | 2/5 | 3/5 | ✓ |
| Llama | 2/5 | ✓ | ✓ | |
| Mistral | 0/5 | 3/5 | ✓ | |
| Qwen | 1/5 | 1/5 | ✓ | |
| AMD | DeepSeek | ✓ | ✓ | ✓ |
| Llama | 1/5 | ✓ | ✓ |
| Platform | Baseline output | Flipped output |
| Prompt: A hospitalized 70-year-old woman develops thrombocytopenia on day 7 post orthopedic surgery What is the most likely cause? | ||
| AMD | ⬇ A : Immune - mediated thrombocytopenia B : Thrombotic thrombocytopenic purpura C : Drug - induced thrombocytopenia ... | ⬇ ,000000000000000000000000000000000 0000000000000000000000000000000000 n000000000000000000000000000000000 |
| NVIDIA | ⬇ A ) Heparin - induced thrombocytopenia B ) Immune thrombocytopenia purpura C ) Thrombotic thrombocytopenic purpura ... | ⬇ from theise from the , theise , theise from the , the from the , the from the , the from the , the from the from theise |
LLM Security
Large language model (LLM) security studies attacks, privacy risks, and defenses across model training, inference, and deployment.
See all 318 papers