Papers
Topics
Authors
Recent
Search
2000 character limit reached

Unified Butterfly Units in Computation

Updated 6 July 2026
  • Unified Butterfly Units are butterfly-structured primitives with multistage sparse connections and reconfigurable local transforms, optimizing performance across FFT, NUFFT, neural networks, cryptography, and quantum operations.
  • They underpin various applications by leveraging low-rank approximations, adaptive control layers, and shared hardware modules to efficiently implement oscillatory transforms and matrix factorizations.
  • The unified design pattern reduces computational complexity and enhances performance, yielding significant speedups and parameter reductions in diverse settings from signal processing to post-quantum cryptography.

Unified Butterfly Units are butterfly-structured computational primitives that recur in several technically distinct settings: fast oscillatory integral transforms, attention-based neural networks, FPGA accelerators for FFT- and butterfly-linear layers, parallel iterative NTT/INTT accelerators for post-quantum cryptography, and distributed quantum computation over the butterfly network. Across these settings, the common pattern is a multistage butterfly transform with sparse local interactions, together with a control layer that selects among closely related butterfly behaviors such as NUFFT versus butterfly factorization, FFT versus butterfly-linear mode, or NTT versus INTT mode (Yang, 2018, Fan et al., 2022, Alexakis et al., 1 Jul 2026, Soeda et al., 2010).

1. Mathematical and structural foundations

In the harmonic-analysis literature, a butterfly factorization is defined for matrices with the complementary low-rank property. Let TXT_X and TΩT_\Omega be dyadic trees of depth L=O(logN)L=O(\log N). For a node ATXA\in T_X at level \ell and a node BTΩB\in T_\Omega at level LL-\ell, the submatrix KA,BK_{A,B} is numerically low-rank with rank bounded independently of NN. Equivalently, on each such pair of boxes there is a separated representation

K(x,ξ)t=1rαtAB(x)βtAB(ξ).K(x,\xi)\approx \sum_{t=1}^r \alpha_t^{AB}(x)\beta_t^{AB}(\xi).

This property underlies the Interpolative Butterfly Factorization (IBF), which represents an TΩT_\Omega0 matrix as a product of TΩT_\Omega1 sparse matrices, each with TΩT_\Omega2 nonzeros, with construction in TΩT_\Omega3 operations and memory and application in TΩT_\Omega4 (Li et al., 2016).

The preliminary IBF has the form

TΩT_\Omega5

and the optimal form after sweeping compression is

TΩT_\Omega6

Structurally, this is precisely a sequence of “butterfly units”: modules mapping coefficients between adjacent levels with sparse, local connectivity. The factors TΩT_\Omega7, TΩT_\Omega8, TΩT_\Omega9, L=O(logN)L=O(\log N)0, and L=O(logN)L=O(\log N)1 are level-wise transformations whose dense subblocks encode local interpolation, restriction, prolongation, and switching operations (Li et al., 2016).

IBF is built from interpolative low-rank approximations of oscillatory kernels L=O(logN)L=O(\log N)2. The key analytic decomposition is

L=O(logN)L=O(\log N)3

which isolates the smooth coupling term L=O(logN)L=O(\log N)4 for Chebyshev interpolation. Sweeping compression then propagates the true numerical ranks and recompresses all dense subblocks to near-optimal size via structure-preserving low-rank approximations (Li et al., 2016).

This formulation fixes the canonical mathematical meaning of a butterfly unit: a sparse, multilevel, rank-structured transformation acting between complementary scales.

2. Unified butterfly units for oscillatory integral transforms

For oscillatory integral transforms,

L=O(logN)L=O(\log N)5

the discretized problem is L=O(logN)L=O(\log N)6 with L=O(logN)L=O(\log N)7. The relevant assumptions are that the amplitude L=O(logN)L=O(\log N)8 is smooth and the phase L=O(logN)L=O(\log N)9 is piecewise smooth in both ATXA\in T_X0 and ATXA\in T_X1 with ATXA\in T_X2 discontinuities in each variable. On suitably chosen pairs of small spatial–frequency boxes ATXA\in T_X3, the kernel is numerically low-rank, while in many important cases the phase is approximately separable,

ATXA\in T_X4

The unified framework in "A Unified Framework for Oscillatory Integral Transform: When to use NUFFT or Butterfly Factorization?" automatically decides whether a NUFFT-style butterfly unit or a general butterfly factorization (BF) unit is better for applying ATXA\in T_X5 to vectors in ATXA\in T_X6 time (Yang, 2018).

The framework has three stages. First, it builds low-rank factorizations

ATXA\in T_X7

If explicit formulas are known, random sampling yields these in ATXA\in T_X8. If only indirect access is available, a new low-rank matrix recovery algorithm reconstructs the phase from ATXA\in T_X9 up to a low-rank error in \ell0, while the amplitude is recovered from \ell1. The indirect-access setting includes three scenarios: \ell2 can be evaluated in \ell3 per entry; \ell4 and \ell5 can be applied to vectors in \ell6; or \ell7 are solutions of PDEs and only a few columns or rows are available from PDE solves (Yang, 2018).

Second, Algorithm 3.1 decides between NUFFT and BF in \ell8. It truncates the phase to rank \ell9,

BTΩB\in T_\Omega0

and tests whether

BTΩB\in T_\Omega1

has small numerical rank BTΩB\in T_\Omega2, estimated via sampling and pivoted QR. If the residual rank is below threshold BTΩB\in T_\Omega3, the kernel is declared NUFFT-applicable; otherwise the framework selects butterfly factorization. The SVD, sampling, QR, and low-rank factorization all cost BTΩB\in T_\Omega4, so the decision mechanism is a genuine BTΩB\in T_\Omega5 butterfly-router (Yang, 2018).

Third, the selected unit is applied. If NUFFT is chosen, the transform is rewritten as

BTΩB\in T_\Omega6

so the computation reduces to a small number of BTΩB\in T_\Omega7-dimensional NUFFTs. Here BTΩB\in T_\Omega8 is the NUFFT dimension after lifting, even in physically one-dimensional problems, and BTΩB\in T_\Omega9 is the rank of the low-rank correction to the phase-separated kernel. If BF is chosen, the framework constructs and applies IBF-MAT, a new stable and nearly optimal butterfly factorization for kernels of the form

LL-\ell0

with precomputation and application both in LL-\ell1 time and memory (Yang, 2018).

A central technical component is recovery of the phase modulo LL-\ell2. Since

LL-\ell3

the goal is to find a numerically low-rank LL-\ell4 such that

LL-\ell5

The reconstruction uses a discrete third-order total variation norm LL-\ell6, a linear-time heuristic for vector recovery from modulo-LL-\ell7 observations, and a matrix recovery procedure that detects discontinuity patterns, partitions the matrix into smooth blocks, and then applies randomized low-rank factorization (Yang, 2018).

The resulting architecture is explicitly modular: low-rank amplitude/phase builder, NUFFT-versus-BF selector, then a NUFFT unit or a BF unit. In this setting, “unified butterfly units” refers to a shared representation of the kernel together with an automated router between specialized and general butterfly implementations.

3. Butterfly units in attention-based neural networks and hardware co-design

In attention-based neural networks, "Adaptable Butterfly Accelerator for Attention-based NNs via Hardware and Algorithm Co-design" defines a butterfly matrix LL-\ell8 as a product of sparse butterfly factors. Each factor is a LL-\ell9 block matrix with diagonal blocks, and the nonzeros form the familiar butterfly connectivity pattern: at each stage, pairs of coordinates interact via a KA,BK_{A,B}0 transform. Applying KA,BK_{A,B}1 to a vector has depth KA,BK_{A,B}2, per-stage work KA,BK_{A,B}3, and total complexity KA,BK_{A,B}4. FFT is a specific case of this structure, since the Cooley–Tukey FFT can be written as a product of such butterfly factors whose diagonals implement complex twiddle factors (Fan et al., 2022).

FABNet uses a unified butterfly sparsity pattern to approximate both the attention mechanism and the FFNs. It has two butterfly-based block types. The Attention Butterfly block (ABfly) keeps a standard multi-head attention module but replaces all surrounding linear layers by butterfly-structured ones: KA,BK_{A,B}5 with each projection factored into butterfly stages, and

KA,BK_{A,B}6

The Fourier Butterfly block (FBfly) replaces the entire attention mechanism with a 2‑D FFT, implemented as two 1‑D FFTs along sequence and feature dimensions,

KA,BK_{A,B}7

followed again by butterfly-structured FFNs (Fan et al., 2022).

At the algorithmic level, FABNet uses a generic butterfly transform operator

KA,BK_{A,B}8

where each stage applies, in parallel, a set of 2‑point transforms. The implemented real butterfly formula is

KA,BK_{A,B}9

For FFT, the operator has the same shape but the weights obey FFT constraints and are fixed or precomputed twiddles. Q/K/V projections, attention output projections, FFN layers, and FFT-based mixing operations all share this butterfly primitive (Fan et al., 2022).

At the hardware level, the unified butterfly unit is an adaptable Butterfly Unit (BU) inside an adaptable butterfly engine. Each BU contains 4 real multipliers, 2 real adders, and 2 complex adders/subtractors. In butterfly-linear mode, it implements the real butterfly formula above. In FFT mode, with

NN0

the BU computes

NN1

Control signals configure each BU to operate in FFT or butterfly-linear mode, so the same physical multipliers and adders are reused for both (Fan et al., 2022).

The accelerator comprises a Butterfly Processor with Butterfly Engines and Butterfly Units, an Attention Processor containing QK and SV units, a Post-processing Processor for layer normalization and residual additions, on-chip buffers, and off-chip memory. It also includes a butterfly memory system with a custom data layout, an index coalescing module, and runtime-configurable address mappings that allow the same physical buffers to service both FFT and butterfly layers. Fine-grained pipelining overlaps Q/K/V generation, NN2, softmax, and NN3 (Fan et al., 2022).

Quantitatively, on the Long-Range-Arena dataset, FABNet achieves the same accuracy as the vanilla Transformer while reducing the amount of computation by 10 to 66 times and the number of parameters 2 to 22 times. By jointly optimizing the algorithm and hardware, the FPGA-based butterfly accelerator achieves 14.2 to 23.2 times speedup over state-of-the-art accelerators normalized to the same computational budget. Compared with optimized CPU and GPU designs on Raspberry Pi 4 and Jetson Nano, the system is up to 273.8 and 15.1 times faster under the same power budget (Fan et al., 2022).

In this domain, a unified butterfly unit is simultaneously a model primitive, a hardware primitive, and a scheduling primitive.

4. Unified butterfly units for NTT and INTT in post-quantum cryptography

For radix‑2 NTT/INTT butterflies, the forward Cooley–Tukey butterfly is

NN4

and the inverse Gentleman–Sande butterfly is

NN5

"High-Performance NTT Accelerators for PQC leveraging Unified Redundant Arithmetic and Fine-Tuned Microarchitecture" defines a unified butterfly unit as a single processing element that implements both NTT and INTT butterflies in one structure, uses the same Montgomery multiplier, adders and subtractors for both directions, shares pipeline and control, and operates in a carefully chosen redundant Montgomery representation (Alexakis et al., 1 Jul 2026).

All internal values are represented in Montgomery form NN6 with a redundant range

NN7

For the subtract input to the Montgomery multiplier in INTT, the design temporarily allows

NN8

The analysis imposes NN9, with K(x,ξ)t=1rαtAB(x)βtAB(ξ).K(x,\xi)\approx \sum_{t=1}^r \alpha_t^{AB}(x)\beta_t^{AB}(\xi).0 chosen as the smallest power of two greater than K(x,ξ)t=1rαtAB(x)βtAB(ξ).K(x,\xi)\approx \sum_{t=1}^r \alpha_t^{AB}(x)\beta_t^{AB}(\xi).1, so the internal datapath width is

K(x,ξ)t=1rαtAB(x)βtAB(ξ).K(x,\xi)\approx \sum_{t=1}^r \alpha_t^{AB}(x)\beta_t^{AB}(\xi).2

Under these bounds, the Montgomery result is guaranteed to lie in the same redundant range K(x,ξ)t=1rαtAB(x)βtAB(ξ).K(x,\xi)\approx \sum_{t=1}^r \alpha_t^{AB}(x)\beta_t^{AB}(\xi).3 without any final conditional subtraction. Consequently, the post-multiplication correction is removed for both K(x,ξ)t=1rαtAB(x)βtAB(ξ).K(x,\xi)\approx \sum_{t=1}^r \alpha_t^{AB}(x)\beta_t^{AB}(\xi).4 in NTT mode and K(x,ξ)t=1rαtAB(x)βtAB(ξ).K(x,\xi)\approx \sum_{t=1}^r \alpha_t^{AB}(x)\beta_t^{AB}(\xi).5 in INTT mode, and the subtractor correction feeding the multiplier can also be dropped (Alexakis et al., 1 Jul 2026).

The INTT scaling is integrated into existing arithmetic hardware. One divide‑by‑2 is removed by precomputing INTT twiddle factors as

K(x,ξ)t=1rαtAB(x)βtAB(ξ).K(x,\xi)\approx \sum_{t=1}^r \alpha_t^{AB}(x)\beta_t^{AB}(\xi).6

The second division by 2 is merged into the adder’s correction logic by case analysis on range and parity of K(x,ξ)t=1rαtAB(x)βtAB(ξ).K(x,\xi)\approx \sum_{t=1}^r \alpha_t^{AB}(x)\beta_t^{AB}(\xi).7. For example, if K(x,ξ)t=1rαtAB(x)βtAB(ξ).K(x,\xi)\approx \sum_{t=1}^r \alpha_t^{AB}(x)\beta_t^{AB}(\xi).8 and odd, the block computes

K(x,ξ)t=1rαtAB(x)βtAB(ξ).K(x,\xi)\approx \sum_{t=1}^r \alpha_t^{AB}(x)\beta_t^{AB}(\xi).9

while if TΩT_\Omega00 and odd, it computes

TΩT_\Omega01

The divider is therefore no longer an explicit module; it is merged into the adder’s correction logic (Alexakis et al., 1 Jul 2026).

The final unified butterfly has input registers, an adder, a subtractor plus bias TΩT_\Omega02, a hierarchical DSP-based Montgomery multiplier, an Add/Div2 unit, and output registers. In NTT mode it computes

TΩT_\Omega03

then performs final add and subtract with correction to keep outputs in TΩT_\Omega04. In INTT mode it computes

TΩT_\Omega05

while the top path yields TΩT_\Omega06 in the same redundant range (Alexakis et al., 1 Jul 2026).

The Montgomery multiplier is redesigned as a DSP-centric hierarchical unit. For small widths up to 17 bits, a complete Montgomery multiplier uses 3 DSPs per multiplier. For a generic 34-bit Montgomery datapath supporting up to 31-bit moduli with redundancy, the multiplier uses 11 DSP blocks and 6 pipeline stages. The resulting unified butterfly frequency reaches up to 437 MHz for 17-bit BFUs on Virtex‑7, about 391 MHz for 34-bit BFUs on Virtex‑7, up to 905 MHz for 17-bit BFUs on Alveo U200, and about 496 MHz for 34-bit BFUs on Alveo U200 (Alexakis et al., 1 Jul 2026).

At system level, the accelerator is a parallel iterative NTT/INTT architecture with a multi-banked BRAM coefficient memory, conflict-free mapping and addressing, and an array of TΩT_\Omega07 processing elements, each processing element being one unified butterfly. The same PE array is reused iteratively for all TΩT_\Omega08 stages, and a mode bit selects NTT or INTT. The 17-bit BFU variant supports Kyber, Falcon, and NewHope; the 34-bit BFU variant supports moduli up to 31 bits, including Dilithium’s 23-bit modulus. Reported execution time reductions are 35–73% depending on TΩT_\Omega09 and TΩT_\Omega10 compared with comparable state-of-the-art architectures (Alexakis et al., 1 Jul 2026).

Here, a unified butterfly unit is a direction-switchable modular-arithmetic processing element whose correctness hinges on a shared redundant range and whose efficiency hinges on removal of intermediate corrections.

5. Butterfly units in distributed quantum computation

In distributed quantum computation, the butterfly is a directed network with six nodes and seven edges: TΩT_\Omega11 Each edge can be chosen to be either a single-use, one-way quantum channel that can carry 1 qubit, or a single-use, one-way classical channel that can carry 2 classical bits. Local operations are free. The task is deterministic implementation of a two-qubit global unitary

TΩT_\Omega12

on two unknown inputs given at TΩT_\Omega13 and TΩT_\Omega14, with outputs at TΩT_\Omega15 and TΩT_\Omega16 (Soeda et al., 2010).

The central characterization is: in Hayashi’s butterfly setting, with no additional entanglement resource, a two-qubit global unitary TΩT_\Omega17 is deterministically implementable over the butterfly network if and only if TΩT_\Omega18 is locally unitary equivalent to a controlled unitary operation. A controlled unitary has the form

TΩT_\Omega19

and a controlled phase is

TΩT_\Omega20

The implementability boundary is proved using the Schmidt number of

TΩT_\Omega21

If TΩT_\Omega22 is locally equivalent to a controlled unitary, the resulting state has Schmidt number TΩT_\Omega23; otherwise it has Schmidt number TΩT_\Omega24. The butterfly network without ebits cannot deterministically create the required Schmidt rank‑4 pure state under the channel constraints (Soeda et al., 2010).

The zero-ebit protocol for controlled phases uses the channel assignment: TΩT_\Omega25 quantum; TΩT_\Omega26 a 2-bit classical channel; TΩT_\Omega27 each used as 1-bit classical channels. It entangles the logical wires via the bottleneck TΩT_\Omega28 using classical bits derived from computational-basis measurements, sends one quantum wire from TΩT_\Omega29 to TΩT_\Omega30 via TΩT_\Omega31 and one from TΩT_\Omega32 to TΩT_\Omega33 via TΩT_\Omega34, and applies conditional single-qubit corrections at TΩT_\Omega35 and TΩT_\Omega36. Because every controlled unitary is locally equivalent to some controlled phase, this yields a Butterfly Controlled-Unitary Primitive (0-ebit unit) (Soeda et al., 2010).

The resource pattern is also optimal. Controlled unitaries cannot be implemented if the number of quantum channels is fewer than four, if a different subset of edges is chosen as quantum, if TΩT_\Omega37 is reduced below a 2-bit classical channel, or if either TΩT_\Omega38 or TΩT_\Omega39 is absent. The minimal channel pattern is therefore: quantum TΩT_\Omega40; classical TΩT_\Omega41 with 2 bits; classical TΩT_\Omega42 with at least 1 bit each (Soeda et al., 2010).

With 1 ebit between TΩT_\Omega43 and TΩT_\Omega44, the network can implement controlled traceless unitaries under a slightly weakened channel assumption. A controlled traceless unitary can be written as

TΩT_\Omega45

The key algebraic condition

TΩT_\Omega46

permits rerouting of control dependencies, producing a Butterfly Controlled-Traceless Unit (1-ebit) (Soeda et al., 2010).

With 2 ebits between TΩT_\Omega47 and TΩT_\Omega48, and channels chosen as in Hayashi’s swap protocol, the network implements the full 2-qubit Clifford group. The construction uses Bell measurements, Pauli-frame propagation through a Clifford unitary TΩT_\Omega49, and final Pauli corrections depending on transmitted classical bits, yielding a Butterfly Global Clifford Unit (2-ebit). These units form a resource-ordered hierarchy

TΩT_\Omega50

The paper also notes that the set of implementable unitaries in the 0-ebit regime is not closed under composition unless extra resources are added (Soeda et al., 2010).

In this setting, a unified butterfly unit is a network-level gate family parameterized by channel capacities and initial entanglement resources.

6. Cross-domain synthesis, limits, and common design principles

Across these literatures, the butterfly unit is always a multistage structure with sparse local interactions, but the meaning of “unit” changes with the application. In IBF and oscillatory integral transforms, the unit is a level-wise sparse matrix factor with TΩT_\Omega51 nonzeros, assembled into an TΩT_\Omega52 factorization (Li et al., 2016). In the unified oscillatory-transform framework, the unit is either a NUFFT butterfly or a general BF/IBF-MAT butterfly, selected by an TΩT_\Omega53 decision algorithm (Yang, 2018). In FABNet, the unit is a parameterized butterfly transform operator and an adaptable hardware cell that switches between FFT and butterfly-linear mode (Fan et al., 2022). In PQC accelerators, the unit is a shared NTT/INTT processing element with redundant Montgomery arithmetic and mode-dependent control (Alexakis et al., 1 Jul 2026). In distributed quantum computation, the unit is a maximal class of implementable two-qubit unitaries over a fixed butterfly topology and resource profile (Soeda et al., 2010).

Several limitations are explicit. In the oscillatory-transform setting, NUFFT is used only when the residual

TΩT_\Omega54

has sufficiently small numerical rank; otherwise the framework falls back to BF/IBF-MAT (Yang, 2018). In FABNet, self-attention’s quadratic term in sequence length remains in ABfly, FABNet still retains some full attention blocks for accuracy, the butterfly pattern is static, and only 16-bit floating point is used (Fan et al., 2022). In the PQC setting, redundancy adds 3 bits to coefficient width and slightly more LUTs and FFs, and for large TΩT_\Omega55 arrays the frequency drops due to routing pressure (Alexakis et al., 1 Jul 2026). In the quantum setting, swap and generic non-controlled unitaries are impossible without ebits, and composition of 0-ebit units does not in general stay within the locally controlled-equivalent class (Soeda et al., 2010).

A plausible implication is that “Unified Butterfly Units” is best understood not as a single algorithm but as a reusable design pattern. The invariant ingredients are a butterfly connectivity pattern, a small set of mode-dependent local transforms, and a control layer that decides which butterfly behavior is valid under the available structure. In the mathematical formulations this structure is complementary low rank or approximate phase separability; in the hardware formulations it is the reuse of the same multipliers, adders, and memory system across closely related butterfly modes; in the quantum formulation it is the sharp relation between channel capacities, entanglement resources, and the maximal implementable gate family.

This suggests a unifying technical definition: a unified butterfly unit is a butterfly-structured primitive whose topology is fixed, whose internal coefficients or arithmetic mode are reconfigurable, and whose efficiency derives from preserving a sparse multistage pattern while specializing only the local transfer rules.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Unified Butterfly Units.