FlashAttention for Scalable Vector Architectures
Abstract: Inference with transformer models on CPUs is increasingly important, especially for Small LLMs (SLMs), where vector architectures are emerging as a promising execution substrate. The attention module is a major bottleneck due to high memory bandwidth requirements; FlashAttention mitigates this by fusing operations to improve data locality and reduce intermediate memory traffic. In this paper, we present FlashAttention-V, a blocked FlashAttention for scalable vector architectures that adapts efficiently from short to very long vectors by exploiting parallelism across attention heads, inter-head packing to enable efficient utilization of vector lengths beyond the head dimension, and improving vector register utilization and memory access locality. We integrate FlashAttention-V into ggml within llama.cpp and evaluate it on TinyLlama, Llama 3.2, Qwen2.5, and Pythia-410M using gem5 and a Banana Pi BPI-F3. On the Banana Pi BPI-F3, we confirm that loop reordering and loop unrolling across attention heads are effective optimization principles, scaling performance gains with larger models and most pronounced with short contexts and during decoding. Simulation-based analysis shows that FlashAttention-V achieves 22x-42x speedup over scalar FlashAttention at 512-bit VL in prefill, with an additional 2x-2.5x gain scaling to 64 lanes and 4096-bit VL. During decode, FlashAttention-V achieves 8x-11x speedup using 512-bit vector lengths over scalar FlashAttention, with performance showing diminishing sensitivity to vector width and lane count due to single-token, memory-bound execution. We further identify structural bottlenecks in Q8_0 quantized linear layers that limit arithmetic amortization under long-vector execution, consistent across RVV and Arm SVE, indicating that current quantization formats pose a fundamental challenge to long-vector scalability.
Paper Prompts
Sign up for free to create and run prompts on this paper.
Top Community Prompts
Explain it Like I'm 14
1. What is this paper about?
This paper is about making small LLMs run faster on CPUs, especially on small devices such as phones, embedded computers, or edge AI machines.
The researchers focus on a part of Transformer models called attention. Attention helps a LLM decide which earlier words are important when understanding or generating text. However, attention can be slow because it repeatedly moves large amounts of data between memory and the processor.
The paper introduces a new version of FlashAttention called FlashAttention-V. It is designed for CPUs with powerful vector processors, which can perform the same operation on many numbers at once.
2. What questions are the researchers asking?
The main questions are:
- Can FlashAttention be redesigned to work well on CPUs with different vector sizes?
- Can the method still use the processor efficiently when its vector registers are larger than one attention head?
- Does the new method make language-model inference faster during both:
- Prefill, when the model reads the starting prompt
- Decode, when the model generates one new token at a time?
- Does FlashAttention-V work for both ordinary Multi-Head Attention (MHA) and the more memory-saving Grouped-Query Attention (GQA)?
- Are other parts of the LLM, especially quantized layers, stopping the whole model from benefiting from very long vectors?
A useful analogy is a supermarket checkout. A normal processor may handle one item at a time, while a vector processor can handle many items together. The researchers want to know how to fill these “many-item” lanes without leaving space unused.
3. How did they do the research?
Understanding attention
In a Transformer, each word is turned into three kinds of information:
- Query (Q): what this word is looking for
- Key (K): what information each word contains
- Value (V): the information that can be passed on
The model compares queries and keys to decide which values deserve the most attention.
A normal attention calculation creates a large table of scores. This table can use a lot of memory, especially for long text.
Using FlashAttention
FlashAttention avoids storing the entire large table. Instead, it works on small pieces, or blocks, one at a time. It keeps only the information needed to continue the calculation.
This is similar to solving a large puzzle in sections rather than spreading every puzzle piece across the entire floor.
The new idea: packing several heads together
An attention head usually has a small size, often 64 or 128 numbers. Older vectorized methods could not use much more than that size. If the processor had a much longer vector, some of its space remained empty.
FlashAttention-V solves this by processing several attention heads together. For example, if one head fits into part of a vector register, the method can place several independent heads side by side in the same register. This is called inter-head packing.
The researchers also used:
- Loop reordering: changing the order in which calculations are performed so nearby data is reused more easily.
- Loop unrolling: doing several loop steps together so the processor has more independent work available.
- Blocking: dividing large calculations into smaller pieces that fit better in the processor’s cache.
- GQA-aware reuse: loading shared keys and values only once when several query heads use them.
Testing the method
The researchers added FlashAttention-V to ggml, the tensor library used by llama.cpp.
They tested it with four LLMs:
- TinyLlama
- Llama 3.2
- Qwen2.5
- Pythia-410M
They used two main types of tests:
- A real Banana Pi BPI-F3, containing a RISC-V CPU.
- gem5, a computer simulator used to study processors with vector lengths from 512 bits up to 8192 bits.
They also used QEMU to check that the method worked correctly on both RISC-V vector processors and Arm SVE processors.
The researchers compared FlashAttention-V with slower scalar code and with existing vectorized versions.
4. What did they find?
FlashAttention-V made attention much faster
In simulations using 512-bit vectors, FlashAttention-V was:
- 22 to 42 times faster than scalar FlashAttention during prefill
- 8 to 11 times faster during decode
On the real Banana Pi board, it achieved about:
- 12 to 14 times faster than scalar FlashAttention in some prefill tests
These are large improvements, showing that carefully organizing the work can make a major difference.
It worked especially well for short prompts
FlashAttention-V often performed best when the input sequence was short, such as 64 or 128 tokens. This matters because small edge devices commonly process short requests.
For several models, it was about 1.2 to 1.5 times faster than the existing vectorized FlashAttention at these shorter sequence lengths. For Qwen2.5, the improvement reached about 1.5 to 2 times in some tests.
Longer vectors helped, but not forever
Using wider vectors generally improved prefill performance. Scaling the design to more lanes and longer vectors produced an additional improvement of roughly 2 to 2.5 times in some simulations.
However, the benefits became smaller at very large vector sizes. This happens because wider vectors do not automatically mean the processor can finish the work proportionally faster. Memory access and instruction delays start to matter more.
Decode is limited by memory
During decoding, the model generates only one token at a time. This creates very little calculation that can be done in parallel.
As a result, making the vector longer helped less during decode. The work became memory-bound, meaning the processor spent much of its time waiting for data instead of doing calculations.
Quantization caused another problem
The researchers also studied Q8_0, an 8-bit quantization format. Quantization stores numbers using fewer bits, making models smaller and reducing memory use.
However, in this format, groups of weights and their scaling information are stored in an arrangement that is awkward for very long vectors. The processor must reorganize the data before using it. This extra work is called packing, and combining partial results also requires reductions.
At a 2048-bit vector length, these extra operations used about 60% of the execution time in some tests. The same problem appeared on both RISC-V and Arm SVE, suggesting that the issue comes from the data format itself rather than from one particular processor.
5. Why is this research important?
This paper shows that vector processors can be used much more effectively for running LLMs on CPUs.
The main lesson is that simply making vector registers longer is not enough. Software must also reorganize its calculations so that the registers are completely filled and data is reused instead of repeatedly loaded from memory.
FlashAttention-V could help make small LLMs:
- Faster on low-cost CPUs
- More practical on edge devices
- Less dependent on powerful GPUs or cloud servers
- More energy-efficient in some situations
- Better suited to local applications where data should stay on the device
The research also identifies an important warning: quantization formats need to be designed with long-vector processors in mind. A model may be smaller because of quantization, but the way its data is arranged can prevent the processor from using its hardware efficiently.
Overall, the paper presents a faster way to run Transformer attention and gives hardware and software designers useful information about what works well—and what still needs improvement—for future CPU-based AI systems.
Knowledge Gaps
Knowledge gaps, limitations, and open questions
The paper leaves the following issues unresolved:
- Incomplete evaluation scope: The provided paper text ends during the Banana Pi evaluation, so results for the full experimental analysis—including long-vector simulations, end-to-end inference, and linear/feed-forward layers—are not fully presented.
- Limited real-hardware validation: Performance is measured on only one RVV device, the single-core Banana Pi BPI-F3 with a 256-bit vector length; the claimed scalability to 512–8192-bit vectors is based primarily on simulation rather than commercially available long-vector hardware.
- Unvalidated gem5 latency model: The proposed vector-latency scaling model is informed by Vitruvius+, Ara2, and AraXL assumptions but is not validated against measurements from corresponding physical processors. Its accuracy for different microarchitectures, pipelines, memory systems, and vector functional units remains uncertain.
- Restricted processor modeling: The main simulations use the in-order
RiscvMinorCPU; out-of-order execution, multiple issue, speculation, hardware prefetching, and more sophisticated scheduling effects are not evaluated, although these features could substantially change the benefits of loop unrolling and register reuse. - Single-core limitation: The study does not quantify multi-core scalability, thread-scheduling overhead, inter-core cache interference, shared-memory bandwidth contention, or performance under concurrent inference requests.
- Narrow model coverage: Evaluation includes only four decoder-only models, with head dimensions of 64 or 128 and batch size 1. It remains unclear whether FlashAttention-V generalizes to larger head dimensions, other head counts, MQA, dense MHA models, sliding-window attention, cross-attention, or newer architectures.
- Limited sequence-length analysis: The reported real-hardware experiments emphasize short contexts, while the behavior at long practical contexts is inferred mainly from simulation. Effects of sequence lengths beyond those explicitly tested, including context sizes larger than 4096 tokens, remain insufficiently characterized.
- No systematic batch-size study: The experiments use only batch size 1, leaving the impact of batching, request aggregation, and variable batch sizes on inter-head packing, cache locality, and decode performance unresolved.
- Insufficient baseline comparisons: The implementation is not directly compared with several relevant optimized CPU attention kernels, including FlashAttention-2-style CPU adaptations, oneDNN/XNNPACK implementations, optimized Arm SVE kernels, AVX-512 implementations, or the Titopoulos et al. implementation under a common tensor layout.
- Tensor-layout confounding: Because the competing Titopoulos et al. implementation has an incompatible tensor layout, the paper cannot determine whether observed gains arise from FlashAttention-V’s algorithmic design, layout differences, implementation maturity, or framework integration.
- Unclear contribution of individual optimizations: The effects of loop reordering, blocking, inter-head packing, register reuse, GQA-specific reuse, and unrolling are not fully isolated through a comprehensive ablation study across models, precisions, sequence lengths, and vector widths.
- Static parameter tuning: Block sizes, unroll factors, and register-utilization factors are manually tuned for selected models and vector lengths. The paper does not provide an automatic tuning method or establish whether these settings transfer across hardware and workloads.
- Unresolved tail-handling costs: The behavior of inter-head packing when the number of heads is not divisible by the packing factor is not fully analyzed. Masking, partial vectors, and underfilled final head groups may reduce performance for many model configurations.
- Register-pressure trade-offs remain incomplete: The paper reports degradation from excessive unrolling due to register spilling, but does not quantify register usage, spill traffic, compiler decisions, or the optimal relationship between unroll factor, vector width, cache size, and available physical registers.
- Numerical accuracy is underexplored: Functional correctness is verified, but numerical error from FP16 execution, vectorized exponential computation, online softmax, masking, and repeated rescaling is not systematically measured against a high-precision reference.
- Model-quality impact is not assessed: The paper does not evaluate whether the FP16 or approximate vectorized softmax path affects perplexity, generation quality, logit distributions, or downstream task accuracy.
- Portability evidence is limited: Arm SVE validation is described as functional rather than performance-based. The claimed portability to SVE, AVX-512, and other vector ISAs therefore remains unconfirmed in terms of speed, memory behavior, and tuning requirements.
- SVE analysis uses a different simulation setup: The SVE experiments use gem5 25.0.0.1, whereas the principal RVV experiments use gem5 24.0.0.1. The implications of these version and configuration differences for cross-ISA comparisons are not established.
- Quantization analysis is too narrow: The incompatibility study focuses primarily on Q8_0, while the overall inference setup also uses Q4_K_M. The effects of other quantization formats, scale layouts, zero points, group sizes, and weight reordering strategies remain unexplored.
- No alternative quantization redesign is evaluated: Although AoS packing and masked reduction are identified as bottlenecks, the paper does not test structure-of-arrays layouts, offline weight repacking, vector-friendly quantization formats, fused dequantization, or hardware-supported block reductions.
- Attention-only gains may not translate end-to-end: FlashAttention dominates the reported prefill profile on one device and model, but decode is dominated by projection and feed-forward layers. The paper does not fully establish end-to-end latency, throughput, or energy gains across all models and context lengths.
- Energy efficiency is not measured: Despite motivating edge inference and energy efficiency, the study reports performance rather than power, energy per token, thermal behavior, or performance-per-watt.
- Memory-system assumptions are insufficiently validated: The simulated DDR3 bandwidth and cache configuration are justified by rough comparisons, but sensitivity to cache capacity, cache associativity, memory latency, bandwidth, prefetching, and NUMA-like effects is not reported.
- Compiler dependence is unresolved: Results may depend strongly on LLVM/GCC versions, intrinsic lowering, register allocation, and vector instruction scheduling. The portability and reproducibility of performance across compilers are not systematically evaluated.
- Limited treatment of causal masking and padding: The cost of causal masks, variable-length sequences, padding, and irregular batches is not examined, despite their potential impact on vector utilization and masked operations.
- No training or backward-pass evaluation: The method is evaluated only for decoder inference. Its applicability to training, encoder workloads, backward propagation, or attention gradients remains unknown.
- Open question on hardware–software co-design: The paper identifies long-vector and quantization bottlenecks but does not determine which combination of vector-lane count, vector width, reduction hardware, register-file size, cache design, and quantization layout provides the best end-to-end design point.
- Reproducibility details are incomplete: Exact cache-blocking parameters, all model and quantization configurations, timing methodology, warm-up procedures, thread settings, and statistical variation are not fully specified in the provided text, making independent reproduction difficult.
Practical Applications
Immediate Applications
- Faster on-device LLM inference for embedded and edge systems — Software / IoT / consumer electronics.
FlashAttention-V can be integrated into
llama.cpp/ggmldeployments running decoder-only models such as TinyLlama, Llama 3.2, Qwen2.5, and Pythia. On the Banana Pi BPI-F3, the implementation achieved reported attention-level speedups of approximately 12–14× over scalar FlashAttention, with particularly strong gains for short contexts of 64–128 tokens. This enables more responsive local chatbots, command interpreters, document summarizers, and coding assistants on routers, single-board computers, industrial gateways, and personal devices. Dependencies: The target CPU must support compatible RVV or Arm SVE instructions; benefits depend on model architecture, vector length, cache size, precision, and the proportion of total inference time spent in attention. End-to-end gains will be lower when quantized matrix-vector operations and feed-forward layers dominate. - Low-latency local token generation — Personal computing and edge AI. The decode-stage implementation can accelerate single-token generation by 8–11× over scalar FlashAttention in the reported simulations and by substantial factors on the evaluated RISC-V hardware. This is directly applicable to interactive assistants, offline speech or text interfaces, smart appliances, and privacy-preserving applications that cannot or should not send prompts to cloud services. Dependencies: Decode is memory-bound and shows diminishing sensitivity to wider vectors. System memory bandwidth, KV-cache access patterns, model quantization, and other decoder layers may limit practical end-to-end improvements.
- Improved CPU inference backends for open-source AI frameworks — Software infrastructure.
The loop reordering, cache-aware blocking, attention-head unrolling, register reuse, and inter-head packing techniques can be incorporated into CPU kernels in
llama.cpp,ggml, ONNX Runtime, oneDNN, or similar inference libraries. The design supports both Multi-Head Attention (MHA) and Grouped-Query Attention (GQA), allowing a common implementation to serve models with different attention layouts. Dependencies: Production integration requires architecture-specific intrinsic implementations, validation against model layouts and masking behavior, compiler support, and runtime dispatch for different vector lengths. - More efficient GQA execution — LLM serving and edge deployment. FlashAttention-V can reuse shared keys and values in GQA rather than redundantly loading them for every query head. This is useful for models such as Llama 3.2 and Qwen2.5, particularly on bandwidth-constrained CPUs where KV-cache traffic is a major cost. Potential products include a vector-length-aware attention operator or an automatic kernel selector that chooses between MHA, GQA, and scalar implementations. Dependencies: The implementation must correctly understand the query-head/KV-head ratio and tensor memory layout. Models using MHA or atypical attention variants may obtain smaller benefits.
- Benchmarking and architecture evaluation workflow — Academia and processor design.
Researchers and hardware teams can use the released algorithmic structure and the modified
gem5methodology to compare RVV and Arm SVE configurations, vector widths, lane counts, cache sizes, and memory systems. The paper’s results suggest that configurations around 4096-bit vectors and up to 64 lanes may offer strong attention scalability, while wider vectors can incur latency overheads. Dependencies: These conclusions are based substantially on simulation and a particular latency model. They should be calibrated against silicon measurements before informing final processor or product decisions. - Short-context local NLP tools — Education, accessibility, and daily life. Since the largest measured gains occur at short prefill lengths, developers can deploy compact local models for fixed-format tasks such as email drafting, command completion, translation of short messages, note classification, and educational tutoring prompts. Faster prefill can reduce perceived response latency and energy per interaction on small devices. Dependencies: The model must fit within device memory and provide adequate task accuracy; the paper evaluates performance rather than quality, safety, or usability.
- Teaching and research materials for vector programming — Computer architecture and systems education.
FlashAttention-V provides a concrete example for teaching scalable-vector programming, online softmax, cache blocking, loop transformations, register utilization, and the differences between prefill and decode workloads. It can support laboratory assignments using QEMU,
gem5, the Banana Pi BPI-F3, or comparable RVV/SVE platforms. Dependencies: Students and researchers need access to compatible toolchains and must account for simulator inaccuracies and differences between simulated and physical hardware.
Long-Term Applications
- Purpose-built CPU and accelerator designs for local generative AI — Semiconductor and edge computing. The paper’s inter-head packing strategy can inform future RVV- and SVE-based processors whose vector registers are substantially wider than common attention head dimensions. Hardware designers could co-optimize vector register files, lane counts, reduction units, cache hierarchies, and memory bandwidth for both attention and projection layers. Dependencies: Attention is only one part of inference. The reported Q8_0 bottleneck indicates that wider vector hardware will not automatically improve full-model performance unless quantized linear and feed-forward kernels are redesigned as well.
- New quantization formats optimized for long vectors — AI compression and model deployment.
The analysis identifies packing and masked-reduction overheads as dominant costs for
Q8_0, consuming about 60% of execution cycles at 2048-bit vector length in the reported microbenchmarks. This motivates vector-friendly formats with contiguous weight planes, separated scale arrays, larger or hardware-aligned blocks, or layouts designed for efficient reductions. Such formats could produce faster and more energy-efficient CPU inference than simply increasing vector width. Dependencies: Any replacement format must preserve model accuracy, remain compatible with existing conversion tools, support efficient random access and batching, and avoid increasing memory footprint excessively. - End-to-end vector-length-aware inference runtimes — AI systems software. A future runtime could profile the model and hardware, then automatically select block sizes, unroll factors, attention kernels, quantization layouts, and vector widths separately for prefill and decode. It could use FlashAttention-V for attention while selecting specialized kernels for Q8_0 or alternative quantized projections. Dependencies: This requires reliable hardware feature detection, performance models, kernel variants for RVV/SVE/AVX, and tuning across batch sizes, sequence lengths, model sizes, and memory hierarchies.
- Energy-efficient and privacy-preserving enterprise inference — Healthcare, finance, government, and industrial systems. If the kernel-level improvements translate into end-to-end reductions in execution time and memory traffic, organizations could run small LLMs locally for clinical note preprocessing, financial document triage, public-sector form assistance, industrial maintenance interfaces, and confidential enterprise search. Local execution may reduce cloud costs, network dependence, and exposure of sensitive data. Dependencies: These sectors require accuracy, auditability, data protection, and domain validation. The paper does not establish energy savings, privacy guarantees, or task-level reliability, so those outcomes require separate evaluation.
- Scalable CPU-based inference servers — Cloud and data-center computing. Multi-core systems built around long-vector RISC-V or Arm SVE processors could use FlashAttention-V as a component of CPU inference servers for small and medium LLMs. Inter-head parallelism and GQA-aware reuse may improve throughput when GPUs are unavailable, too costly, or operationally unsuitable. Dependencies: The current evaluation uses batch size one and primarily single-core or simulated configurations. Multi-core scaling, concurrent requests, NUMA effects, batching, synchronization, and service-level latency remain to be demonstrated.
- Attention kernels for multimodal and non-language transformers — Vision, robotics, and scientific computing. The underlying techniques—online softmax, tiling, loop reordering, and packing independent heads—could potentially be adapted to vision transformers, speech models, multimodal models, and robotic perception pipelines running on scalable-vector CPUs. These workloads may benefit when attention heads are independent and tensor layouts are regular. Dependencies: Applicability depends on sequence dimensions, head dimensions, masking patterns, precision, batch size, and whether the workload uses standard dot-product attention. The paper directly evaluates decoder-only LLMs, so transfer to other domains requires benchmarking.
- Hardware–software co-design standards for vector AI — Policy, research funding, and ecosystem development. The findings can guide open hardware and public research programs toward jointly specifying vector ISA features, quantization layouts, compiler intrinsics, simulator models, and reproducible inference benchmarks. Standardized tests should report separate prefill, decode, attention-only, and end-to-end results rather than treating “LLM inference” as a single workload. Dependencies: Industry and academic adoption would require common benchmark suites, reproducible hardware measurements, stable compiler support, and agreement on metrics such as latency, throughput, memory traffic, and energy per generated token.
Glossary
- Array of Structures (AoS): A data layout that stores complete records with fields interleaved in memory. “This layout follows an Array of Structures (AoS) format”
- Arithmetic amortization: Spreading the cost of an operation across many computations so its relative overhead decreases. “limit arithmetic amortization under long-vector execution”
- Autoregressive token generation: Sequentially generating each new token using previously generated tokens as context. “decode (autoregressive token generation)”
- Bandwidth-bound: Limited primarily by the rate at which data can be transferred rather than by computational throughput. “due to single-token, memory-bound execution”
- Blocked computation: Dividing a large computation into smaller subcomputations to improve locality and resource use. “We implement blocked FlashAttention”
- Cache hierarchy: The organization of memory into levels with different capacities, latencies, and bandwidths. “The CPU model includes two levels of cache”
- Cache-aware blocking: Choosing block sizes to fit particular levels of the processor cache. “cache-aware block sizes”
- Causal masking: Preventing a token from attending to future tokens in an autoregressive model. “State check for causal masking”
- Cycle-accurate simulator: A simulator designed to model processor behavior and report execution timing at cycle-level granularity. “gem5 24.0.0.1, a cycle-accurate simulator”
- Data locality: The tendency to access data close together in time or memory, improving cache effectiveness. “improve data locality”
- Data-level parallelism: Performing the same operation simultaneously on multiple independent data elements. “we apply vectorization across the head dimension to exploit data-level parallelism”
- Decoder-only model: A transformer architecture that generates outputs using only decoder blocks, typically autoregressively. “decoder-only LLMs”
- Diminishing sensitivity: A reduced performance response to further changes in a parameter. “performance showing diminishing sensitivity to vector width and lane count”
- Edge deployment: Running machine-learning inference on local, resource-constrained devices rather than centralized servers. “optimized for edge deployment”
- Feed-forward module: A transformer subnetwork that applies learned linear transformations and nonlinear processing independently to token representations. “Each block includes Q/K/V projections, attention, and a feed-forward module”
- Fused kernel: A computational kernel that combines multiple operations to reduce intermediate storage and data movement. “using tiling and fused kernels”
- General Matrix-Vector (GEMV): A matrix–vector multiplication operation commonly used in inference workloads. “single-token inputs reduce them to General Matrix-Vector (GEMV) operations”
- Grouped-Query Attention (GQA): An attention variant in which multiple query heads share key and value heads. “Grouped-Query Attention (GQA), which reduces key–value cache overhead by sharing keys and values across query heads”
- Head dimension: The number of features assigned to each attention head. “ being small, typically 64 or 128”
- Instruction-level parallelism (ILP): The simultaneous execution of independent instructions within a processor. “Loop unrolling further exposes instruction-level parallelism”
- Inter-head packing: Combining data from multiple attention heads into one vector register. “introduces inter-head packing, enabling effective utilization of vector lengths beyond the head dimension”
- In-order processor: A processor that generally issues and executes instructions in program order. “the RISC-V in-order RiscvMinorCPU model”
- Kernel fusion: Combining multiple computational operations into a single executable kernel to reduce overhead and memory traffic. “using kernel fusion and tiling”
- Key-value cache (KV cache): Stored key and value representations reused during autoregressive decoding. “storing the key-value (KV) cache during inference”
- Lane: An independent element-processing position within a SIMD or vector processor. “configurations with up to 64 vector lanes”
- Layer normalization: A normalization operation that standardizes activations across the features of an individual input. “optimize key kernels (vector dot product and layer normalization)”
- Linear projection: Multiplication of an input representation by a learned weight matrix. “Both modules are linear projections(input multiplied by a learned weight matrix)”
- Loop reordering: Changing the nesting or execution order of loops to improve locality or parallelism. “By reordering loops, applying loop unrolling, and applying inter-head packing”
- Loop unrolling: Replicating loop-body operations to reduce loop-control overhead and expose parallelism. “Loop unrolling further exposes instruction-level parallelism”
- Masked reduction: A reduction operation that combines only elements selected by a mask. “packing and masked reduction as the dominant bottlenecks”
- Memory bandwidth: The rate at which data can be transferred between memory and processing units. “The attention module is a major bottleneck due to high memory bandwidth requirements”
- Memory-bound execution: Execution whose performance is primarily constrained by data movement from memory. “due to single-token, memory-bound execution”
- Memory-efficient attention: An attention algorithm that reduces the memory required for intermediate attention results. “introduced a memory-efficient attention algorithm with online softmax”
- Multi-Head Attention (MHA): Attention that computes multiple independent attention operations, or heads, in parallel. “Multi-head attention (MHA) extends the original formulation”
- Multi-Query Attention (MQA): An attention variant in which multiple query heads share key and value representations. “variants such as Multi-Query Attention (MQA) and Grouped-Query Attention (GQA) share keys and values across query heads”
- Numerically stable softmax: A softmax computation arranged to avoid overflow or underflow during exponentiation. “for numerically stable on-the-fly softmax”
- Online softmax: A streaming softmax method that updates normalization statistics incrementally without materializing the full score matrix. “with online softmax”
- Out-of-order processor: A processor capable of executing independent instructions in an order different from the program order. “the out-of-order RiscvO3CPU model”
- Prefill: The inference stage that processes the input prompt and constructs the key-value cache. “prefill (processes input tokens and computes the KV cache)”
- Quantization: Representing numerical model parameters with lower-precision values to reduce storage and computation costs. “We apply Q4_K_M and Q8_0 (4-bit and 8-bit block quantization schemes, respectively)”
- Register spilling: Moving temporary values from processor registers to memory when available registers are insufficient. “Increasing loop unrolling from 16 to 32 degrades performance due to register spilling”
- RISC-V Vector Extension (RVV): A RISC-V instruction-set extension supporting vector operations with scalable vector lengths. “the RISC-V Vector Extension (RVV)”
- Scalable Vector Extension (Arm SVE): An Arm instruction-set extension supporting implementation-dependent vector lengths. “the ARM Scalable Vector Extension (Arm SVE)”
- Scaled dot product: A dot product divided by a dimension-dependent factor before softmax in attention. “attention is computed via scaled dot product and softmax”
- Self-attention: An attention mechanism in which each token attends to other tokens in the same sequence. “Self-attention lets each token attend to all others”
- SIMD (Single Instruction, Multiple Data): A parallel-computing model in which one instruction operates on multiple data elements. “leading to underutilization of Single Instruction, Multiple Data (SIMD) resources”
- Softmax: A function that converts a vector of scores into normalized exponential weights. “maintaining running maxima and normalization factors for numerically stable on-the-fly softmax”
- Spatial locality: The performance benefit obtained when nearby memory addresses are accessed close together in time. “FlashAttention-V improves spatial locality”
- Streaming softmax: An online softmax formulation that processes scores incrementally while maintaining running statistics. “based on the streaming softmax formulation”
- Tensor layout: The arrangement of tensor elements in memory, including their dimension order and contiguity. “their tensor layout is incompatible with llama.cpp”
- Tiling: Partitioning a computation or data structure into smaller blocks that can be processed efficiently in fast memory. “FlashAttention further optimizes execution by using tiling”
- Transformer inference: The process of using a trained transformer model to produce outputs. “transformer inference demands high throughput, low latency, and strong energy efficiency”
- Vector intrinsic: A programming-language function that directly exposes a processor’s vector instruction. “We use vector intrinsics of the RISC-V ISA”
- Vector length (VL): The number of bits or elements that a vector instruction can process. “the vector length (VL) is tied to ”
- Vector register: A processor register capable of storing and operating on multiple data elements simultaneously. “mapping multiple heads into a single vector register”
- Vectorization: Transforming scalar computations so that they operate on multiple data elements in parallel. “The kernels , , and vectorize over the head dimension”
- Zero-point: An offset used in asymmetric quantization to map quantized integers to real-valued numbers. “a per-block FP16 scale (no zero-point)”





