Skip to content

Arbitrary-precision cryptanalytic extraction targeting a single complete Transformer blockCryptanalytic Extraction on a Single Full Transformer Block with Arbitrary Precision

Jiaqi Zheng, Zirui Chen, Xiaoyang Dong
Tsinghua University
arXiv: 其他 AI 安全论文arXiv:2611.39341Originally published Indexed by this site · 2 days agoSelected AttacksSelectedAttention38

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

The authors propose black-box cryptanalytic extraction of a complete single-block Transformer; all 72 random instances were completed, with at most 0.26–0.47 queries per parameter at the largest scale.

Threat modelThe attacker knows d, H, r, m, the FFN branch, ϵ1, ϵ2, and the block architecture, and can adaptively choose bounded token sequences without positional encodings within the allowed domain to perform black-box queries; each query returns only the last-token output vector after the dual residual, and the goal is to recover functionally equivalent effective parameters.

Questions
Existing cryptanalytic extraction mostly targets isolated Attention, FFN, or simplified blocks, and struggles with dual pre-RMSNorm, dual residual, and FFN coupling, and is affected by native low-precision rounding.
Methods
The four stages successively recover the aggregated value map, extract the FFN via a singleton forward bridge, reconstruct multi-head Attention using paired opposite inputs for inversion and a root-free procedure, and finally perform fixed-rank joint refinement.
Experiments and results
Five random block scales and FP64/FP32/FP16/BF16, 72 instances in total, all completed extraction; at the largest d=256, m=1024, Q/param is 0.26–0.47, and Block4b ranges from 2.20×10−15 to 8.16×10−3 depending on precision.
Limitations and future work
The experiments cover only randomly initialized single blocks, with maximum d=256 and m=1024. The authors plan to extend to multi-layer stacking, positional encoding, grouped-query Attention, larger widths, and trained language model checkpoints.
Experimental setupMHSA + Biased ReLU、MHSA + Bias-free SwiGLU · 五种随机 Transformer block 配置,d=16–256、H=4或8、m=32–1024、256 条独立 length-5 holdout sequences · Qtotal、Q/param et al.
AI summaryand selection rationaleResearchers at Tsinghua University propose an end-to-end black-box cryptanalytic extraction attack targeting a complete dual pre-RMSNorm residual Transformer block; the authors call it the first such attack, recovering functionally equivalent hidden parameters from adaptive black-box queries alone. The attack has four stages: first recover the aggregated attention value map M from the complete block's responses, then extract the coupled FFN via a forward bridge, then recover all attention heads by inversion with paired opposite inputs without pole finding, and finally jointly refine on the low-rank head manifold; the same pipeline supports both biased ReLU and unbiased SwiGLU FFNs, covering four native precisions: FP64, FP32, FP16, and BF16. The evaluation covers five block sizes from d=16 to d=256, and all 72 instances were extracted successfully; on the largest block with d=256, H=8, and FFN width 1024 (over one million parameters), only 0.26–0.47 queries per parameter are needed, and the block relative L2 error reaches the hardware rounding floor of each format, at most 2.20×10⁻¹⁵ under FP64 and at most 8.16×10⁻³ under BF16.

Researchers at Tsinghua University propose an end-to-end black-box cryptanalytic extraction attack targeting a complete dual pre-RMSNorm residual Transformer block; the authors call it the first such attack, recovering functionally equivalent hidden parameters from adaptive black-box queries alone. The attack has four stages: first recover the aggregated attention value map M from the complete block's responses, then extract the coupled FFN via a forward bridge, then recover all attention heads by inversion with paired opposite inputs without pole finding, and finally jointly refine on the low-rank head manifold; the same pipeline supports both biased ReLU and unbiased SwiGLU FFNs, covering four native precisions: FP64, FP32, FP16, and BF16. The evaluation covers five block sizes from d=16 to d=256, and all 72 instances were extracted successfully; on the largest block with d=256, H=8, and FFN width 1024 (over one million parameters), only 0.26–0.47 queries per parameter are needed, and the block relative L2 error reaches the hardware rounding floor of each format, at most 2.20×10⁻¹⁵ under FP64 and at most 8.16×10⁻³ under BF16.

Why it was selectedWeight extraction attacks previously remained mostly at isolated components or simplified blocks; this paper advances end-to-end extraction to complete blocks with normalization and residuals and covers the deployment precisions FP16 and BF16.

Related events and news

1 events · 0 news mentions

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Solve end-to-end black-box parameter extraction of a complete dual pre-RMSNorm residual block under native low precision.

    Core question: Given only black-box input-output queries of a complete Transformer block, can functionally equivalent effective parameters be recovered under native FP64, FP32, FP16, and BF16?

    • Security scenario: The authors consider Transformer the foundation of language models, so the confidentiality of proprietary weights becomes a security issue; the goal is not to train a statistical surrogate model but to approach hardware-precision cryptanalytic extraction.
    • Existing gap: The works listed in Table 1 mainly handle isolated SHSA/MHSA, isolated bias-free GLU FFN, or simplified combinations without RMSNorm/residuals; in a complete block, each query passes through two layers of normalization and two sublayers simultaneously, so component-level reductions cannot be applied directly.
    • Numerical and scale obstacles: The authors state that existing rational pole-finding relies on FP64 or 180-digit offline arithmetic and is sensitive to rounding noise and subnormal underflow; naive Hessian storage is Θ(d4), and multi-head bilinear probing is Θ(d2) per head.
    • Core approach: The authors propose a unified four-stage pipeline that absorbs both RMSNorm gains into effective parameters, sequentially decoupling the aggregated Attention value map, the FFN, and each Attention head, then jointly refining; the same implementation does not branch by target precision.
    • Threat model:
      • Goal: Construct a block that is functionally equivalent within the allowed input domain; Attention recovery yields effective pairs (Sh, Ch), allowing a common permutation of heads, without seeking the original Q/K/V/O decomposition.
      • Knowledge: Knows d, H, r, m, the FFN branch, ϵ1, ϵ2, and the architecture; weights, biases, and normalization gains are hidden.
      • Capability: Can adaptively choose any real-valued token sequence within the input limits, with bounded inputs and no positional encodings.
      • Victim system and interface: A single dual pre-RMSNorm residual block using a biased ReLU or bias-free SwiGLU FFN; the oracle returns only the last-token vector after the dual residual and does not expose Attention weights, intermediate residuals, isolated FFN outputs, or derivatives.
  2. What related research exists?

    Related work proceeds along ReLU network, Attention, and GLU FFN extraction; this paper advances the object to a complete coupled block.

    Cryptanalytic Extraction of ReLU Networks

    • Carlini et al. (2020): established a framework for recovering functionally equivalent parameters of ReLU feedforward networks from black-box queries, exploiting derivative changes across ReLU boundaries; this paper follows this overall goal but handles normalization, residual, and Attention coupling.
    • Abad et al. (2026): studied signature extraction using vector-valued outputs of ReLU networks and analyzed the outer-product form of unit Jacobian changes; this paper extends it in Proposition 1 to the merging of multiple fitted units on the same hyperplane.

    Query Recovery of Attention

    • Bhattamishra et al. (2026): gave provable query recovery for single-head softmax Attention (SHSA) and the bias-free SHSA+ReLU combination, with a scalar-output interface.
    • Wang et al. (2026): used rational pole-finding to extract canonical parameters of isolated MHSA, and handled SHSA blocks with biased ReLU; Table 1 lists the former's precision as FP64 and the latter as FP64, with RMSNorm/residual counts both 0/0.
    • Kim and Kim (2026): studied query learning of MHSA and bias-free ReLU combinations; Table 1 notes that its MHSA setting uses FP64-rounded outputs and offline 180-digit arithmetic. The authors use these works to show that structural gaps remain for complete blocks and low-precision end-to-end extraction.

    Isolated GLU FFN Extraction

    • Shi and Fu (2026): under conditions of direct access to FFN inputs and outputs, recovered isolated bias-free SwiGLU/GeGLU using antipodal parity splitting and Hessian-subspace geometry, evaluated on FP64, FP32, FP16, BF16, TF32.
    • Borrowed and modified in this paper: the ideas of parity separation, Hessian subspaces, and sign recovery are retained, but the FFN cannot be directly observed in a complete block, so a singleton forward bridge is used instead, and narrow-factor QR/SVD avoids forming dense large Hessians.

    Experimental Comparison and Positioning

    • Baselines and benchmarks: Section 6 does not run other extraction methods as baselines, nor use external datasets; the objects are random blocks at five scales, comparing errors and query counts for two FFNs and four native precisions.
    • Authors' positioning: the authors describe this as an end-to-end extraction framework for the complete single-block dual pre-RMSNorm residual structure, covering both biased ReLU and bias-free SwiGLU, and distinguishing it from existing settings in Table 1 by the last-token vector interface and 2/2 RMSNorm/residual.
  3. How does the paper address this problem?

    Decouple the whole block via effective parameters: first take the aggregation map and FFN, then recover each head without root-finding, and finally perform low-rank joint refinement.

    The overall idea is to write the complete block in effective-parameter form and use a four-stage precision-agnostic pipeline to progressively create observable component inputs and outputs, avoiding direct inversion of the entire coupled system. The theoretical analysis uses an exact real-number oracle, and the experiments then evaluate the native floating-point implementation.

    Problem setting and effective parameters

    • Block computation: Fθ(X)=z(X)+G(N2(z(X))), where z(X)=xℓ+AttS,C(X); G has absorbed the second RMSNorm gain, and N2 is the gain-free normalization.
    • Attention parameters: Each head uses effective score/value matrices Sh, Ch, both of rank at most r, and the aggregation map M is the sum of the Ch; Qh, Kh, Vh, Oh, and the first RMSNorm gain are not recovered separately.
    • FFN targets: The ReLU branch recovers the normalization hyperplane, the activation side, the output vector, and the bias; the SwiGLU branch recovers (gj, Pj) for each neuron, where Pj is the transposed form of oj bj, allowing neuron permutation.

    Stage 1–2: Aggregation map and coupled FFN

    • M recovery for ReLU: Sequences with a repeated prefix and a zero last token make the Attention weights uniform, writing the response as a linear residual plus an RMSNorm-modulated FFN term; alternating least squares updates k and ρ without locating activation boundaries, then M is assembled from positive and negative basis directions.
    • M recovery for SwiGLU: Using G(0)=0 and DG(0)=0, opposite singleton queries cancel the quadratic even part, yielding a third-order approximation; an 8-query pilot checks whether the tiny response is finite and nonzero, and on FP16 underflow it automatically switches to three-point Richardson extrapolation with ℓ=256, k∈{1,2,3}, six full-block queries per direction, with seventh-order truncation error.
    • forward bridge: After obtaining an estimate of M, the singleton [x] directly yields the first residual and the normalized FFN input, and the FFN observation is obtained by subtracting the residual from the full response; only matrix-vector multiplication is required, and M need not be invertible or have an exact preimage.
    • Two FFN fits: ReLU first fits a width-2m proxy, then reduces to width m via coplanar unit merging, kink energy ranking, an activation-side linear system, and variable projection; SwiGLU fits an overparameterized proxy, performs narrow-factor QR/SVD on Gaussian-smoothed odd-part Hessians, sequentially recovers the plane, gate length, rank-1 coupling, and sign, then refines with damped Gauss–Newton.

    Stage 3: root-free multi-head Attention recovery

    • Pairwise inversion: Pre-RMSNorm Attention is an odd function when all tokens are negated, so the joint responses of X and −X form 2d equations without requiring G itself to be symmetric; starting from the known residual of all-identical tokens, bounded trust-region inversion is performed along the normalized-token interpolation path.
    • Self-calibration and failure handling: Eight pairs of opposite uniform-token anchors (16 queries) estimate the residual floor, with tolerance set to max(10−7, 10 efloor); on failure, the local bound is enlarged or path points are inserted, the number of attempts is bounded, and if it still fails no Attention label is returned.
    • Head separation and value stitching: Symmetric sequences are realized as three offset pairs plus a last token, seven tokens in total; a common Jacobian diagonalization separates head directions, and the known M constrains the scale. Two-token differences eliminate other heads per head, head labels are matched in at least two anchor directions, and the projected value maps are merged.
    • score reconstruction: artanh-unmixing is applied to the two-token responses to obtain bilinear measurements for all heads, then Sh is recovered with the CUR formula; taking k=min(d,2r), this stage uses at most 2kd≤4d2/H Attention evaluations, each still synthesized by pairwise inversion.

    Stage 4 and correctness conditions

    • Joint refinement: First the FFN is fixed and only Attention is tuned, then both are adjusted jointly; the objective consists of the full-block output error and a soft constraint on the aggregation map, using matrix-free LSMR Gauss–Newton, SVD rank truncation, and backtracking line search. Stage 4b reuses the Stage 4a responses and adds no target queries.
    • Boundaries of the theoretical guarantees: Propositions 1–9 give local or algebraic recovery conclusions under conditions such as exact responses, full rank, and direction separability; Proposition 10 in Appendix A gives contraction and step-size conditions for anchored continuation, and finite-precision behavior is evaluated empirically in Section 6.
  4. What experiments did the paper conduct?

    All 72 random block instances completed the four stages; the largest million-parameter block used 0.26–0.47 queries per parameter.

    Experimental Setup

    • Object under test: randomly initialized single-block dual pre-RMSNorm residual Transformers, respectively biased ReLU and bias-free SwiGLU; no named language model was used, and there were no other extraction baselines.
    • Five scales: (d,H,r,m)=(16,4,4,32), (32,4,8,32), (64,8,8,256), (128,8,16,512), (256,8,32,1024); ReLU/SwiGLU parameter counts range from 2,128/2,592 to 788,224/1,049,088.
    • Instances and repetitions: the first four scales each have two independent random models, with 16 instances per scale; the largest scale has one model and 8 instances, for a total of 72. Table 2 reports the maximum of the error and query columns across the two seeds for dual-seed configurations.
    • Precision and interface: native PyTorch FP64, FP32, FP16, BF16; the extractor performs only black-box forward queries and does not view weights or precision metadata. The two FFNs of the same random seed share Attention and RMSNorm parameters, with ϵ1=ϵ2=10−5.
    • Metrics: M is the relative Frobenius error; FFN4b is the maximum aligned relative parameter error after Hungarian neuron matching; Att4b=max(errC,errS); Block4b is the relative L2 output error on 256 independent length-5 holdout sequences.
    • Queries and hardware: Qtotal counts complete-block sequence queries across all stages, with Stage 4b adding zero new queries; d≥64 uses two NVIDIA RTX 5080 GPUs (16 GiB each) and two Intel Xeon Gold 6548N CPUs, running two instances concurrently.

    Main Results

    The table below lists all eight rows of Table 2 at the largest scale d=256, H=8, r=32, m=1024; Block4b is the holdout output error described above.

    Swipe horizontally to read the table

    Arch.DtypeParamsQtotalQ/paramBlock4b
    ReLUFP64788,224368,4320.471.78e-15
    ReLUFP32788,224368,4320.474.55e-07
    ReLUFP16788,224368,4320.478.14e-04
    ReLUBF16788,224368,4320.476.63e-03
    SwiGLUFP641,049,088268,0880.262.20e-15
    SwiGLUFP321,049,088268,0880.265.49e-07
    SwiGLUFP161,049,088333,6240.321.07e-03
    SwiGLUBF161,049,088268,0880.268.16e-03
    • Overall completion: the authors report that all 72 instances passed all four stages; Table 2 covers five scales, two FFNs, and four precisions, with no separate attack success rate metric.
    • Block4b range across the full table: FP64 is 7.57e-16–2.20e-15, FP32 is 1.28e-07–5.49e-07, FP16 is 6.78e-04–1.07e-03, BF16 is 5.48e-03–8.16e-03; the authors state these errors reach the native rounding floor of each format.
    • Parameter error trends: the authors report that under FP64/FP32 the relative errors of FFN and Attention parameters are on the order of 10−15–10−14 and 10−7–10−6, respectively; in Table 2 the largest-scale ReLU FP64 has M of 2.51e-15, higher than its Block4b, indicating that different metrics cannot substitute for one another.

    Inversion Convergence and Runtime Cost

    • Path subdivision: for all 40 instances with d∈{64,128,256}, paired inversion converged directly from the uniform-token anchor, with zero adaptive path subdivisions.
    • Largest-scale runtime: the 8 largest-scale instances total 12h 00m 30s of dual-GPU wall time, with peak memory of 6.76 GiB per GPU; the paper does not give per-instance times.
    • Precision-related query differences: in Table 2, SwiGLU FP16 requires more queries than other precisions at the same scale at multiple scales, consistent with the Stage 1 design of automatically switching to three-point extrapolation; ReLU at the largest scale has the same Qtotal across all four precisions.

    Other Ablations and Analyses

    • The paper has no separate component ablations, hyperparameter sweeps, defense evaluations, adaptive attacks, or human evaluations.
    • Propositions 2–3 give third-order/seventh-order approximations and least-squares consistency for the two-level M observations of SwiGLU; these are exact-arithmetic analyses, not additional experiments.
    • Appendix A gives convergence conditions for fixed-matrix correction under exact responses, and states that finite-precision numerical behavior is empirically evaluated in Section 6.
  5. What are some points that can be further explored?

    The authors list directions such as multi-layer, positional encodings, and trained checkpoints; the current evidence is limited to random single blocks.

    Limitations and future directions noted by the authors

    • Multi-layer architectures: Section 7 Future Work proposes extending single-block extraction to multi-layer stacked Transformer architectures.
    • Positional encodings: The same section proposes incorporating rotary or learned positional encodings; the current queries and modeling do not use positional encodings.
    • Attention variants: The same section proposes extending to grouped-query Attention.
    • Larger widths: The same section proposes further end-to-end evaluation, e.g., d=512, m=2048.
    • Trained models: The same section proposes extending to trained language-model checkpoints; the current experiments use random models.

    Experimental coverage

    • Object scale: The experiments cover five randomly initialized single-block configurations, two FFNs, and four native precisions, 72 instances in total; the largest is d=256, H=8, r=32, m=1024 (Section 6.1).
    • Functional evaluation: Block4b uses 256 independent length-5 holdout sequences; for dual-seed configurations, Table 2 takes the maximum error and query count over the two seeds.
    • Attack interface: Only black-box forward queries of the last-token vector are evaluated, with bounded inputs and no positional encodings; intermediate quantities or target derivatives are not exposed (Section 2.2, 6.1).
    • Comparisons and perturbations: Section 6 does not report other extraction baselines, defenses, adaptive attacks, or component ablations; the conditions of the theoretical propositions, such as full rank and exact responses, are stated separately from the native floating-point experiments.
    • Resource reporting: For the largest scale, total wall time and peak memory are reported; the paper does not report the number of queries per stage, per-instance time, or repetition across more random models.
  6. Summarize the main content of the paper

    A four-stage algebraic and numerical procedure achieves end-to-end extraction across four precisions on random complete single blocks.

    This is a cryptanalytic model-extraction study whose object is a complete single-block Transformer with dual pre-RMSNorm, dual residual, and multi-head softmax Attention, covering both biased ReLU and bias-free SwiGLU FFNs.

    • Problem addressed: Existing methods mostly target isolated components or simplified blocks; in a complete block, the normalization and residuals couple the component observations to each other, and low precision also breaks numerical steps such as pole-finding; the attacker can only adaptively query and obtain the last-token output vector.
    • Method highlights: First recover the aggregated value map M, then use the singleton forward bridge to construct FFN inputs and outputs and extract the FFN; subsequently recover each head via X/−X pairwise inversion, symmetric-probe head separation, two-token value stitching, and CUR score reconstruction, and finally jointly refine on the fixed-rank manifold.
    • Completed scale: Five random configurations and FP64/FP32/FP16/BF16, 72 instances in total, all completed the four stages; the largest configuration is d=256, H=8, r=32, m=1024, with ReLU/SwiGLU containing 788,224/1,049,088 parameters respectively (Table 2).
    • Query counts: At the largest scale, ReLU uses 368,432 queries in all four precisions, Q/param=0.47; SwiGLU uses 268,088 queries, 0.26, in FP64/FP32/BF16, and 333,624 queries, 0.32, in FP16.
    • Functional error: At the largest scale, Block4b is 1.78e-15/2.20e-15 (ReLU/SwiGLU) in FP64, 4.55e-07/5.49e-07 in FP32, 8.14e-04/1.07e-03 in FP16, and 6.63e-03/8.16e-03 in BF16; the authors state this reaches the hardware rounding floor of the respective formats.
    • Conclusion and boundaries: The authors believe a unified implementation can handle complete blocks without branching by precision; the current evidence comes from random single blocks, and multi-layer stacking, positional encodings, grouped-query Attention, larger widths, and trained language-model checkpoints are listed as future directions.
Read originalarxiv.org