Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
Analyze & explore related research in Conceptio
Connect this record directly into your research workflow or AI agent. Explore citations across open repositories, query full text, and export structured proof bundles.
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks Zirui Chen1 , Shi Tang2 , Zhengchao Gao2 , Yongjia Su2 , Lingyue Qin1 , and Xiaoyang Dong1 1
arXiv:2608.05736v1 [cs.CR] 6 Aug 2026
Tsinghua University, Beijing, P. R. China chenzr25@mails.tsinghua.edu.cn, {qinly,xiaoyangdong}@tsinghua.edu.cn 2 Shandong University, Qingdao, P. R. China {shi.tang,chao qwq,yongjia.su}@mail.sdu.edu.cn
Abstract. Although the state-of-the-art neural network model extraction attack in the hard-label setting by Carlini et al. at EUROCRYPT 2025 has polynomial-time complexity in theory, its dual-point clustering relies on singular value decomposition (SVD) with a time complexity of O(n2 ·(d(k) )3 ), resulting in huge runtime in practice. To address this computational bottleneck, this work transforms Carlini et al.’s geometricview hard-label attack into an algebraic framework, and proposes a novel Approximate Signature Vector (ASV) method to achieve efficient parameter extraction on Fully Connected Neural Networks (FCNNs) by leveraging two key observations: high-dimensional random vectors are nearly orthogonal, and neurons in practical DNNs tend to learn disentangled features. The proposed ASV method replaces SVD-based rank checking with simple inner-product operations, reducing the clustering complexity to O(n · (d(k) )3 ) on average. Furthermore, this paper presents the first model extraction attack against hard-label max-pooling Convolutional Neural Networks (CNNs) by proposing an advanced ASV method with a kernel-centric clustering scheme instead of the neuron-centric clustering, which fully exploits the property of weight sharing in convolutions and fills the cryptanalysis gap. Experiments on a 64-64×4-10 FCNN and LeNet-5 (CNN) with max pooling demonstrate that our ASV method drastically cuts clustering time, and improves the overall efficiency in the model extraction. Keywords: Model Extraction · Hard-label · Convolutional Neural Networks · ReLU · Algebraic Attack · Approximate Signature Vector
1
Introduction
Deep Neural Networks (DNNs) map inputs to outputs via a function defined by their architecture, weights, and biases. Extracting these weights and biases from a black-box DNN (given only its inputs and outputs) has been a longstanding challenge spanning three decades [4,14]. As early as 2005, Lowd and Meck introduced the first adversarial reverse engineering attack for this problem [26], with recent years seeing continued innovations from industry and academia
2
Z. Chen et al.
[2,19,27,29,32]. At CRYPTO 2020, Carlini, Jagielski, and Mironov achieved the seminal parameter extraction attack on the ReLU-based fully connected neural networks (FCNNs) with a cryptographic differential attack [9]. This approach recovers the unsigned weights using a polynomial number of raw output queries, but relies on exponential time of guessing for sign recovery [9]. At EUROCRYPT 2024, Canales-Martı́nez et al. proposed the neuron wiggle technique to recover neuron signs in polynomial time [7]. Building on this, Foerster et al. developed an end-to-end attack for practical models by combining methods from Carlini et al. and Canales-Martı́nez et al. at NIPS 2024 [15]. At EUROCRYPT 2026, Liu et al. further extended parameter extraction to the deep layers with more novel techniques [24]. In 2026, the parameter extraction attacks are proposed against the Convolutional Neural Networks (CNNs) with max pooling [12,23] and average pooling [31]. Besides, various model extraction attacks have emerged for different networks, such as PReLU networks [11], non-linear activations networks [1,28], as well as in the physical leakage settings [2,18,13], etc. Another direction focuses on ReLU-based FCNNs in the hard-label scenario, where attackers only access final classification labels (e.g., “dog” or “car”). Yi Chen et al. first proposed a polynomial-query extraction method for this setting at ASIACRYPT 2024, though it suffered from exponential runtime [10]. Carlini et al. addressed this limitation at EUROCRYPT 2025, introducing a polynomialtime, polynomial-query attack by analyzing the geometric properties of decision boundaries [8]. Canales-Martı́nez later dedicated his work to the output layer recovery (a ReLU-free component) at LATINCRYPT 2025 [6]. In 2025, Ito, Miura, and Todo noted that Carlini et al.’s attack assumptions may become impractical for deep networks, proposing a cross-layer extraction strategy to resolve this issue. Sun et al. proposed the first extraction attack on hard-label CNN with average pooling [31] and later improved by [21], while the attacks on max-pooling CNNs [12,23] require the raw output queries, making the hard-label attacks against max-pooling CNNs an open problem. Our Contributions. At EUROCRYPT 2025, Carlini et al. proposed the extraction attack on hard-label FCNNs by analyzing the geometric properties of decision boundaries [8]. While the attack operates in polynomial time in theory, applying it in a strictly black-box setting presents practical bottlenecks as stated by Carlini et al. [8, Section 8]: “However, a fully optimized end-to-end blackbox implementation which can be used by third parties remains future work.” A major computational hurdle arises during the signature recovery phase, which requires clustering the collected dual points into consistent groups. The authors explicitly acknowledge this limitation, noting that their proof-of-concept implementation avoids the full computational burden of this step in [8, Section 7.1]: “Our proof-of-concept implementation disregards the runtime of the n2 pairwise clustering tcluster needed to identify dual points that are mutually consistent. Although this method is known to work in principle
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
3
(we validated it post-hoc) and clearly runs in polynomial time, applying it naively (i.e., without many potential optimizations) to a real attack would involve a (1 million)2 time complexity, requiring weeks of computation.” Our contributions comes from three aspects: – Improved Carlini et al.’s Hard-label Attack: We convert Carlini et al.’s attack [8] from their geometric view to our algebraic view, which inspires a more efficient clustering method named as approximate signature vector (ASV) method. This method originates from a mathematical observation [19, Chapter 3.2, Remark 3.2.5] that independent and high-dimensional random vectors tend to be almost orthogonal. Another observation is that in the practical training of a DNN, distinct neurons tend to extract divergent and disentangled features [3], which makes different row vectors of the weight matrix uncorrelated or somewhat independent. For any given neuron, we introduce the ASV ⃗v , which has a very close direction to the original weight w ⃗ of this neuron due to these two observations. In Carlini et al.’s hard-label attack [8], the time-consuming clustering step requires clustering different dual points corresponding to the same neuron. Suppose that there are n dual points for layer k, their method is to compute the rank for any two dual points through SVD, which has a total time complexity of O(n2 · (d(k) )3 ). Based on our ASV method, we first compute the ASV ⃗v for each dual point. If two dual points correspond to the same neuron (with an unknown weight w), ⃗ then their ASVs ⃗v1 and ⃗v2 will have very close directions (identical or opposite) to w ⃗ simultaneously. Therefore, the directions of ⃗v1 and ⃗v2 will also be almost identical or opposite, which could be detected by a simple inner product in O(d(k) ). Consequently, we provide an improved clustering method with a time complexity of O(n(d(k) )3 + n2 d(k) ) in the worst case, and O(n(d(k) )3 ) in the average case. In our experiment on DNN with 2000 dual points, the clustering time is 211.9 seconds (about 1 hour) with our ASV method, while Carlini et al.’s method [8] requires about 223.9 seconds (4348 hours), i.e., the time is significantly reduced by a factor of 212 . More comparisons are given in Tab. 3. – Advanced ASV Method in Hard-label Attack on the Max-pooling CNN: Based on the ASV method, we introduce the first hard-label attack on the max-pooling CNN, filling a cryptanalysis gap. We inherit the critical points defined by Zirui Chen et al. [12], i.e., ReLU-Pooling Critical Point (RPCP) and Pooling Switching Point (PSP), and define the so-called dual RPCP and dual PSP for hard-label CNNs. In Carlini et al.’s attack [8] on FCNNs and Sun et al.’s attack [31] on average-pooling CNNs, the dual points clustering method is both neuron-centric, i.e., two clustered dual points should correspond to the same neuron. When applying the neuron-centric method to the max-pooling CNN, one has to collect many dual RPCPs or dual PSPs to expect that at least two fall into the same neuron or max pooling. However, different from FCNN, in layer k of a single-channel CNN,
4
Z. Chen et al.
the convolutional kernel weight to be recovered is the same one for all neurons. Therefore, there is a natural question that can we cluster different dual RPCPs and dual PSPs corresponding to different neurons or max poolings within the same layer k into the same category, and use them to determine the unique convolutional kernel weight? This paper solves the question by proposing the advanced ASV method with a kernel-centric (instead of Carlini et al.’s neuron-centric) clustering method by clustering all dual points corresponding the same convolutional kernel into the same category, and also the technique to solve the unique convolutional kernel weight through the clustered dual points. Hence, the number of dual points needed to recover the kernel weight is significantly reduced. – Practical Experiments: • FCNN: We extracted the signatures of the first two layers of a (6464×4-10) FCNN, identical to the “Tiny” model from the source code provided by Carlini et al. [8]. The results and the comparison with the experiment [8] on the same platform are given in the first three rows of Table 1. Carlini et al.’s method needs 5.03 hours to extract the 1st layer, while our method only needs 0.04 hours, reducing the runtime by 99.2%. For the 2nd layer, our method needs 0.74 hours, while Carlini et al.’s method cannot give a result within 1 week. • CNN: We recover the convolutional block of a (2+1) CNN (Table 5) and a (2+2) LeNet-5 with max pooling in the hard-label setting. The bottom four rows of Table 1 compare our results with Sun et al. (which targets average pooling) [31] and Chen et al. (which requires raw outputs) [12]. The source codes for all the experiments can be found via XXX
2
Preliminaries
All notations are summarized in Tab. 6 in Supp. A.1. A Deep Neural Network (DNN) with logit output is a function Fθ parameterized by θ that takes inputs (1) (n+1) from an input space Rd and returns values in an output space Rd . Under the hard-label setting, the network returns the the most likely class label (e.g., “cat” or “dog”), instead of concrete logit values, i.e., it applies a hard-label function z to the logits at the end of the DNN computation, and outputs the index of its maximum element. Definition 1. (Hard-label Deep Neural Network) A hard-label deep neural (1) network takes an input X (1) ∈ Rd , processes it through the DNN, and applies a hard-label function z on the resulting logit vector to returns a hard label: Hθ = (z ◦ Fθ )(X (1) ) = z(Fθ (X (1) )) = arg max Fθ (X (1) )i
(1)
i
Note that if there are ties, i.e., multiple elements of Fθ (X (1) ) have the same maximum, the hard-label is the smallest index of these equal elements [8,10].
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
5
Table 1: Experiments on FCNN and LeNet-5 (CNN). All notations are summarized in Tab. 6 in Supp. A.1. and the architecture of LeNet-5 is given in Supp. D. The accuracy term (ε, 0) is defined in Sect. 2.3, and max|θ − θ̂| directly measures the maximum extraction error of model parameters. Architecture† (k) d(k) –df –d(k+1)
Kernel
FCNN 64 − 64 × 4 − 10
F1 : 64–64
–
0.04
FCNN∗ [8]♦
F1 : 64–64
–
FCNN∗
F2 : 64–64
–
Models
LeNet-5
C1 : 1024–4704–1176 (1,6,5,5)
Runtime Queries hours
(ε, 0)
max|θ − θ̂|
217.46
2−13.62
2−17.86
5.03
221.50
2−12.77
2−17.58
0.74
221.62
2−7.53
2−11.95
2.44
218.44
2−24.73
2−30.58
24.35
−21.77
2−29.11
LeNet-5
C2 : 1176–1600–400
(6,16,5,5)
27.98
2
2
LeNet-5 [31]♠
C2 : 1176–1600–400
(6,16,5,5)
190.84‡
224.08
–
2−17.75
LeNet-5 [12]♣
C1 : 1024–4704–1176 (1,6,5,5) C2 : 1176–1600–400 (6,16,5,5)
42.11‡
227.29
2−23.38
2−27.31
†:
Fi indicates the FCNN round i with d(i) − d(i+1) ; Ci denotes the Convolutional Round i, defined in Tab. 6. ∗: The architecture of the FCNN is the same with the model in the first row. ♦: Carlini et al. [8] employ an SVD-based rank-checking cluster method for clustering. Due to its high computational cost, the complexity of only the first layer extraction is given. ♠: Sun et al. [31] target the classic LeNet-5 with Average Pooling rather than Max Pooling. ♣: Chen et al. [12] conduct their end-to-end attack on the convolutional block (Conv1 and Conv 2) in raw-output setting. ‡: The figures are borrowed from [31] and [12], respectively.
2.1
FCNN
When the DNN is a Fully-connected Neural Network (FCNN), the network is composed of a sequence of functions alternating between linear functions f (k) : (k) (k+1) Rd 7→ Rd (k ≥ 1), and a nonlinear function σ (component-wise ReLU function): Fθ = f (r+1) ◦ σ ◦ f (r) ◦ σ ◦ · · · f (2) ◦ σ ◦ f (1) , (2) (k)
where f (k) : Rd
(k+1)
→ Rd
is an affine transformation:
f (k) (X) = A(k) X (k) + B (k) , (k)
where X (k) ∈ Rd represents the input vector. The weight matrix A(k) ∈ (k+1) d(k+1) ×d(k) are composed of floating-point R and the bias vector B (k) ∈ Rd numbers, which are the model parameters. (1) Given input X (1) ∈ Rd , the ReLU function σ in layer k is also interpreted as the matrix (k) (k) (k) I (k) = diag(τ0 , τ1 , . . . , τd(k) ), (3) (k)
where τi
∈ {0, 1}, 0 ≤ i ≤ d(k) are determined by the input X (1) .
6
Z. Chen et al. (1)
Definition 2. (Linear Neighborhood) Given an input x ∈ Rd , so that the matrices A(k) , B (k) , I (k) , (1 ≤ k ≤ r + 1) will be all fixed. The linear (1) neighborhood of x is defined as the subset χ ⊂ Rd , so that all x′ ∈ χ, the same matrices A(k) , B (k) , I (k) , (1 ≤ k ≤ r + 1) will be applied to compute the output of the FCNN. FCNN has been proved to be piecewise linear function [9,7], i.e., for x in a linear neighborhood of X (1) (changing the input x in the linear neighborhood of X (1) , the output of FCNN will change linearly), the FCNN is reduced to Fθ (x) = A(r+1) I (r) A(r) · · · I (1) A(1) x + B (1) · · · + B (r) + B (r+1)
(4)
= A(r+1) I (r) A(r) · · · I (2) A(2) I (1) A(1) x + β = Γ x + β.
2.2
CNN (1)
In (m+n)-deep Convolutional Neural Network (CNN), the function Fθ : Rd → (m+n+2) Rd is composed of two sequential blocks: the first block (Convolutional (k) Block) consists of m layers of alternating convolutional layers fc , nonlinear (k) activation layers σc (ReLU function), and pooling layers ρ(k) (1 ≤ k ≤ m); the second block (Fully-connected Block) consists of n layers of alternating linear layers f (k) and activation functions σ (k) : Fθ = f (n+1) ◦ σ (n) ◦ · · · ◦ σ (1) ◦ f (1) ◦ ρ(m) ◦ σc(m) ◦ fc(m) ◦ · · · ◦ ρ(1) ◦ σc(1) ◦ fc(1) . {z } | | {z } Fully-connected Block
Convolutional Block
(5) In 2026, Zirui Chen et al. [12] gave an algebraic view of CNN. In Fig. 1, (1) (k) (k) given X (1) ∈ Rd , the layer k of the convolutional block “ρ(k) ◦ σc ◦ fc ” is translated into (k)
ρ(k) ◦ σc
(k)
◦ fc
= P (k) I (k) (A(k) X (k) + B (k) ),
(6)
where convolutional kernal matrix A(k) and the bias B (k) are the only trained parameters in CNN which will be extracted, I (k) is the same to Eq. (3), and P (k) is the so-call Boolean max-pooling matrix [12]. More details on those matrices are given in Supp. A.1, and a toy example is given Fig. 7 in Supp. A.2. CNN has been also proved to be piecewise linear [12], i.e., for x in a linear neighborhood of X (1) , the convolutional rounds and FCNN rounds of CNN “collapse” into an affine transformation. Assume that the function of the m convolutional rounds is F1 , and the function of the n FCNN rounds is F2 , then y = F1 (x) = P (m) (I (m) (A(m) · · · (P (1) (I (1) (A(1) x + B (1) ))) · · · + B (m) )) = P (m) I (m) A(m) · · · P (2) I (2) A(2) P (1) I (1) A(1) x + β1 = Γ1 · x + β1 .
(7)
Together with Eq. (4), the full CNN “collapses” into Fθ (x) = Γ2 (Γ1 · x + β1 ) + β2 = Γ2 · Γ1 · x + Γ2 β1 + β2 .
(8)
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks (k)
h(k) ×wo(k)
F2 o
(k)
C (k) ∈ Rhc ×wc (k)
(k)
IN (k) ∈ Rhin ×win
-1
0
1
1
-1
0
0
-1
0
0 1 LRF-C 0 0 -1
1
1
1
0
1
1
1
0
-3
0
-1 0
0 0
-1 1
X (k) ∈ Rd
-2 1 (k)
0
1
1
0
O(k) ∈ Rho ×wo
0
0
0
1
1
1
(k)
(k)
A(k) ∈ Rdf ×d B (k) ∈ R
(k)
(k) df
,
(k)
0
2
-1
-1
-1
-1
2
1
7
3
(k)
(k)
d
(k)
I (k) ∈ F2f Y (k) = A(k) X (k) + B (k)
(k)
×df
(k)
Ô(k) ∈ Rho ×wo
0
1
0
0
0
0 2 LRF-P 0 0 2
4
Y (k) ∈ Rdf
(k) h(k) ×wm
M (k),0,0 ∈ F2 m
(k+1)
IN (k+1) ∈ Rhin 2
2
3
4
(k+1)
∈ Rd
(k+1)
×win
0
3
4 (k)
Z (k) ∈ Rdf
P (k) ∈ Rd
(k+1)
X
(k)
×df
(k+1)
Fig. 1: Symbolic View of CNN [12] If we make a change of ∆ to the input x, and x + ∆ remains within the linear neighborhood of x, we can observe the corresponding change of the output Fθ (x+∆)−F (x) = Γ2 ·Γ1 ·(x+∆)+Γ2 β1 +β2 −(Γ2 ·Γ1 ·x+Γ2 β1 +β2 ) = Γ2 ·Γ1 ·∆. Definition 3. (Layer Merging) Given (m + n)-deep CNN network, suppose that we have complete knowledge of the first k − 1 layers of the convolutional block, and we are currently recovering layer k. Let Fxk−1 and Gk+1 represent, x respectively, the fully recovered and non-recovered parts of the CNN. Fθ = f (n+1) ◦ · · · ◦ σ (1) ◦ f (1) ◦ ρ(m) ◦ · · · ◦ fc(k+1) ◦ρ(k) ◦σc(k) ◦fc(k) ◦ρ(k−1) ◦ · · · ◦ fc(1) . | {z } | {z } Gk+1 x
Fxk−1
(1)
(X (k+1) ) = Gk+1 X (k+1) + and Fxk−1 become Gk+1 Given X (1) ∈ Rd , Gk+1 x x (k) (1) (1) k−1 (1) k−1 k+1 k−1 X +B , where the matrices F k−1 ∈ Rd ×d , B and Fx (X ) = F (k) (n+2) (k+1) (n+2) ×d B k−1 ∈ Rd , Gk+1 ∈ Rd , B k+1 ∈ Rd , respectively. The definition of layer merging for FCNN is similarly defined. Definition 4. (Model Parameters) The parameters θ of a deep neural network Fθ are the concrete assignments to the weights A(k) , biases B (k) for k ≥ 1 in both CNN or FCNN. The unsigned weights and biases are called “signatures”. Definition 5. (Neuron State and Critical Point[9]) Let V(η; X (1) ) denote (1) the value that neuron η takes with X (1) ∈ Rd before applying its corresponding activation function σ. If V(η; X (1) ) > 0 (respectively, V(η; X (1) ) < 0), the neuron state of η is activated (respectively, inactivated). In FCNN, if V(η; X (1) ) = 0, the neuron state is critical, and X (1) is a critical point. Definition 6. (ReLU-Pooling Critical Point, RPCP [12]) In CNN, a (1) ReLU-Pooling Critical Point (RPCP) is an input X (1) ∈ Rd that makes the (k) input of ReLU function in σc layer 0, and by varying the inputs in the tiny (1) vicinity of X , the output of CNN changes non-linearly. Property 1. [12] If X (1) is a RPCP corresponding to the t-th neuron in layer (k) (k) k, then At X (k) + Bt = 0, and the inputs of other neurons in the same Local Reception Field of Pooling (LRF-P) are smaller than 0.
8
Z. Chen et al.
Definition 7. (Pooling Switching Point, PSP [12]) In CNN, a Pooling (1) Switching Point (PSP) is an input X (1) ∈ Rd such that two inputs within a LRF-P achieve the same maximum value. By varying the inputs in the tiny vicinity of X (1) , the output of CNN changes non-linearly. Property 2. [12] If X (1) is a PSP corresponding to the i-th and j-th neuron in (k) (k) layer k, then Ai X (k) + b(k) = Aj X (k) + b(k) , and the inputs of other neurons in the same LRF-P are smaller than it. 2.3
Adversarial Goals and Assumptions
We make the following assumptions on the capabilities of the attacker: – Architecture knowledge. The attacker has the full knowledge of the target neural network’s architecture, while the parameters are treated as secret. (1) – Full-domain inputs. The attacker can query arbitrary inputs from Rd . – Precise Computation. The neural network is specified and evaluated using a sufficiently high precision floating-point arithmetic. – ReLU Activations. All activation functions σ (k) are the ReLU function. – Hard-label Outputs. Given input X (1) , the model returns the label of the most likely class, which corresponds to the maximum of the raw output. Adversarial Goal. The adversarial goal is to achieve an (ε, ξ)-functionally equivalent parameter extraction, rather than replicating the exact original parameters. [9,12,25]. Definition 8. ((ε, ξ)-Functional Equivalence [9]) Two neural networks Fθ and Fθ̂ are (ε, ξ)-functional equivalent on the input dataset S if P rx∈S (|Fθ (x) − Fθ̂ (x)| ≤ ε) ≥ 1 − ξ. In our analysis, we specifically focus on the (ε, 0)-functional equivalence given by Carlini et al. [9] which represents an upper bound on the maximum error of the output. We adopt the error bounds propagation method introduced by Carlini et al. [9, Section 6.2] to compute the (ε, 0)-functional equivalence.
3
Algebraic Analysis of Carlini et al.’s Hard-label Attack
Prior model extraction attacks in the raw-output setting heavily rely on identifying critical points, where the ReLU of a neuron flips, leading to nonlinear changes in the network’s output, which can be detected by performing a binary search sweep along continuous linear paths in the input space [9]. In the hard-label setting, continuous logit outputs are inaccessible, and the only change the adversary can observe is label switching. Hence, the boundary between pairs of class labels can be detected, which is called the decision boundary. At EUROCRYPT 2025 [8], Carlini et al. observed that the decision
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
9
boundary of a ReLU network is composed of piecewise-linear regions and it bends precisely when intersecting a critical hyperplane due to a single neuron’s state change. This critical hyperplane consists of the critical points that are otherwise undetectable in this setting. Note that points on the two adjacent decision boundary patches share the same neuron states, except for the state of the neuron corresponding to the critical hyperplane. As shown in Fig. 3, in the input space, the intersection of the two (d(1) − 1)-dimension decision boundary patches yields a (d(1) − 2)-dimension subspace (called dual space), which is entirely contained in the (d(1) − 1)-dimension critical hyperplane (the yellow region). decision boundary
m ⃗2
decision boundary
(xleft , xdual , xright )
m ⃗1 decision boundary
x0
x3 x4
dual space
x2
critical hyperplane
dual space
x1
Fig. 3: Intersection of critical hyperplane and dual space with decision Fig. 2: Method for finding dual spaces boundaries The attacker can traverse the decision boundary to locate these changes in local orientation and identify points that lie simultaneously on both the decision boundary and the critical hyperplane, which are defined as dual points. By analyzing the local geometry around these dual points, the attacker can recover the normal vector of the underlying critical hyperplane, which corresponds to the secret weights of the targeted neuron up to a scalar. The parameter extraction process for each layer consists of two steps: signature recovery and sign recovery. 3.1
Algebraic View on Carlini et al.’s Signature Recovery
Definition 9. (Decision Boundary) The decision boundary consists of points (1) X (1) ∈ Rd so that two logit outputs of the DNN reach the same maximum value.
Suppose the prior k − 1 layers have been extracted. From Def. 3, for any input X (1) , the forward mapping matrices F k−1 and B k−1 are known, yielding X (k) = F k−1 X (1) + B k−1 . If X (1) lies on the decision boundary where the i-th and j-th network output Fi (X (1) ), Fj (X (1) ) are equally maximum, we have: Fi (X (1) ) − Fj (X (1) ) = (Gk+1 − Gk+1 )I (k) (A(k) X (k) + B (k) ) + Bik+1 − Bjk+1 = 0, (9) i j
where Gk+1 and Bik+1 are the i-th rows of matrices Gk+1 and B k+1 , respectively. i
10
Z. Chen et al.
Definition 10. (Critical Hyperplane) The critical hyperplane consists of (1) critical points corresponding to the input X (1) ∈ Rd that make the input of (k) ReLU function σ of a neuron 0. If X (1) is a critical point corresponding to the t-th neuron in layer k, then (k)
(k)
At X (k) + Bt
= 0.
(10)
At this point, the t-th diagonal entry of the activation matrix I (k) can be either 1 or 0 without altering the output, as the neuron always outputs 0. Consequently (k) (k) the corresponding activation matrices can be I+ or I− , differing only at the (k) (k) t-th diagonal entry (1 in I+ and 0 in I− ). Then, we have: (k)
(k)
Gk+1 (I+ − I− )(A(k) X (k) + B (k) ) = 0.
(11)
Definition 11. (Dual Points) Dual points are located at the intersection of a critical hyperplane and the decision boundary patches on both sides. Consequently, dual points fulfill the properties of both decision boundary points and critical hyperplane points (i.e., Eqs. (9) and (10)). If X (1) is a dual point corresponding to the t-th neuron in layer k, and is located on the decision boundary between class i and class j, it satisfies: (k)
(k)
(Gk+1 − Gk+1 )(I+ − I− )(A(k) X (k) + B (k) ) = 0. i j
(12)
Definition 12. (Dual Space) A dual space is the subspace spanned by dual points corresponding to the same neuron and the same decision boundary. Remarks. 1. Both a decision boundary and a critical hyperplane are governed by a single constraint (Eqs. (9) and (10) respectively), making them the (d(1) − 1)dimension subspaces in the input space. Consequently, the dual space, constrained by both equations simultaneously, is (d(1) − 2)-dimension. 2. In the same dual space, the activation states of all neurons are the same, i.e., given a dual point X (1) , all X ′(1) sampled from the same dual space are in the linear neighborhood of X (1) . By employing the Dual Points Finding algorithm proposed by Carlini et al. in [8, Section 4], upon collecting a dual point xdual , as shown in Fig. 2, we simultaneously obtain two adjacent points xleft and xright . While xdual lies precisely on the intersection of the decision boundary and the critical hyperplane, xleft and xright reside on the two distinct decision boundary patches on either side of this critical hyperplane. From these points, we can extract the local normal vectors to the adjacent decision boundary patches at inputs xleft and xright , denoted as m ⃗ 1 and m ⃗ 2 , respectively. Specifically, starting from a point on the decision boundary (e.g., xleft ), we take a small step α along a reference basis direction e⃗0 to step off the boundary,
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
11
and then perform a binary search along another orthogonal basis direction e⃗i to find the distance β required to return to the decision boundary. By computing the β ratio α , we obtain the relative coordinate weights of the normal vector. Iterating this procedure across all d(1) dimensions allows us to completely reconstruct the directions of m ⃗ 1 and m ⃗ 2 up to an unknown scalar factor. (1) For arbitrary points X (1) and X ′ sampled from the same dual space, their difference effectively eliminates the constant terms: (k)
(k)
(Gk+1 − Gk+1 )(I+ − I− )A(k) F k−1 (X (1) − X ′ i j (k)
(1)
) = 0.
(13)
(k)
Note that the term I+ − I− yields a diagonal matrix with a single non-zero entry (value 1) at the (t, t)-th position, effectively acting as a selection operator. Let the row vector Gk+1 − Gk+1 = (g0 , g1 , . . . , gd(k+1) −1 ), where gs ∈ R for i j (k+1) 0≤s≤d − 1. Then we have: (k)
(k)
(k)
(Gk+1 − Gk+1 )(I+ − I− )A(k) = gt At . i j
Let ⃗δ = X (1) − X ′
(1)
(14)
. Then, Eq. (13) can be simplified as: (k)
gt At F k−1⃗δ = 0,
(15)
(k) where gt At represents the weight vector of the target t-th neuron, scaled by
an unknown constant gt . Therefore, in the hard-label setting, this model extraction attack can still be regarded as a differential attack, where the difference between inputs from the same dual space is studied as it propagates through the sequential cryptographic/DNN operations. For a given input difference ⃗δ, the corresponding output difference—specifically defined as the difference between the logit gaps Fi − Fj in Eq. (9) of the two respective inputs—deterministically evaluates to 0. Is a Single Dual Space Sufficient for One Neuron Weight Recovery? By sampling n (n is slightly larger than d(k) ) different dual points within the same dual space, we can compute ⃗δj = X (1) − X ′(1) (0 ≤ j ≤ n − 1), and construct a system of equations: T
(k) T
(F k−1⃗δj ) gt At
= 0.
(16)
To obtain a unique non-trivial solution (up to a scalar) for the linear system in Eq. (16), the coefficient matrix constructed from the differential vectors {F k−1⃗δj }0≤j≤n−1 must attain a rank of d(k) − 1. Note that F k−1⃗δj is the difference between X (k) and X ′(k) . Since both X (k) and X ′(k) are sampled from the same dual space, they are simultaneously subject to the constraints of the decision boundary (Def. 9) and the critical hyperplane (Def. 10). Geometrically, this intersection forms at most a (d(k) −2)-dimension subspace (assuming all neurons in layer k − 1 are activated, it is a (d(k) − 2)-dimension subspace). Hence, the matrix formed by any subset of the differential vectors {X (k) − X ′(k) } derived from a single dual space has a rank of at most d(k) − 2. Hence, we need at least two dual spaces corresponding to the same neuron to recover its weight vector.
12
Z. Chen et al.
Clustering Dual Points from Different Dual Spaces. Given a set of dual points collected thus far, the next step is to cluster them into disjoint groups, where each group corresponds to a distinct target neuron. To achieve this, Carlini et al. [8, Section 5.2] introduced the ISCONSISTENT algorithm, which verifies whether two dual spaces D1 and D2 correspond to the same neuron by analyzing the rank of their union. Suppose we sample differential vectors ⃗δ0 , . . . , ⃗δs1 −1 from D1 , and ⃗δ0′ , . . . , ⃗δs′ 2 −1 from D2 (s1 and s2 are slightly larger than d(k) ). We can construct a joint difference matrix S by stacking these vectors: T S = ⃗δ0 , . . . , ⃗δs1 −1 , ⃗δ0′ , . . . , ⃗δs′ 2 −1 .
(17)
The problem of determining consistency is thus reduced to checking whether the following homogeneous system of equations admits a non-trivial solution: T
(k) T
SF k−1 gt At
= 0.
(18)
Let Λ1 and Λ2 denote the sets of active neurons at layer k − 1 for the dual points in D1 and D2 , respectively. As discovered by Carlini et al. [9, Section 4.3.2], the rank of the matrix is usually not full since the ReLU functions suppress negative T outputs, i.e., some columns of SF k−1 are zero column vectors. Following the criterion established in [8, Section 5.2]: T
– If D1 and D2 correspond to the same neuron, rank(SF k−1 ) < |Λ1 ∪ Λ2 |. T – If D1 and D2 correspond to different neurons, rank(SF k−1 ) = |Λ1 ∪ Λ2 |. By systematically evaluating this rank condition, the attacker can cluster all sampled dual points. 3.2
Limitations in Black-box Setting
While the extraction framework proposed by Carlini et al. [8] operates in polynomial time in theory, applying it in a strictly black-box setting presents practical bottlenecks due to the clustering step [8, Section 7.1]. In contrast, the other phases of the attack were optimized and empirically viable in the black-box setting. According to [8], when utilizing a 256-core server with GPU support to recover a 3072-256×3-64-10 DNN with four hidden layers, trained on CIFAR-10, finding the dual points (accelerated by computing gradients symbolically rather than via black-box binary search) and unifying the corresponding dual spaces took approximately 16 hours, while the sign recovery phase was heavily parallelized, requiring only 8.5 hours. Consequently, the clustering becomes the bottleneck of the black-box model extraction attack. The procedure involves two main computational costs: 1. Pairwise Comparisons: Clustering n collected dual points requires O(n2 ) independent invocations of the ISCONSISTENT algorithm.
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
13
2. Rank Computation: Each ISCONSISTENT call computes the rank of the T (m1 + m2 ) × d(k) projected matrix SF k−1 , where m1 and m2 are slightly (k) larger than d (according to Eq. (17)). Consequently, performing Singular Value Decomposition (SVD) on this matrix costs O((d(k) )3 ). Multiplying these factors, the overall time complexity of Carlini et al.’s clustering phase [8] is bounded by: O(n2 · (d(k) )3 ).
(19)
For deeper layers, recovering near-dead neurons typically requires millions of dual points. Therefore, the black-box extraction becomes extremely time-consuming.
4
Improving Clustering: Approximate Signature Method
4.1
Approximate Signature Vector
The decision boundary bends precisely when a neuron alters its activation state, marking a nonlinear transition between continuous zero state (inactivated) and linear non-zero state (activated) occurs. Consequently, the difference between the normal vectors of the two adjacent decision boundary patches reveals critical information about the underlying neuron’s weight. This difference allows us to identify the target neuron from a single dual point, thereby accelerating the clustering step. Recall Eq. (14) and denote the row vectors ⃗ l = (Gk+1 − Gk+1 )I (k) A(k) , G + i j
⃗ r = (Gk+1 − Gk+1 )I (k) A(k) . G − i j
(20)
⃗ l and G ⃗ r is the effective weight Then the difference between the row vectors G ⃗ l −G ⃗ r = gt A(k) vector of the target neuron t, scaled by a constant factor gt , i.e., G t . ⃗ l and G ⃗ r also ⃗ l and G ⃗ r up to a scalar. Note that the vectors G Compute G correspond to the normal vectors of the decision boundary patches on the left (activated) and right (inactivated) sides of the critical hyperplane, respectively. Since we are operating in the hard-label setting, the exact magnitudes of the ⃗ l and G ⃗ r are inaccessible. Specifically, starting from a point on the gradients G (1) decision boundary (e.g., Xlef t ), we introduce a small perturbation ⃗δ+ such that (1) X + ⃗δ+ deviates from the decision boundary. We then perform a binary search lef t
along another direction to find the exact displacement ⃗δ− required to return to (1) the decision boundary, ensuring that the point Xlef t + ⃗δ+ + ⃗δ− is in the decision (1) (1) boundary. Note that both Xlef t + ⃗δ+ and Xlef t + ⃗δ+ + ⃗δ− should remain on the left of the critical hyperplane. According to Eq. (9), we have: (k)
(1)
(k)
(1)
(Gk+1 − Gk+1 )I+ (A(k) (F k−1 Xlef t + B k−1 ) + B (k) ) + Bik+1 − Bjk+1 = 0, i j
(Gk+1 − Gk+1 )I+ (A(k) (F k−1 (Xlef t + ⃗δ+ + ⃗δ− ) + B k−1 ) + B (k) ) + Bik+1 − Bjk+1 = 0. i j
(21)
14
Z. Chen et al.
Subtracting the first equation from the second, we have: (k)
(Gk+1 − Gk+1 )I+ A(k) F k−1 (⃗δ+ + ⃗δ− ) = 0. i j
(22)
By sampling m different displacement vectors ⃗δℓ− (0 ≤ ℓ ≤ m, m is slightly T − larger than d(k) ), and denote S = ⃗δ+ + ⃗δ0− , ⃗δ+ + ⃗δ1− , · · · , ⃗δ+ + ⃗δm , we can construct the following homogeneous system of linear equations: T
(k)
SF k−1 · ((Gk+1 − Gk+1 )I+ A(k) )T = 0. i j
(23)
Note that the mapped difference vectors {F k−1 (⃗δ+ + ⃗δℓ− )}0≤ℓ≤m span at most a (d(k) − 1)-dimensional subspace, the linear system has a unique non-trivial solution up to a scaling factor. Solving the linear system and normalizing the ⃗l G solution, we extract its unit normal row vector: ⃗nl = ∥G ⃗ ∥ . A similar procedure l
⃗
r is applied to the right patch to compute ⃗nr = ∥G ⃗ r∥ . G Consequently, the effective weight vector can be expressed as a linear combination of the observed unit normal vectors:
(k)
gt At
⃗ l ∥ · ⃗nl − ∥G ⃗ r ∥ · ⃗nr . = ∥G
(24)
Definition 13. (Approximate Signature Vector, ASV) Given ⃗nl , ⃗nr , the approximate signature vector (ASV) ⃗v is defined as: ⃗v = ⃗nl − (⃗nl · ⃗nT nr . r )⃗
(25)
(k)
1 ⃗ r ∥⃗nr ). Since ⃗nr ⃗nT Let ω ⃗ = gt At . Then, ⃗nl = ∥G ω +∥G r = 1, Eq. (25) becomes ⃗ ∥ (⃗ l
⃗v =
1 1 ⃗ r ∥⃗nr ) − 1 ((⃗ ⃗ r ∥⃗nr )⃗nT (⃗ ω + ∥G ω + ∥G nr = (⃗ ω − (⃗ ω · n⃗r T )n⃗r ), r )⃗ ⃗ ⃗ ⃗ ∥Gl ∥ ∥Gl ∥ ∥Gl ∥ (26)
Cosine Similarity between ASV ⃗ v and Neuron Weight ω ⃗ . Eq. (26) demonstrates that the ASV ⃗v deviates from the exact scaled weight ω ⃗ solely by the term (⃗ ω · ⃗nT )⃗ n . We argue that in practical DNNs, it is small enough to r r make ⃗v become a highly reliable directional proxy for the true weight ω ⃗ . To effectively measure the precision of this directional alignment, we employ the cosine similarity cos φ⃗v,⃗ω . Specifically, we measure the directional distance DGap(⃗v , ω ⃗) of ⃗v , ω ⃗ by the following cosine distance DGap(⃗v , ω ⃗ ) = 1 − |cos φ⃗v,⃗ω | = 1 −
|⃗v · ω ⃗ T| , ∥⃗v ∥ · ∥⃗ ωT ∥
(27)
where DGap(⃗v , ω ⃗ ) approaching 0 (abbreviated as DGap(⃗v , ω ⃗ ) → 0) indicates that the ASV ⃗v and the neuron weight w ⃗ are nearly identical in direction.
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
15
White-box Experiment for Verification of DGap(⃗ v, ω ⃗ ) → 0. Our experiment targets a CIFAR-10 trained DNN with the architecture (3072 − 256 × 3 − 64 − 10), identical to the model introduced by Carlini et al. in [8] (hereafter referred to as 3072-DNN). This network features 3,072 inputs and four fullyconnected ReLU layers (the first three hidden layers contain 256 neurons each, while the fourth layer contains 64 neurons). We randomly sample 1,000 dual points across the input space. For each point, we compute its ASV ⃗v and calculate the DGap between ⃗v and the ground-truth weights of all neurons within the same layer. As shown in Fig. 4, the resulting distributions exhibit a clear and strict separation: the cosine distance between an ASV and its corresponding target neuron tightly clusters near 0, while the distances to all other non-target neurons consistently concentrate approach 1. Since we do not rely on the ASV ⃗v as the final extracted weight, the cosine distance achieving under 0.1 is sufficient for it to serve as a reliable proxy.
Percentage of Pairs
ASV v vs. target neuron's w
Layer 1
100% 75% 50% 25% 0%
10 4
10 2
ASV v vs. non-target neuron's w
Layer 2
100
80% 60% 40% 20% 0%
10 4
10 2
Layer 3
100
80% 60% 40% 20% 0%
Layer 4
80% 60% 40% 20%
10 4
10 2
100
0%
10 4
10 2
100
Cosine Distance DGap (log scale)
Fig. 4: Distribution of the Cosine Distance (DGap) between ASV (⃗v ) and all neuron weights (w) ⃗ across DNN layers
Theoretical Explanation of DGap(⃗ v, ω ⃗ ) → 0. To explain why the cosine distance between ⃗v and ω ⃗ approaches zero, we derive their similarity in two steps. 1. Formulating the Cosine Similarity. Since the cosine similarity cos φ⃗v,⃗ω = ⃗ v ·⃗ ωT v as follows: ∥⃗ v ∥∥⃗ ω ∥ , We compute the inner product and the norm of ⃗ T 1 1 2 ω ⃗ − (⃗ ω · ⃗nT nr · ω ⃗ = ∥⃗ ω ∥2 − (⃗ ω · ⃗nT , (28) r )⃗ r) ⃗ l∥ ⃗ l∥ ∥G ∥G s q √ 1 1 2) = 2 ∥⃗v ∥ = ⃗v · ⃗v T = (∥⃗ ω ∥2 − (⃗ ω · ⃗nT ∥⃗ ω ∥2 − (⃗ ω · ⃗nT ) r r) . ⃗ l ∥2 ⃗ l∥ ∥G ∥G
⃗v · ω ⃗T =
(29)
Substituting these into the definition of cosine similarity, the unknown scal1 ing factor ∥G ⃗ l ∥ perfectly cancels out, yielding a graceful reduction: s 2 2 ∥⃗ ω ∥2 − (⃗ ω · ⃗nT ) ω ⃗ · ⃗nT r r cos φ⃗v,⃗ω = p = 1− . (30) 2 ∥⃗ ω∥ ∥⃗ ω ∥2 − (⃗ ω · ⃗nT ω∥ r ) · ∥⃗
16
Z. Chen et al. ω ⃗ ·⃗ nT
Eq. (30) reveals that the deviation of cos φ⃗v,⃗ω from 1 is governed by ∥⃗ω∥r . T
ω ⃗ ·⃗ n ⃗ r from Eq. (20). The diago2. The error term ∥⃗ω∥r . Recall the definition of G (k)
nal activation matrix I− explicitly zeroes out the t-th diagonal entry (since ⃗ r , and its normalized counneuron t is inactive). Consequently, the vector G terpart ⃗nr , lie entirely within the subspace spanned by the weights of the other active neurons. We can formally express ⃗nr as a linear combination: ⃗nr =
X X 1 1 gs τs(k) A(k) gs A(k) s = s . ⃗ ⃗ ∥Gr ∥ s̸=t, 0≤s≤d(k+1) ∥Gr ∥ s∈K\{t}
(31)
where K contains the indices of all active neurons at layer k. The magnitude of the error term directly depends on the inner product: (k) ω ⃗ ·⃗nTr = gt At ·
1 X ⃗ r∥ ∥G
T gs A(k) s
s∈K\{t}
(k)
Let φt,s denote the angle between At ω ⃗ ·⃗ nT r
(k)
=
X T gt (k) . (32) gs At · A(k) s ⃗ ∥Gr ∥ s∈K\{t} (k)
(k)
(k) T
and As , i.e., At · As
∥As ∥ cos φt,s , then ∥⃗ω∥ can be rewritten as: (k)
gt ∥At ∥ ω ⃗ · ⃗nTr = ∥⃗ ω∥ ∥⃗ ω∥
P
(k) s∈K\{t} gs ∥As ∥ cos φt,s
⃗ r∥ ∥G
(k)
= ∥At ∥ ·
(k) s∈K\{t} gs ∥As ∥ cos φt,s . P (k) ∥ s∈K\{t} gs As ∥
P =
(33)
Near-Orthogonality in High-Dimensional Weight Spaces. ω ⃗ ·⃗ nT
Observation 1. We argue that ∥⃗ω∥r approaches 0 since each cos φt,s Eq. (33) (k)
is close to 0, i.e., the angle between At
(k)
and As
approaches π/2.
(k) In high-dimensional feature spaces, arbitrarily different row vectors At and (k) As are nearly orthogonal. This property is supported by two fundamental char-
acteristics of DNNs and we will verify it in our subsequent experiment. 1. High-Dimensional Randomness: Under standard initialization schemes (e.g., He [17] or Glorot [16] initialization), the initial weight vectors are independently sampled. In a high-dimensional space (d ≫ 1), independently drawn random vectors are mutually orthogonal with overwhelming probability [33, Chapter 3.2, Remark 3.2.5]: “ Independent isotropic random vectors tend to be almost orthogonal in high dimensions but not in low dimensions.” 2. Feature Decoupling in Trained Models: During the optimization process, to maximize the network’s expressive capacity, distinct neurons learn to extract divergent and disentangled features [3, Section 11.4]. Geometrically, this disentanglement, which emerges naturally from gradient descent
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
17
dynamics that align neurons with the orthogonal singular directions of the data [22,30], manifests as near-orthogonality between neuron weight vectors. (k) Therefore, the cosine similarity between two distinct trained neurons At (k) and As tends to be distributed around 0. Experimental Verification of the Cosine similarities. For each layer of the target 3072-DNN, we compute the pairwise cosine similarities | cos φt,s | be(k) (k) tween all pairs of distinct neurons’ weights At and As . The results presented in Tab. 2 demonstrate that the cosine similarities across different neurons remain tightly concentrated around 0, confirming the near-orthogonality. Fig. 11 in Supp. C also shows a detailed distribution of these cosine similarities.
Table 2: Cosine similarity statistics for pairwise neuron combinations. µ, and σ denote the mean and standard deviation of absolute cosine similarity. Layer
d(k) × d(k−1)
Pairs
µ
σ
fc1 fc2 fc3 fc4
256 × 3072 256 × 256 256 × 256 64 × 256
32640 32640 32640 2016
0.0413 0.0844 0.0679 0.0689
0.0458 0.0626 0.0492 0.0497
4.2
Consistency Check using ASVs
If two dual points belong to the same neuron, the directional gap (DGap) between their ASVs (denoted as ⃗v1 and ⃗v2 ) and the ground-truth weight ω ⃗ both approach 0. According to the triangle inequality for spatial angles [5, Chapter I.1], 0 ≤ φ⃗v1 ,⃗v2 ≤ φ⃗v1 ,⃗ω + φ⃗v2 ,⃗ω .
(34)
Since both φ⃗v1 ,⃗ω and φ⃗v2 ,⃗ω approach 0, we can deduce that φ⃗v1 ,⃗v2 also approaches 0. Consequently, we have Property 3. (Parallel ASVs) If two dual points belong to the same neuron, their corresponding approximate signature vectors ⃗v1 and ⃗v2 will be nearly identical or opposite (both are nearly collinear with the underlying weight vector ω ⃗ ). Therefore, their consistency score is bounded by a small threshold τ : consistency score = DGap(v⃗1 , v⃗2 ) = 1 − |cos φ⃗v1 ,⃗v2 | = 1 −
|⃗v1⃗v2T | < τ. (35) ∥⃗v1 ∥∥⃗v2 ∥
Immunity to Activation State Blindness. One potential concern in the hard-label setting is the inability to directly observe the activation states of the (1) (1) patches Xlef t and Xright . Given a dual point, we can extract two distinct normal
18
Z. Chen et al.
vectors from its adjacent patches as ⃗n1 and ⃗n2 , but we cannot ascertain which corresponds to the activated normal ⃗nl and which to the inactivated normal ⃗nr . To bypass this ambiguity, we symmetrically compute two Approximate Signature Vectors (ASVs) for each dual point: ⃗v = ⃗n1 − (⃗n1 · ⃗nT n2 , 2 )⃗
⃗v ′ = ⃗n2 − (⃗n2 · ⃗nT n1 . 1 )⃗
(36)
Given two distinct dual points, we obtain two pairs of ASVs: (⃗v1 , ⃗v1′ ) and (⃗v2 , ⃗v2′ ). To determine if these two dual points belong to the same neuron, we evaluate the consistency score DGap(·, ·) across all possible cross-combinations. The final consistency score S between the two dual points is defined as the minimum value among these combinations: n o S = min DGap(⃗v1 , ⃗v2 ), DGap(⃗v1 , ⃗v2′ ), DGap(⃗v1′ , ⃗v2 ), DGap(⃗v1′ , ⃗v2′ ) . (37) Since the ASVs closely approximate the true target weight, the correct pairing will minimize the score S, effectively resolving the activation state blindness. Experiments on Consistency Verification. We evaluate the consistency of two dual spaces by extracting the their unit normal vectors ⃗nl and ⃗nr from the decision boundary patches, computing the ASV ⃗v , and calculating the consistency score S. To verify the practical performance, we conducted an experiment on 3072-DNN. As illustrated in Fig. 5, evaluating the consistency score on pairs of dual points corresponding to the same neuron yields a significantly different distribution compared to pairs originating from different neurons. This separation on distribution demonstrates that the ASV-based metric provides a reliable criterion for clustering dual points. Consistent Pairs: same neuron Percentage of Pairs
Layer 1
Inconsistent Pairs: different neurons
Layer 2
Layer 3
Layer 4
30% 80% 40% 40% 60% 30% 20% 40% 20% 20% 10% 20% 10% 0% 0% 0% 0% 0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00
Consistency Score (S)
Fig. 5: Distribution of the Consistency Scores (s) of ASV pairs from the same versus different neurons across DNN layers
Remark on The Choice of the Small Threshold τ . As shown in Fig. 5, the small threshold τ serves as a separation boundary between the distributions of consistent and inconsistent pairs. An excessively large τ admits false positives (dual
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
19
points from different neurons are clustered together), whereas an overly strict τ yields false negatives (dual points from the same neuron are assigned to different clusters). In practice, τ can be determined empirically. We first experiment on a small subset of dual points with a slightly larger threshold, and then apply Carlini et al.’s robust rank-based method [8] to detect any false positives. This feedback allows us to adjust τ to an optimal value for the full dataset. 4.3
Improved Clustering Step Based on ASV method
Step 1. Filtering and ASV Extraction. Given a collection of dual points, we first filter out any points belonging to previous layers. For each remaining point, we compute the unit normal vector ⃗nl and ⃗nr of its adjacent decision boundary patches, then calculate the ASV ⃗v = ⃗nl − (⃗nl · ⃗nT nr . r )⃗ Step 2. Seed Selection and Similarity Matching. We randomly select a unclustered dual point from the candidate set, and compare it with all other points using our proposed collinearity-based ASV method (Eq. (35)). Step 3. Cluster and Remove. All dual points that yield a consistency score that sufficiently close to 0 are grouped into the same cluster as the seed. Once clustered, these points are strictly removed from the candidate pool. We then iteratively repeat Step 2, selecting a new seed from the shrinking pool, until all dual points are successfully partitioned. Remarks. Our improved algorithm successfully eliminates the prohibitive O(n2 (d(k) )3 ) bottleneck of the naive rank-based method. The computational cost is split into two distinct phases: – ASV Extraction (Step 1): Computing the normal vectors requires solving local linear equations, taking O((d(k) )3 ) operations per point. For n dual points, this preprocessing strictly bounds to O(n(d(k) )3 ). – Similarity Matching (Step 2): Replacing SVD with vector inner products drastically reduces the pairwise comparison cost to O(d(k) ). The worst-case matching scales as O(n2 d(k) ). In average case, we assume the n points are uniformly distributed across d(k) hidden neurons, each neuron corresponds to a cluster of approximately n/d(k) points. The clustering procedure effec Pd(k) −1 n = O(nd(k) ) pairwise tively proceeds in d(k) rounds with i=0 n − i d(k) (k) comparisons. Since each comparison takes O(d ) operations, this lowers the overall average-case time complexity to O(nd(k) · d(k) ) = O(n(d(k) )2 ). Consequently, our method successfully reduces the overall average-case time complexity from the original O(n2 (d(k) )3 ) down to O(n(d(k) )3 ), with the computational cost now dominated by the ASV extraction phase.
20
Z. Chen et al.
Experimental Comparison between Carlini et al.’s Clustering and our ASV Method. We compare our ASV method with Carlini et al.’s rank-based SVD clustering method [8] on the 3072-DNN. We evaluate both methods on sets of 100, 200, 500, 1000, and 2000 dual points. Hence this set comprises dual points of different neurons across layers. We record the runtime and accuracy, including false positives (dual points from different neurons being mistakenly clustered together) and false negatives (dual points belonging to the same neuron failing to be clustered). Note that, due to the substantial runtime overhead of Carlini 3 et al.’s method during the clustering phase in O(n2 d(k) ), we only run their algorithm up to 200 dual points. For larger sets, their clustering performances are estimated, denoted by “≈” as shown in Tab. 3.
Table 3: Comparison of clustering methods for layer 1. T denotes the computational runtime in seconds; n represents the number of accumulated dual points; Pfp is the false positive rate; Pfn is the false negative rate. n
Approach
T (s)
Queries
Comparisons
Pfp
Pfn
2 26.9
17.2
2 213.7
13.3
100
Carlini’s Ours
15.3
2 212
0% 0%
0% 0%
200
Carlini’s Ours
216.6 28
218.5 214.7
215.3 214.1
0% 0%
0% 0%
500
Carlini’s Ours
≈ 219.9 29.4
-
≈ 217.9 216.8
5.5%
0%
1000
Carlini’s Ours
≈ 221.9 210.6
2
≈ 219.9 218.7
1%
0%
2000
Carlini’s Ours
≈ 223.9 211.9
218
≈ 221.9 220.6
0.4%
0%
16
2
17
Remarks: Refining Clusters after ASV-Clustering 1. False Positive. As shown in Tab. 3, although the dual points are partitioned into distinct clusters, each group may contain a minor fraction of false positives. Since the number of candidate points assigned to each cluster is relatively small, we leverage the rank-based method proposed by Carlini et al. [8] to filter them out. 2. False Negative. In a small fraction of cases, a few dual point pairs from the same deep-layer neuron exhibit relatively high consistency scores, rendering them indistinguishable from different-neuron pairs under this metric. After successfully solving the shallower layers using the ASV method and clustering the majority of the dual points, the remaining pool of unclustered points is substantially reduced. For this residual set, we revert to the more robust rank-based consistency checking method proposed by Carlini et al. [8] to ensure an accurate final clustering.
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
5
21
Simple ASV Method in Hard-Label CNN
Our ASV-based hard-label attack on max-pooling CNNs is based on Zirui Chen et al.’s raw-output attack [12]. Recall from Sect. 3.1 that the dual points simultaneously satisfy the conditions of residing on both the decision boundary and the critical hyperplane. Consequently, they lie exactly at the intersection between the critical hyperplane and its two adjacent decision boundary patches. In the context of hard-label CNNs, similar to Eq. (9), the input X (1) corresponding to a point on the decision boundary satisfies the property that )P (k) I (k) (A(k) X (k) + B (k) ) + Bik+1 − Bjk+1 = 0. − Gk+1 Fi (X (1) ) − Fj (X (1) ) = (Gk+1 j i (38)
Then we can define the Dual RPCP and Dual PSP in a similar way. Definition 14. (Dual ReLU-Pooling Critical Point, Dual RPCP) Dual ReLU-Pooling Critical Points are located at the intersection of a critical hyperplane of RPCPs and the decision boundary patches on both sides. Consequently, Dual RPCPs fulfill the properties of both decision boundary points and RPCPs (Eq. (38) and Property 1). Like Def. 12 in FCNNs, the Dual RPCP Space is defined as the subspace spanned by Dual RPCPs corresponding to the same neuron and the same decision boundary. Suppose that a Dual RPCP X (1) corresponds to the t-th neuron in the k-th layer, covered by the u-th pooling window. Since the value of the neu(k) (k) ron t is 0, the corresponding activation matrix can be either I+ or I− , differing (k) (k) only at the t-th diagonal entry (e.g., 1 in I+ and 0 in I− ). By subtracting the corresponding Eq. (38), we have (k)
(k)
(Gk+1 − Gk+1 )P (k) (I+ − I− )(A(k) X (k) + B (k) ) = 0. i j
(39)
For any Dual RPCP X (1) and X ′(1) sampled from the same Dual RPCP Space, by subtracting the corresponding Eq. (39), we have (k)
(k)
(Gk+1 − Gk+1 )P (k) (I+ − I− )A(k) F k−1 (X (1) − X ′(1) ) = 0. i j
(40)
According to Eq. (64) in Supp. A.1, if the neuron t is selected by the u-th pooling (k) window, the u-th row vector Pu of the pooling matrix P (k) contains a “1” at its (k) (k) t-th position and “0”s elsewhere. The term I+ − I− yields a diagonal matrix with a single non-zero entry (value 1) at the entry (t, t), effectively acting as a (k) (k) selection operator. Consequently, the product P (k) (I+ − I− ) extracts the t-th column of the pooling matrix P (k) . Since neuron t is covered by exactly one pooling window, this t-th column contains a single “1” at its u-th row. Let the row vector Gk+1 − Gk+1 = (g1 , g2 , · · · , gd(k+1) ). Then, we have: i j (k)
(k)
(k)
(Gk+1 − Gk+1 )P (k) (I+ − I− )A(k) = gu At . i j
(41)
22
Z. Chen et al.
Let ⃗δ = X (1) − X ′(1) , Eq. (40) can be simplified as: (k)
gu At F k−1⃗δ = 0.
(42)
By sampling m directions S = (⃗δ0 , ⃗δ1 , · · · , ⃗δm−1 )T from the same Dual RPCP (k) Space, we can construct a system of equations and recover gu At . Specifically, (k) T
T
SF k−1 gu At
= 0.
(43)
Definition 15. (Dual Pooling Switching Point, Dual PSP) Dual Pooling Switching Points are located at the intersection of a critical hyperplane of PSPs and the decision boundary patches on both sides. Thus, Dual PSPs fulfill the properties of both decision boundary points and PSPs (Eq. (38) and Property 2). Similarly, Dual PSP Space is defined as the subspace spanned by Dual PSPs corresponding to the same two competing neurons and the same decision boundary. Assume that the u-th (0 ≤ u ≤ d(k+1) − 1) pooling window includes neurons p and q (p < q) whose input values are Y (k) [p] and Y (k) [q] respectively, and that they share the same maximum value. According to Eq. (64) in Supp. A.1, (k) each row Pu of the pooling matrix P (k) contains a single “1” to indicate the selection of the maximum value for the u-th pooling window. Specifically, if the p-th neuron is selected, the row is (0 · · · 0, 1p , 0 · · · 0). Since Y (k) [p] = Y (k) [q], the max pooling can arbitrarily select either neuron p or neuron q without altering its output. We can represent these two equivalent selecting operations using two (k) (k) distinct pooling matrices, P+ and P− , which differ only in their u-th row. (k) (k) Specifically, in P+ , this row is (0 · · · 0, 1p , 0 · · · 0, 0q , 0 · · · 0), while in P− , the same row becomes (0 · · · 0, 0p , 0 · · · 0, 1q , 0 · · · 0). Consequently, the pooling ma(k) (k) (k) (k) trix can be either P+ or P− . By substituting P+ and P− into Eq. (38) respectively and subtracting the two resulting equations, we have (k)
(k)
(Gk+1 − Gk+1 )(P+ − P− )I (k) (A(k) X (k) + b(k) ) = 0. i j
(44)
For any Dual PSP X (1) and X ′(1) sampled from the same Dual PSP Space, like Eq. (13) in DNN, subtracting the corresponding Eq. (44), we have (k)
(k)
(Gk+1 − Gk+1 )(P+ − P− )I (k) A(k) F k−1 (X (1) − X ′(1) ) = 0. i j (k)
(45)
(k)
Note that the u-th row of P+ − P− is (0 · · · 0, 1p , 0 · · · 0, −1q , 0 · · · 0), and the other rows are zero vectors; Gk+1 − Gk+1 is a row vector denoted as (g1 , g2 , · · · , i j gd(k+1) ), then (k)
(k)
(k) (Gk+1 − Gk+1 )(P+ − P− )I (k) A(k) = gu (A(k) p − Aq ), i j
(46)
Let ⃗δ = X (1) − X ′(1) , Eq. (45) can be simplified as: (k) k−1⃗ gu (A(k) δ = 0. p − Aq )F
(47)
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
23
By sampling n distinct directions S = (⃗δ0 , ⃗δ1 , · · · , ⃗δn−1 )T from the same Dual (k) (k) PSP Space, we can construct a system of equations and recover gu (Ap − Aq ): T
(k) SF k−1 · gu (A(k) p − Aq ) = 0.
(48)
We refer to Dual RPCPs and Dual PSPs as Dual Points in CNNs, and denote their corresponding Dual RPCP and Dual PSP Spaces simply as the Dual Spaces. Clustering Step of the Simple ASV Method. With a single dual space, neither the linear system defined in Eq. (43) for Dual RPCPs, nor the system in Eq. (48) for Dual PSPs yields a unique non-trivial solution (even up to a scalar multiple). The underlying reason is identical to that discussed in Sect. 3.1: restricted to a single dual space, the internal differential vector F k−1⃗δ = X (k) − X ′(k) is confined to a subspace of dimension at most d(k) − 2, thereby leaving the linear system with at least two degrees of freedom. Consequently, we have to collect a diverse set of dual points and cluster them into distinct groups. Fortunately, our ASV method can also be applied to this task. 1. For Dual RPCPs, denote row vectors (k) ⃗ l = (Gk+1 G − Gk+1 )P (k) I+ A(k) , i j
(k) ⃗ r = (Gk+1 G − Gk+1 )P (k) I− A(k) . i j
(49)
(k)
Recall from Eq. (41) that, the scaled row vector gu At of the convolutional ⃗l − G ⃗ r. ⃗ l and G ⃗ r , i.e., gu A(k) =G matrix A(k) , is the difference between G t 2. Similarly, for Dual PSPs, denote row vectors (k) ⃗ l = (Gk+1 G − Gk+1 )P+ I (k) A(k) , i j
(k) ⃗ r = (Gk+1 G − Gk+1 )P− I (k) A(k) . i j
(50) (k)
Recall from Eq. (46) that, the difference of the scaled row vectors gu (Ap − (k) (k) ⃗ ⃗ ⃗ l and G ⃗ r , i.e., gu (A(k) Aq ), is the difference between G p − Aq ) = Gl − Gr . Note that the algebraic formulation above is structurally identical for both types of dual points. For any dual point in a hard-label CNN (including both Dual RPCPs and Dual PSPs), we can compute the unit normal vectors of the ⃗l ⃗r G adjacent decision boundary patches as ⃗nl = ∥G n r = ∥G ⃗ ∥ and ⃗ ⃗ ∥ . The ASV in G r
l
the hard-label CNN is then similarly defined by Eq. (25). (k) ⃗l −G ⃗ r be the neuron weight (gu A(k) Let ω ⃗ =G for Dual RPCPs, or gu (Ap − t (k) 1 ω −(⃗ ω ·⃗nT Aq ) for Dual PSPs). Then, Eq. (25) becomes ⃗v = ∥G nr ). Similarly, r )⃗ ⃗ ∥ (⃗ l
we measure the directional distance DGap(⃗v ,⃗ ω ) between ⃗v and ω ⃗ by Eq. (27). According to our experiments given in Supp. E.1, the DGap(⃗v ,⃗ ω ) is close to 0. Neuron-Centric Consistency Check Using ASVs in Hard-label CNN. Two dual points in hard-label CNN are consistent if and only if they satisfy one of the following conditions: – Both points are Dual RPCPs, and they correspond to the same neuron t.
24
Z. Chen et al.
– Both points are Dual PSPs, and they correspond to the exact same pair of competing neurons (p, q) within a pooling window. We refer to this strict alignment as neuron-centric clustering. When two dual points are consistent, the directional distances DGap between their respective ASVs (denoted as ⃗v1 and ⃗v2 ) and the ground-truth weight ω ⃗ both approach 0. Consequently, we can evaluate the consistency between two dual points by calculating the DGap between ⃗v1 and ⃗v2 according to Eq. (35). According to our experiments given in Supp. E.2, the DGap(⃗v1 ,⃗v2 ) is close to 0 when (⃗v1 ,⃗v2 ) is consistent, otherwise close to 1.
6
Advanced ASV Method in Hard-Label CNN
6.1
Limitations of Simple ASV Method in CNN
Recall from the Clustering step in Sect. 5 that the clustering principle is to ensure the linear system—whether constructed from Eq. (43) for Dual RPCPs or Eq. (48) for Dual PSPs—admits a unique non-trivial solution (up to a scalar factor). Consequently, to successfully resolve the linear system in CNNs, we must collect at least two dual points belonging to the exact same category, i.e., the “neuron-centric clustering”. Specifically, we require at least two Dual (k) RPCPs associated with the same t-th neuron to recover the scaled vector gu At ; similarly, we need at least two Dual PSPs corresponding to the exact same competing pair of neurons (p, q) within the same u-th pooling window to recover (k) (k) the scaled difference gu (Ap − Aq ). Consider a toy layer configuration with all symbols given in Fig. 1 and Supp. (k) (k) 3 A : the input matrix IN (k) has dimensions hin × win = 8 × 8 (i.e., d(k) = (k) (k) (k) 64). Apply a hc × wc = 3 × 3 convolutional kernel with stride sc = 1 to (k) (k) (k) produce an output matrix O(k) of dimension ho × wo = 6 × 6 (i.e., df = 36). (k)
(k)
(k)
Subsequently, a hm ×wm = 2×2 max pooling with stride sρ = 2 results in the next layer’s input IN (k+1) with dimensions of 3 × 3 (i.e., d(k+1) = 9). Under this (k) setup, there are exactly df = 36 distinct types of Dual RPCPs (corresponding to 36 neurons). For Dual PSPs, since each 2 × 2 pooling window contains 42 = 6 (k) (k) possible competing neuron pairs, there are in total d(k+1) × hm 2·wm = 9×6 = 54 distinct types of Dual PSPs across the k-th layer. If the clustering process is strictly neuron-centric—treating each of these 36+ 54 = 90 categories as completely independent—then according to the Pigeonhole Principle, in the worst case, an attacker might collect 90 distinct dual points without ever finding two points in the same category. Thus, one must query at least 91 dual points merely to guarantee the construction of a single solvable (k) (k) (k) linear system for just one localized neuron (e.g., At or Ap − Aq ). Although all 90 dual points share the same convolutional kernel, isolated linear systems fail to jointly utilize them, thereby wasting most of the extracted 3
The readers are suggested to read Supp. A.2 to better understand all the symbols.
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
25
information. Note that, the extraction processes introduced by Carlini et al. [8] and Sun et al. [31] are both “neuron-centric”. This severe inefficiency naturally raises a critical question: Can we establish a “kernel-centric” clustering and recovery framework that exploit the weight sharing property in CNN, rather than treating each neuron independently? 6.2
Kernel-Centric Clustering and Model Extraction from ASV (k)
According to Eq. (58) in Supp. A.1, Ai is a sparse vector which only contains non-zero entries at the indices where the convolutional kernel is applied. This sparsity allows us to explicitly extract the positional indices of the convolutional kernel’s local receptive field (LRF-C)—defined as the specific sub-matrix of the input matrix IN (k) , which is multiplied by the kernel matrix C (k) according to ⃗ (k) = (C (k) , C (k) , . . . , C (k) Supp. A.1. Denote the vector form of C (k) as C )T . (k) 0 1 hc −1
(k) ⃗ (k) is lc(k) = h(k) Thus, the length of the vector C c wc . Assume that the stride (k) (k) sc = 1, and let Kt ⊂ {0, 1, . . . , d(k) − 1} denote the set of indices belonging (k) to the LRF-C of the t-th neuron (0 ≤ t ≤ df − 1), then (k)
Kt
:=
t s (k) (k) (k) (k) win · · + t mod w + w + s mod w , 0 ≤ s < l . c o c in (k) (k) wo wc (51)
(k) (k) For Dual RPCPs, recall from Eq. (42) that gu At F k−1⃗δ = 0, the set Kt picks (k) out the nonzero entries of At according to Eq. (58). Then, (k) ⃗ (k) (F k−1⃗δ)[Kt(k) ] = 0. gu At (F k−1⃗δ) = gu C
(52)
(k)
Denote an empty set K∅ = ∅, then Eq. (52) can be rewritten as: (k) ⃗ (k) ((F k−1⃗δ)[Kt(k) ] − (F k−1⃗δ)[K(k) ]) = 0. gu At (F k−1⃗δ) = gu C ∅ (k)
(k)
(53) (k)
For Dual PSPs, recall from Eq. (47) that gu (Ap − Aq )F k−1⃗δ = 0, the set Kp (k) (k) (k) and Kq picks out the nonzero entries of Ap and Aq respectively. Then,
(k) k−1⃗ ⃗ (k) · ((F k−1⃗δ)[K(k) ] − (F k−1⃗δ)[K(k) ]) = 0. (54) gu (A(k) δ) = gu C p − Aq )(F p q
From a collection of dual points, if we can recognize Dual RPCPs and Dual PSPs, and identify the neuron t from Dual RPCPs and the competing neurons p and q from Dual PSPs, then we can calculate F k−1⃗δ where F k−1 denotes the known previous k − 1 layers and ⃗δ are randomly selected by the attackers, and construct a linear system combining Eqs. (53) and (54). Then we solve the linear ⃗ (k) up to a scalar multiple. system using the SVD method to recover C
26
Z. Chen et al.
Identifying Dual RPCPs and Dual PSPs. Chen et al. introduced the identification method for RPCPs and PSPs in a raw-output CNN [12], based on the (k) (k) (k) structural sparsity of ω ⃗ = At (or ω ⃗ = Ap − Aq ), according to Eq. (58) in Supp. A.1. In hard-label CNN, the identification relies on the approximate sig(k) nature vector ⃗v , which closely aligns with the underlying weight vector At (for (k) (k) Dual RPCPs) or the weight difference Ap − Aq (for Dual PSPs). Most importantly, ⃗v strictly preserves the structural sparsity due to the localized connectivity of CNNs. This allows us to verify dual points and identify the corresponding neurons by examining the consistency of their sparsity. Experiment Verification of Sparsity Alignment between ⃗v and ω ⃗ . Targeting a (2 + 1) CNN, we collect a set of 1000 dual points and compute their ASVs ⃗v . If ⃗v can serve as a reliable proxy for the ground-truth vectors ω ⃗ in identifying Dual RPCPs and Dual PSPs, the positions where ω ⃗ is exactly 0 should also remain 0 in ⃗v . This sparsity alignment guarantees that ⃗v preserves the structural identity (k) (k) (k) of either the neuron weight vector (At ) or the difference vector (Ap −Aq ). To quantify this zero-position fidelity, we extract the absolute values of our ASVs ⃗v at the indices where their corresponding ground-truth vectors ω ⃗ are 0. Our statistical analysis across all 1000 dual points evaluates the distribution of these theoretically inactive entries. As summarized in Table 4, the element-wise noise is small enough to recognize the sparse structure across both convolutional layers.
Table 4: Statistics of element-wise noise at the theoretical zero-positions. Layer Conv1 Conv2
valid duals
max
min
mean
789 149
−4.81
−45.39
2−11.07 2−7.86
2 2−3.83
2 2−45.65
(k)
With known architecture of a CNN, we could iteratively construct At for (k) each 0 ≤ t ≤ df − 1 according to Eq. (58) in Supp. A.1, thereby determining (k)
the locations of zero and non-zero values. Then, we can verify if At and ⃗v are of the same sparsity consistency. Consequently, for Dual RPCPs corresponding to the same neuron t, the consistency checks are formulated as follows: (k)
1. Non-zero-Entry Consistency: At any index where At is non-zero, the corresponding element in the ASV ⃗v should be either non-zero or NaN. (k) 2. Zero-Entry Consistency: At any index where At is zero, the corresponding element in ⃗v should be either 0 or NaN. (k)
(k)
Similarly, for Dual PSPs, we can construct Ap and Aq according to Eq. (58) by enumerating all possible competing neuron pairs (p, q). Thus the union of their non-zero positions and their common zero positions are determined. With
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks (k)
(k)
this knowledge, we can verify whether the difference vector Ap − Aq extracted ASV ⃗v share the exact same sparsity consistency:
27
and the
(k)
(k)
1. Union Non-zero Consistency: At any index where either Ap or Aq is non-zero, the corresponding element in ⃗v should be either non-zero or NaN. (k) (k) 2. Common Zero Consistency: At any index where both Ap and Aq are zero, the corresponding element in ⃗v should be either 0 or NaN. In practice, to systematically evaluate these constraints, we perform the consistency checks for Dual RPCPs before proceeding to Dual PSPs. Experimental Comparison Between the Simple and Advanced ASV Methods. We evaluate both the Simple and Advanced ASV methods on the (2 + 1) CNN trained on the MNIST dataset. We introduce the Valid Duals metric, denoted as (mRPCP + mPSP )/mDual , where mDual is the total number of dual points collected during the search phase. Only a fraction of these points (k) (k) actually belong to the target layer. More importantly, to calculate At (or Ap − (k) Aq ), the Simple ASV method strictly requires at least two dual points of the same category. Hence any isolated dual point lacking a matching counterpart is discarded. Thus, mRPCP and mPSP denote the exact number of Dual RPCPs and PSPs that are ultimately utilized. This limitation becomes a severe bottleneck during the extraction of the second layer, where the RPCPs essential for bias recovery are extremely difficult to find (a phenomenon also observed by Chen et al. [12]). As shown in Table 5, the Advanced ASV method remarkably improves this utilization rate, e.g., to recover the 2nd layer, the Simple ASV requires 6000 dual points, whereas the Advanced ASV needs only 1000. Table 5: Comparison of Simple ASV and Advanced ASV Methods Architecture Layer (k+1) (Models) d(k) −d(k) f −d
7
1st (2+1)
1024–784–196
2nd (2+1)
196–100–25
Method
Valid Duals
Time Queries seconds
(ε, 0)
max|θ − θ̂|
Sim. ASV
(6 + 0)/200
210.79
217.20
2−28.30
2−33.50
(12 + 3)/20
7.71
15.08
2
−27.80
2
2−32.99
(2 + 839)/6000 213.36
221.64
2−21.82
2−29.63
Adv. ASVS (2 + 116)/1000 210.75
219.10
2−26.12
2−31.79
Adv. ASV Sim. ASV
2
Experiments
Description of the Implementation. In practice, our extraction attack proceeds layer by layer, i.e., when targeting a specific layer, we assume that the parameters of all preceding layers have been perfectly extracted. The total runtime for the parameter extraction of each target layer can be decomposed as: b w t = tw dual + tcluster + trecover ,
(55)
28
Z. Chen et al.
b where tw dual is the time spent to find the dual points, tcluster is the time required w to cluster the consistent dual points, and trecover is the time taken to recover the signed weights and biases from each cluster. Note that for CNNs, sign recovery is inherently straightforward, as described in [12, Sect. 4.3 and 5.3]. We provide the sign recovery process in hard-label CNNs in Supp. B. During the dual point discovery and weight recovery phases, we improve efficiency by computing gradients symbolically at the decision boundaries in the whitebox setting—a technique first introduced in [8] and employed in [31]. Settings of our Experiments: While previous practical experiments [8,31] rely on white-box gradient access across all three phases, we restrict our clustering phase to be fully black box, i.e., our first and third phases operate in a white box setting (denoted by w ), while the clustering phase is executed in a black box setting (denoted by b ). Most experiments were conducted on a server equipped with an NVIDIA RTX 5080 GPU (16 GB memory), while the attack can also be efficiently executed on standard CPUs.
Hard-label FCNN Extraction with ASV Method-Improved Clustering. We implement our algebraic attack to extract the signatures of a 4-hiddenlayer FCNN with a 64 − (64 × 4) − 10 architecture. As shown in Table 1 in Sect. 1, to extract the 1st layer, about 3000 dual points are needed to cluster. When directly applying the SVD-based clustering proposed by Carlini et al. [8], it requires approximately 5.03 hours to extract the 1st layer. In contrast, the extraction time based on our ASV method is only 0.04 hours. The difference of time complexities is even more pronounced when the number of dual points increases. For example, extracting the 2nd layer requires clustering roughly 50, 000 dual points for 1st and 2nd layer. While our method completes this in 0.74 hours, Carlini et al.’s method [8] cannot give a result within a reasonable time. We estimate the runtime as follows: After initial filtering, around 30, 000 candidate dual points remain for the 2nd layer; by comparing a sample of 10 dual points against the entire remaining 30, 000 points, we determined that each pairwise SVD comparison consumes an average of 0.0175 seconds. According to Eq. (19), the estimated runtime of Carlini et al.’s method to cluster the remaining dual s×30,0002 = 4, 375 hours. points is about 0.0175 3,600 s/h Hard-label CNN Extraction with Advanced ASV Method. The wellknown LeNet-5, first proposed by LeCun et al. in 1998 [20] for handwriting recognition, is a foundational work in CNNs. Modern implementations typically update its classic (2 + 2) architecture by incorporating ReLU activations and Max Pooling layers. Our practical attack targets this modern architecture (specified in Supp. D) under the most restrictive hard-label setting. This represents a significantly more challenging scenario compared to recent works, such as the attack by Sun et al. [31], which only addresses average pooling, and that by Chen et al. [12], which requires full access to raw outputs. The experimental results and the comparison with Sun et al.’s [31] and Chen et al.’s [12] experiments are summarized in the last four rows of Table 1 in Sect. 1.
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
29
References 1. Roderick Asselineau, Patrick Derbez, Pierre-Alain Fouque, and Brice Minaud. Cryptanalytic extraction of deep neural networks with non-linear activations. Cryptology ePrint Archive, 2026. 2. Lejla Batina, Shivam Bhasin, Dirmanto Jap, and Stjepan Picek. {CSI}{NN}: Reverse engineering of neural network architectures through electromagnetic side channel. In 28th USENIX Security Symposium (USENIX Security 19), pages 515– 532, 2019. 3. Yoshua Bengio, Aaron C. Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE Trans. Pattern Anal. Mach. Intell., 35(8):1798–1828, 2013. 4. Avrim Blum and Ronald Rivest. Training a 3-node neural network is np-complete. Advances in neural information processing systems, 1, 1988. 5. Martin R Bridson and André Haefliger. Metric spaces of non-positive curvature, volume 319. Springer Science & Business Media, 2013. 6. Isaac A. Canales-Martı́nez and David Santos. Extracting some layers of deep neural networks in the hard-label setting. In Daniel Escudero and Ivan Damgård, editors, Progress in Cryptology - LATINCRYPT 2025 - 9th International Conference on Cryptology and Information Security in Latin America, Medellı́n, Colombia, October 1-3, 2025, Proceedings, volume 16129 of Lecture Notes in Computer Science, pages 399–421. Springer, 2025. 7. Isaac Andrés Canales-Martinez, Jorge Chávez-Saab, Anna Hambitzer, Francisco Rodrı́guez-Henrı́quez, Nitin Satpute, and Adi Shamir. Polynomial time cryptanalytic extraction of neural network models. In Marc Joye and Gregor Leander, editors, Advances in Cryptology - EUROCRYPT 2024 - 43rd Annual International Conference on the Theory and Applications of Cryptographic Techniques, Zurich, Switzerland, May 26-30, 2024, Proceedings, Part III, volume 14653 of Lecture Notes in Computer Science, pages 3–33. Springer, 2024. 8. Nicholas Carlini, Jorge Chávez-Saab, Anna Hambitzer, Francisco Rodrı́guezHenrı́quez, and Adi Shamir. Polynomial time cryptanalytic extraction of deep neural networks in the hard-label setting. In Serge Fehr and Pierre-Alain Fouque, editors, Advances in Cryptology - EUROCRYPT 2025 - 44th Annual International Conference on the Theory and Applications of Cryptographic Techniques, Madrid, Spain, May 4-8, 2025, Proceedings, Part I, Lecture Notes in Computer Science, pages 364–396. Springer, 2025. 9. Nicholas Carlini, Matthew Jagielski, and Ilya Mironov. Cryptanalytic extraction of neural network models. In Daniele Micciancio and Thomas Ristenpart, editors, Advances in Cryptology - CRYPTO 2020 - 40th Annual International Cryptology Conference, CRYPTO 2020, Santa Barbara, CA, USA, August 17-21, 2020, Proceedings, Part III, Lecture Notes in Computer Science, pages 189–218. Springer, 2020. 10. Yi Chen, Xiaoyang Dong, Jian Guo, Yantian Shen, Anyu Wang, and Xiaoyun Wang. Hard-label cryptanalytic extraction of neural network models. In KaiMin Chung and Yu Sasaki, editors, Advances in Cryptology - ASIACRYPT 2024 - 30th International Conference on the Theory and Application of Cryptology and Information Security, Kolkata, India, December 9-13, 2024, Proceedings, Part VIII, Lecture Notes in Computer Science, pages 207–236. Springer, 2024. 11. Yi Chen, Xiaoyang Dong, Ruijie Ma, Yantian Shen, Anyu Wang, Hongbo Yu, and Xiaoyun Wang. Delving into cryptanalytic extraction of prelu neural networks. In
30
Z. Chen et al.
International Conference on the Theory and Application of Cryptology and Information Security, pages 576–607. Springer, 2025. 12. Zirui Chen, Shi Tang, Zhengchao Gao, Yongjia Su, Lingyue Qin, and Xiaoyang Dong. Algebraic attack on convolutional neural network with max pooling. IACR Cryptol. ePrint Arch., 2026:241, 2026. 13. Benoit Coqueret, Mathieu Carbone, Olivier Sentieys, and Gabriel Zaid. A divideand-conquer strategy for hard-label extraction of deep neural networks via sidechannel attacks. Cryptology ePrint Archive, Paper 2024/1870, 2024. 14. Charles Fefferman et al. Reconstructing a neural net from its output. Revista Matemática Iberoamericana, 10(3):507–556, 1994. 15. Hanna Foerster, Robert Mullins, Ilia Shumailov, and Jamie Hayes. Beyond slow signs in high-fidelity model extraction. Advances in Neural Information Processing Systems, 37:19496–19522, 2024. 16. Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Yee Whye Teh and D. Mike Titterington, editors, Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, AISTATS 2010, Chia Laguna Resort, Sardinia, Italy, May 13-15, 2010, JMLR Proceedings, pages 249–256. JMLR.org, 2010. 17. Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In 2015 IEEE International Conference on Computer Vision (ICCV), pages 1026–1034, 2015. 18. Péter Horváth, Dirk Lauret, Zhuoran Liu, and Lejla Batina. Sok: Neural network extraction through physical side channels. In USENIX Security Symposium, 2024. 19. Matthew Jagielski, Nicholas Carlini, David Berthelot, Alex Kurakin, and Nicolas Papernot. High accuracy and high fidelity extraction of neural networks. In 29th USENIX security symposium (USENIX Security 20), pages 1345–1362, 2020. 20. Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. 21. Chun Li, Zheng Gong, Di Li, Liping Zhuang, Yufeng Tang, Yin Lv, and Xingfu Yan. End-to-end polynomial-time cryptanalytic extraction of convolutional neural networks in the hard-label setting. Cryptology ePrint Archive, Paper 2026/902, 2026. 22. Zhiyuan Li, Yuping Luo, and Kaifeng Lyu. Towards resolving the implicit bias of gradient descent for matrix factorization: Greedy low-rank learning. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. 23. Haolin Liu, Adrien Siproudhis, Christina Boura, and Thomas Peyrin. Model extraction of convolutional neural networks with max-pooling. Cryptology ePrint Archive, 2026. 24. Haolin Liu, Adrien Siproudhis, Samuel Experton, Peter Lorenz, Christina Boura, and Thomas Peyrin. Navigating the deep: Signature extraction on deep neural networks. arXiv preprint arXiv:2506.17047, 2025. 25. Haolin Liu, Adrien Siproudhis, Samuel Experton, Peter Lorenz, Christina Boura, and Thomas Peyrin. Navigating the deep: End-to-end extraction on deep neural networks. IACR Cryptol. ePrint Arch., 2026:296, 2026. 26. Daniel Lowd and Christopher Meek. Adversarial learning. In Proceedings of the eleventh ACM SIGKDD international conference on Knowledge discovery in data mining, pages 641–647, 2005.
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
31
27. Daryna Oliynyk, Rudolf Mayer, and Andreas Rauber. I know what you trained last summer: A survey on stealing machine learning models and defences. ACM Computing Surveys, 55(14s):1–41, 2023. 28. Xiaokang Qi, Hao Lei, Longxiang Wei, Xiaohan Sun, and Meiqin Wang. Cryptanalytic extraction of neural networks with various activation functions. Cryptology ePrint Archive, 2026. 29. David Rolnick and Konrad Kording. Reverse-engineering deep relu networks. In International conference on machine learning, pages 8178–8187. PMLR, 2020. 30. Andrew M. Saxe, James L. McClelland, and Surya Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. In Yoshua Bengio and Yann LeCun, editors, 2nd International Conference on Learning Representations, ICLR 2014, Banff, AB, Canada, April 14-16, 2014, Conference Track Proceedings, 2014. 31. Xiaohan Sun, Hao Lei, Longxiang Wei, Xiaokang Qi, Kai Hu, Meiqin Wang, and Wei Wang. Cryptanalytic extraction of convolutional neural networks. Cryptology ePrint Archive, Paper 2026/139, 2026. 32. Florian Tramèr, Fan Zhang, Ari Juels, Michael K Reiter, and Thomas Ristenpart. Stealing machine learning models via prediction {APIs}. In 25th USENIX security symposium (USENIX Security 16), pages 601–618, 2016. 33. Roman Vershynin. High-dimensional probability. University of California, Irvine, 10(11):31, 2020.
32
Z. Chen et al.
Supplementary Material A
Detailed Notations of CNN
A.1
Basic Definitions and Notations
The basic definitions and notations is summarized in Table 6.
(k)
h(k) ×wo(k)
F2 o
(k)
C (k) ∈ Rhc ×wc (k)
(k)
IN (k) ∈ Rhin ×win
-1
0
1
1
-1
0
0
-1
0
0 1 LRF-C 0 0 -1
1
1
1
0
1
1
1
0
-3
0
-1 0
0 0
-1 1
-2 1 (k)
0
O(k) ∈ Rho ×wo
0
0
0
1
1
1
(k)
A(k) ∈ Rdf ×d
(k)
B (k) ∈ Rdf
,
(k)
0
2
-1
-1
-1
-1
2
(k)
X (k) ∈ Rd
1
(k)
1 0
1
3
(k)
(k)
d
(k)
I (k) ∈ F2f Y (k) = A(k) X (k) + B (k)
(k)
×df
(k)
Ô(k) ∈ Rho ×wo
0
1
0
0
0
0 2 LRF-P 0 0 2
4
Y (k) ∈ Rdf
(k) h(k) ×wm
M (k),0,0 ∈ F2 m
(k+1)
IN (k+1) ∈ Rhin 2
2
3
4
(k+1)
×win
0
3
4 (k)
Z (k) ∈ Rdf
P (k) ∈ Rd
(k+1)
X (k+1) ∈ Rd (k)
(k+1)
×df
Fig. 6: Symbolic View of CNN
Convolutional Layers. The CNN’s inputs are formulated as matrices. The (k) convolution operation of the convolutional layer fc employs a sliding window mechanism, where a small matrix of learnable parameters (the Convolutional Kernel Matrix) traverses the input from left to right, top to bottom. At each position, the sum of element-wise products between the Convolutional Kernel Matrix and the overlapping local input patch (Local Receptive Field of Convolutional layer, abbreviated as LRF-C), is computed to generate a single output value. A shared bias is then added to the result at each position to constitute the output matrix (Feature Map) of the convolutional layer. (k) In the algebraic view in Figure 1, the input matrix of fc is denoted as (k) (k) (k) (k) IN (k) with dimension hin × win , so d(k) = hin · win . The convolutional kernel (k) (k) (k) (k) (k) (k) matrix is defined by the shape (cin , cout , hc , wc ), where cin and cout denote (k) (k) the number of input and output channels, and hc , wc denote the height and (k) width of the convolutional kernel matrix C , respectively. For briefness, we will only describe the simple case of single input and output (k) (k) channel, i.e., cin = cout = 1. For the case of multiple channels, please refer to (k) (k) (k) [12]. Given a convolution stride sc , the ho × wo output matrix or the feature (k) (k) map of fc is denoted as O , where $ % $ % (k) (k) (k) (k) hin − hc win − wc (k) (k) ho = + 1, wo = + 1. (56) (k) (k) sc sc
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
33
Table 6: Basic Definitions and Notations FCNN: Fully Connected Neural Network (FCNN). CNN: Convolutional Neural Network (CNN). ReLU: Rectified Linear Unit. FCNN Round: Including a linear function f (k) called fully-connected layer, and a nonlinear function σ (component-wise ReLU function). (k)
Convolutional Round: Including convolutional layer fc , nonlinear activation layer (k) σc (ReLU), and pooling layer ρ(k) (Max Pooling). (m + n)-Deep Convolutional Neural Network (CNN): A CNN with m convolutional rounds and n FCNN rounds, as well as an output layer with a fully-connected linear layer. (k)
(k)
(k)
(k)
(k)
(k)
(cin , cout , hc , wc ): Convolutional layer with cin input and cout output channels, (k) (k) and the size of kernel matrices is hc × wc . k
(k)
(k)
IN (k) : input matrix of fc , IN (k) ∈ Rhin ×win
(k)
k
C (k) : convolutional kernel matrix of layer k, C (k) ∈ Rhc ×wc (k)
(k)
O(k) : ho × wo
(k)
(k)
(k)
output matrix or the feature map of fc , O(k) ∈ Rho ×wo d
(k)
I (k) : diagonal activation indicator matrix of layer k, I (k) ∈ F2f
(k)
×df
(k)
(k)
(k)
Ô(k) : output matrix of the k-th non-linear activation layer σc , Ô(k) ∈ Rho ×wo
M (k),i,j : Boolean selection matrix for the (i, j)-th local receptive field of max pooling (k)
(k)
layer k, M (k),i,j ∈ Fh2 m ×wm
P (k) : Boolean pooling matrix of layer k, P (k) ∈ R
(k)
d(k+1) ×df (k)
(k)
X (k) , Y (k) , Z (k) : Input vectors of the operations fc , σc , ρ(k) in the k-th convolu(k)
(k) df
(k)
tional rounds, k ≥ 1. X (k) ∈ Rd , Y (k) , Z (k) ∈ R , since σc dimension. X (k) [i] is the i-th (0 ≤ i < d(k) ) entry of X (k) .
does not change the
(k)
A(k) : Matrix whose entry in i-th row and j-th is Ai,j , i, j start from 0. RPCP, PSP, FCP: ReLU-Pooling Critical Point, Pooling Switching Point, Critical points in the Fully-connected Block, respectively. LRF-C, Local Receptive Field of Convolutional Layer: A sub-matrix of IN (k) , which is multiplied by Convolutional Kernel Matrix C (k) to produce each entry in Y (k) . The LRF-C will be different for different elements of Y (k) . Let Y (k) [t] correspond to the (k) t-th (0 ≤ t ≤ df − 1) LRF-C. LRF-P, Local Receptive Field of Pooling Layer: A sub-matrix of Z (k) , which is processed by a pooling function to produce each entry of X (k+1) . The LRF-P will be different for different elements of X (k+1) . Let X (k+1) [t] correspond to the t-th (0 ≤ t ≤ d(k+1) − 1) LRF-P. (k)
sc
: The convolution stride, which is by default set to 1 in this paper.
34
Z. Chen et al.
(k) (k) For briefness, we let the convolution stride sc = 1. The input of fc can be a (k) (k) (k) (k) (k) (k) (k) hin ×win IN or a d -dimension vector X . Denote IN = [ai,j ]h(k) ×w(k) in in (k) (k) (k) (k) (k) and the i-th (0 ≤ i ≤ hin − 1) row INi = (ai,0 , ai,1 , · · · , a (k) ). Then the i,w −1 (k)
(k)
in
(k)
vector X (k) = (IN0 , IN1 , · · · , IN (k) Denote the kernel matrix C (k)
c
(k)
i,wc −1
(k)
)T .
hin −1 (k) (k) (k) (k) = [ci,j ]h(k) ×w(k) , where Ci = (ci,0 , ci,1 , · · · , c c (k)
). Then convolution operation computes the output matrix O (k) Oi,j =
(k) h(k) c −1 wc −1
X
X
p=0
q=0
as
(k)
(k) INi+p,j+q Cp,q + b(k) ,
(57)
where the bias b(k) is the same for all the outputs. In vector form, the output ma(k) (k) (k) (k) (k) trix O(k) will be a (df = ho ·wo )-dimension vector Y (k) = (O0 , · · · , O (k) )T . ho −1
(k)
(k)
(k)
Definition 16. (Convolutional Matrix) Let cin = cout = sc = 1. In the k-th convolutional layer, given a convolution kernal matrix C (k) , the function (k) (k) (k) (k) fc : Rd → Rdf , is defined as fc (X (k) ) = A(k) X (k) + B (k) , where X (k) ∈ (k)
Rd
(k)T
is the input vector. A(k) = (A0
(k)T
, A1
df −1
(k) i-th row (0 ≤ i ≤ df − 1) is: (k)
Ai
(k)
(k)T
, · · · , A (k)
(k)
(k)
)T ∈ Rdf ×d
, whose
(k)
= ( 0, · · · , 0 , 0, · · · , 0 , C0 , 0, . . . , 0, · · · , 0, · · · , 0 , C (k) , 0, . . . , 0, 0, · · · , 0), | {z } | {z } hc −1 | {z } | {z } | ${z } % | {z } (k)
win ·
padding
(k)
i mod wo
i (k) wo
|
{z
(k)
padding
(k)
i mod wo
}
|
{z
(k)
win
padding
}
win
(58)
and B
(k)
(k)
= (b
(k)
,b
,··· ,b
(k)
df
) ∈R
(k) T
(the bias for each neuron is the same). (k)
Nonlinear Activation Layer. The k-th activation layer σc of a CNN consists (k) of a set of parallel df nonlinear activation functions ReLU(xi ) = max{xi , 0} (k)
for i = 0, · · · , df − 1. (k)
(k)
(k)
The input of σc layer is the ho × wo matrix O(k) , and we denote its output as Ô(k) with the same dimension. In vector form, the input is denoted as (k) Y (k) = (y0 , y1 , · · · , yd(k) −1 )T and then σc layer can be expressed as a matrix f
(k)
(k)
(k)
I (k) multiplied by Y (k) , i.e., Z (k) = (Ô0 , · · · , Ô (k) )T = σc (Y ) = I (k) Y (k) , ho −1 where (k) 0 ··· 0 τ0 0 τ1(k) · · · 0 1, if yi > 0, (k) (k) (k) .. .. , 0 ≤ i ≤ df − 1, τi = I = .. (59) 0, if yi ≤ 0. . . . (k) 0 0 · · · τ (k) df −1
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
35
Pooling Layers. In the pooling layer, a small fixed-size window (analogous to a convolutional kernel, and referred to as a pooling kernel) slides across a feature map (input matrix Ô(k) ) with a predefined stride. The region of the input matrix covered by the pooling window is also referred to as the Local Receptive Field of Pooling (LRF-P for short). For each window position, it applies a pooling function (usually use the max or average function) to compress the contents in the LRF-P into a single value, producing a dimension reduced output matrix (denoted as IN (k+1) ). Unlike convolutional kernels, pooling kernels are parameter-free (no learnable weights and biases) — their behavior is determined solely by size, stride, and compressing rule. In the pooling layer ρ(k) , we assume that the max pooling kernel is applied (k) (k) (k) (k) (k) to an LRF-P of size hm × wm with stride sρ . The input is ho × wo matrix (k) (k) Ô(k) in Figure 1. The output is denoted as a hρ × wρ matrix IN (k+1) , where: % $ % $ (k) (k) (k) (k) − w w − h h m o m o + 1, wρ(k) = + 1. h(k) ρ = (k) (k) sρ sρ (k)
(k)
In particular, when the pooling kernel size is hm × wm = 2 × 2 and the stride (k) is sρ = 2, the windows partition the input into disjoint LRF-Ps, and the calculation of the output size reduces to: $ % $ % (k) (k) h w o o h(k) , wρ(k) = . ρ = 2 2 (k)
The entry of the i-th row and j-th column (0 ≤ i ≤ hρ − 1, 0 ≤ j ≤ (k) wρ − 1) of the output matrix IN (k+1) takes the maximum value of the el(k) ements in the (i · wρ + j)-th LRF-P of Ô(k) , whose indexes are denoted as (k) (k) (k) (k) Ωi,j = {(i · sρ + h, j · sρ + w), 0 ≤ h ≤ hm − 1, 0 ≤ w ≤ wm − 1}. Then, (k+1)
INi,j
(k)
= max{ÔΩi,j }.
(60)
When the input matrix Ô(k) is given, and the max pooling operation can h(k) ×w(k)
m be expressed as multiplying a series of Boolean matrices M (k),i,j ∈ F2 m (k) (k) (k) (k) (k) (0 ≤ i ≤ hρ − 1, 0 ≤ j ≤ wρ − 1) by different hm × wm LRF-P of Ô ,
(k+1)
INi,j
=
X (k) (k) 0≤h≤hm −1,0≤w≤wm −1
(k),i,j
M{h,w} · Ô
(k)
(k) (k)
(k)
{i·sρ +h,j·sρ +w}
,
(61)
In the (i · wρ + j)-th LRF-P of Ô(k) , let Λi,j be the set of all index pairs that achieve the maximum value: (k) (k) Λi,j = (h, w) | Ô (k) = max{ÔΩi,j } . (62) (k) {i·sρ +h,j·sρ +w}
36
Z. Chen et al.
To ensure exactly one neuron is selected from the LRF-P, let (h∗ , w∗ ) ∈ Λi,j be an arbitrarily chosen index pair. The elements of M (k),i,j are defined as: (k),i,j M{h,w} =
( 1, if (h, w) = (h∗ , w∗ ), 0, otherwise,
(k)
(63)
(k)
with 0 ≤ h ≤ hm − 1, 0 ≤ w ≤ wm − 1. Note that any arbitrary choice of (h∗ , w∗ ) ∈ Λi,j yields a functionally equivalent matrix M (k),i,j that produces (k+1) the exact same pooling output INi,j . In vector form, the input and output vector of pooling layer ρ(k) are Z (k) = (k) (k) (k) (k) (k) (k+1) (k+1) (Ô0 , · · · , Ô (k) )T ∈ Rdf =ho ·wo and X (k+1) = (IN0 , IN1 ,··· , (k+1)
IN (k)
hρ −1
ho −1
(k+1)
)T ∈ Rd
(k)
(k)
, d(k+1) = hρ · wρ .
(k)
Definition 17. (Boolean Pooling Matrix) There exists a d(k+1) ×df Boolean (k)
(k+1)
pooling matrix P (k) so that ρ(k) : Rdf → Rd satisfying X (k+1) = ρ(k) (Z (k) ) = (k) (k) (k) (k) P · Z . Assuming the LRF-Ps are disjoint and square (i.e., sρ = wm = (k) hm ), then the max pooling operation on the r-th LRF-P can be defined as the r-th row (0 ≤ r ≤ d(k+1) − 1) of P (k) : (k)
Pr
(k),i,j
= ( 0, · · · , 0 , 0, · · · , 0, M0 | {z } | {z } (k)
(k)
padding
(k)
wo ·i·sρ
j·sρ
|
(k),i,j
, 0, . . . , 0, · · · , 0, · · · , 0, M (k) , 0, . . . , 0, 0, · · · , 0), | {z } | {z } hm −1 | {z } | {z }
{z
(k)
wo
}
padding
(k)
j·sρ
|
{z
padding
}
(k)
wo
(64) where i =
(k) r , j = r mod wρ . (k)
wρ
(k)
Obviously, similar to the matrix of I (k) for σc layer, the pooling matrix P varies with the input X (1) due to Eq. (63). For example, the input matrix (k) (k) (k) (k) Ô has dimensions ho × wo = 4 × 4, i.e., df = 16, the max pooling kernel (k)
(k)
(k)
(k)
is of hm × wm = 2 × 2 with stride sρ = 2. The output matrix IN (k+1) will (k) (k) (k) have dimension hρ × wρ = 2 × 2, i.e., d(k+1) = 4. The d(k+1) × df = 4 × 16 ! (k) P0,0 02×8 pooling matrix P (k) = (k) , where 02×8 is 2 × 8 zero matrix, and 02×8 P1,1 (k),0,0
(k) P0,0 =
M0,0 0
(k) P1,1 =
M0,0 0
(k),1,0
(k),0,0
M0,1 0
(k),1,0
M0,1 0
0
(k),0,0
M1,0 (k),0,1 (k),0,1 M0,1 0 M0,0 0
0
0
(k),1,0
M1,0 (k),1,1 (k),1,1 M0,0 M0,1 0
(k),0,0
M1,1 0
(k),1,0
M1,1 0
0 (k),0,1
0 M1,1
0
0
(k),1,1
,
(k),0,1
M1,0
M1,0
!
(k),1,1
M1,1
! .
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
37
Definition 18. (Fully-connected Layer) The k-th fully-connected layer within (k) (k+1) the fully-connected block of the CNN is a function f (k) : Rd → Rd given by an affine transformation: f (k) (X) = A(k) X (k) + B (k) , (k)
where X (k) ∈ Rd represents the input vector. The weight matrix A(k) ∈ (k+1) d(k+1) ×d(k) R and the bias vector B (k) ∈ Rd are composed of floating-point numbers. The matrix for the nonlinear layer σ (ReLU functions) of the fully-connected block can be similarly defined by Eq. (59). (1) Given X (1) = x ∈ Rd , the convolutional rounds and FCNN rounds of CNN “collapse” into an affine transformation. Assume that the function of the m convolutional rounds is F1 , and the function of the n FCNN rounds is F2 , then y = F1 (x) = P (m) (I (m) (A(m) · · · (P (1) (I (1) (A(1) x + B (1) ))) · · · + B (m) )) (65) = P (m) I (m) A(m) · · · P (2) I (2) A(2) P (1) I (1) A(1) x + β1 = Γ1 · x + β1 According to [7, Section 3.1], given y, F2 collapses into F2 (y) = Γ2 · y + β2 .
(66)
Consequently, the full CNN “collapses” into F(x) = Γ2 (Γ1 · x + β1 ) + β2 = Γ2 · Γ1 · x + Γ2 β1 + β2 .
(67)
(1)
Definition 19. (Linear Neighborhood of CNN) Given an input x ∈ Rd with the corresponding output of the CNN computed by Eq. (67), the linear neighborhood of x is defined as the set (1)
{u ∈ Rd |F(u) = Γ2 · Γ1 · u + Γ2 β1 + β2 }, i.e., the same affine transformation is used for u and x to compute the output of the CNN. If we make a change of ∆ to the input x, and x + ∆ remains within the linear neighborhood of x, we can observe the corresponding change of the output F(x+∆)−F (x) = Γ2 ·Γ1 ·(x+∆)+Γ2 β1 +β2 −(Γ2 ·Γ1 ·x+Γ2 β1 +β2 ) = Γ2 ·Γ1 ·∆. Definition 20. (Layer Merging) We focus on the convolutional block of the (m + n) network. We assume that we have complete knowledge of the first k − 1 layers of the convolutional block, and we are currently recovering layer k. Let
38
Z. Chen et al.
Fxk−1 and Gk+1 represent, respectively, the fully recovered and non-recovered x parts of the CNN. F = f (n+1) ◦ · · · ◦ σ (1) ◦ f (1) ◦ ρ(m) ◦ · · · ◦ fc(k+1) ◦ρ(k) ◦σc(k) ◦fc(k) ◦ρ(k−1) ◦ · · · ◦ fc(1) . | {z } | {z } Gk+1 x
Fxk−1
(1)
Given X (1) ∈ Rd , Gk+1 and Fxk−1 become Gk+1 (X (k+1) ) = Gk+1 X (k+1) + x x (k) (1) k+1 k−1 (1) k−1 (1) k−1 B and Fx (X ) = F X +B , where the matrices F k−1 ∈ Rd ×d , (k) (n+2) (k+1) (n+2) ×d B k−1 ∈ Rd , Gk+1 ∈ Rd , B k+1 ∈ Rd , respectively. A.2
A Toy Example of CNN
To facilitate a clearer understanding of the algebraic notations introduced in Section A.1, this appendix provides a concrete, step-by-step toy example. We explicitly demonstrate the complete computational pipeline — including Convolution, ReLU activation, and Max Pooling — for a single-input and single-output (k) (k) channel scenario (i.e., cin = cout = 1). Figure 7 visualizes the spatial mapping mechanism of this process. In the following subsections, we formulate this exact process algebraically by completely expanding the equivalent transformation matrices without any truncation. (k)
(k)
Setup and Vector Flattening. Consider an input matrix IN (k) ∈ Rhin ×win = (k) (k) (k) R5×5 . We apply a convolutional layer fc with a kernel C (k) ∈ Rhc ×wc = (k) R2×2 , a stride of sc = 1, and valid padding, yielding an intermediate output (k) matrix O . According to the definitions in Section A.1, the spatial dimensions of O(k) are calculated as follows: % $ (k) (k) 5−2 hin − hc (k) +1= ho = + 1 = 4, (68) (k) 1 sc % $ (k) (k) 5−2 win − wc (k) + 1 = + 1 = 4. (69) wo = (k) 1 sc Consequently, the resulting intermediate output matrix is O(k) ∈ R4×4 . Subse(k) quently, a ReLU activation layer σc is applied to O(k) , generating an activated (k) 4×4 output matrix Ô ∈ R . Following the activation, a max pooling layer ρ(k) with a window size of (k) (k) (k) hm ×wm = 2×2 and a stride of sρ = 2 processes Ô(k) . The spatial dimensions of the final output matrix IN (k+1) for the subsequent layer are determined by: $ % (k) (k) ho − hm 4−2 (k) hρ = +1= + 1 = 2, (70) (k) 2 sρ $ % (k) (k) wo − wm 4−2 (k) wρ = + 1 = + 1 = 2. (71) (k) 2 sρ
(k)
2
2
0
0
-3
0
-3
X (k) ∈ Rd
(k)
2
2
0
-1
0
-1
0
-1
-1
= R25
-1
3
2
1
3
2 -1 LRF-C 0 -2
IN (k) ∈ Rhin ×win = R5×5
(k)
(k)
2 4
(k)
1 3
(k)
(k)
12
14
10
-5
-2
7
4
-5 (k)
×df
1
1
1
0
1
1
= F16×16 2
1
1
1
ReLU I (k) ∈
(k)
d F2f
0
1
0
(k)
12
14
0
0
0
7
4
0
(k) h(k) ×wm
M (k),1,0 ∈ F2 m
1
0
(k)
10
24
13
2
14
10
(k)
0
0
(k) h(k) ×wm
M (k),1,1 ∈ F2 m
0
24
13
(k)
= R4
= F2×2 2
(k+1)
X (k+1) ∈ Rd
= F4×16 2
1
(k)
0
0
= F2×2 2
IN (k+1) ∈ (k+1) Rhρ ×wρ (k+1) = Rhin ×win = R2×2 Pool P (k) ∈
1
0
(k) h(k) ×wm
M (k),0,1 ∈ F2 m
d(k+1) ×df F2
= F2×2 2
Z (k) ∈ Rdf = R16
0
1
10
0
LRF-P 2 LRF-P 3
0
0
LRF-P 0 LRF-P 1
(k)
1
0
= F2×2 2
Ô(k) ∈ Rho ×wo = R4×4
0
0
(k) h(k) ×wm
M (k),0,0 ∈ F2 m
Fig. 7: Overall visual illustration of one convolutional round.
(k)
10
24
13
2
Y (k) ∈ Rdf = R16
-9
1
-5
-8
O(k) ∈ Rho ×wo = R4×4
= R2×2
Conv A(k) ∈ ×d(k) R = R16×25 (k)
df
C (k) ∈ Rhc ×wc
0
1
0
0
= F4×4 2
h(k) ×wo(k)
F2 o
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks 39
40
Z. Chen et al.
This yields the matrix IN (k+1) ∈ R2×2 . To represent these operations algebraically, we flatten the spatial matrices into vectors using row-major ordering. For the input matrix IN (k) , its i-th row (k) (k) (k) (k) (k) (0 ≤ i ≤ hin − 1) is denoted as INi = (ai,0 , ai,1 , . . . , a (k) ). Based on the i,win −1
specific numerical values from Figure 7, we instantiate the first and the last row vectors as follows: (k) IN0 = (2, −1, 3, 1, −1), .. (72) . (k)
IN4
= (−3, 0, 2, −1, 0). (k)
(k)
(k)
The flattened input vector X (k) ∈ Rd = Rhin ·win = R25 is constructed by (k) (k) (k) concatenating these row vectors as X (k) = (IN0 , IN1 , . . . , IN4 )T , which explicitly evaluates to: X (k) = [2, −1, 3, 1, −1, 0, −2, −1, 0, −1, −3, 2, 2, 2, 0, 0, 0, 2, 3, −1, −3, 0, 2, −1, 0]T . (73)
(k)
(k)
1
2
3
4
C (k) ∈ Rhc ×wc (k)
(k)
IN (k) ∈ Rhin ×win = R5×5 2 -1 LRF-C 0 -2
3
1
-1
-1
0
-1
Conv A(k) ∈ ×d(k) R = R16×25 (k)
df
-3
2
2
2
0
0
0
2
3
-1
-3
0
2
-1
0
d(k)
=R
= R2×2
(k)
(k)
-8
-5
2
-5
-5
10
13
4
1
14
24
7
-9
12
10
-2
O(k) ∈ Rho ×wo = R4×4
(k)
X
(k)
∈R
25
Y (k) ∈ Rdf = R16
(k)
Fig. 8: Local view of the convolution operation fc
The Convolutional Matrix (A(k) ). Let the 2 × 2 convolutional kernel matrix be C (k) = [ 13 24 ]. For simplicity in this example, we assume the bias is b(k) = 0, yielding an all-zero bias vector B (k) = 0. Therefore, the convolution operation translates into a linear matrix multiplication Y (k) = A(k) X (k) , where Y (k) ∈ (k) (k) (k) (k) (k) Rdf = Rho ·wo = R16 is the flattened output vector and A(k) ∈ Rdf ×d = R16×25 is the convolutional matrix.
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
41
As illustrated by the orange dashed lines in Figure 8, the first element of the (k) (k) feature map O0,0 (which corresponds to Y0 ) is computed by the sum of the element-wise multiplications between C (k) and the top-left LRF-C. Formally, this is calculated as: (k) O0,0 =
(k) h(k) c −1 wc −1
X
X
p=0
q=0
(k)
(k) IN0+p,0+q Cp,q + b(k)
(k) (k) (k) (k) (k) (k) (k) (k) = IN0,0 C0,0 + IN0,1 C0,1 + IN1,0 C1,0 + IN1,1 C1,1 + b(k)
(74)
= (2)(1) + (−1)(2) + (0)(3) + (−2)(4) + 0 = −8. According to Eq. (58), the first row of the convolutional matrix (i = 0) is systematically constructed by substituting the kernel rows into the padded (k) (k) structure. Given win = 5 and wo = 4, the substitution and expansion explicitly (k) demonstrate how the kernel parameters are positioned within A0 : (k)
(k)
(k)
A0 = ( 0, · · · , 0 , 0, · · · , 0 , C0 , 0, . . . , 0, 0, · · · , 0 , C1 , 0, . . . , 0, 0, · · · , 0) | {z } | {z } | {z } | {z } | {z } | {z } (k)
(k)
padding 0 mod w(k) o
(k)
win ·⌊0/wo ⌋ 0 mod wo
|
{z
} |
(k)
win
padding
{z
padding
}
(k)
win
= (|{z}, |{z}, 1, 2, 0, 0, 0, |{z}, 3, 4, 0, 0, 0, 0, · · · , 0) | {z } | {z } | {z } 0 0 0 3 3 15 | {z } | {z } 5
5
= (1, 2, 0, 0, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0). (75) By representing the exhaustive sliding window operations over the 2D input matrix, the entire equivalent matrix A(k) is expanded below. We highlight the non-zero elements corresponding to the convolutional kernel in each row in bold: 1 0 0 0 0 0 0 0 (k) A = 0 0 0 0 0 0 0 0
2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 2 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0
3 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
4 3 0 0 2 1 0 0 0 0 0 0 0 0 0 0
0 4 3 0 0 2 1 0 0 0 0 0 0 0 0 0
0 0 4 3 0 0 2 1 0 0 0 0 0 0 0 0
0 0 0 4 0 0 0 2 0 0 0 0 0 0 0 0
0 0 0 0 3 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 4 3 0 0 2 1 0 0 0 0 0 0
0 0 0 0 0 4 3 0 0 2 1 0 0 0 0 0
0 0 0 0 0 0 4 3 0 0 2 1 0 0 0 0
0 0 0 0 0 0 0 4 0 0 0 2 0 0 0 0
0 0 0 0 0 0 0 0 3 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 4 3 0 0 2 1 0 0
0 0 0 0 0 0 0 0 0 4 3 0 0 2 1 0
0 0 0 0 0 0 0 0 0 0 4 3 0 0 2 1
0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 2
0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 4 3 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 4 3 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 3
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4
(76)
Performing the multiplication yields the pre-activation vector Y (k) : Y (k) = A(k) X (k) = [−8, −5, 2, −5, −5, 10, 13, 4, 1, 14, 24, 7, −9, 12, 10, −2]T .
(77)
42
Z. Chen et al.
The ReLU Activation Matrix (I (k) ) Fig. 9 shows the operation of ReLU activation. Algebraically, it is represented as Z (k) = I (k) Y (k) , where I (k) ∈ (k)
d
(k)
×d
f = F16×16 is a diagonal matrix. According to Eq. (59), the i-th diagonal F2f 2 (k) (k) entry of I is set to 1 if the corresponding element Yi is strictly positive, and 0 otherwise. Based on the numerical values of Y (k) calculated previously, the fully
h(k) ×wo(k)
= F4×4 2
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
F2 o
(k)
(k)
O(k) ∈ Rho ×wo = R4×4 -8
-5
2
-5
ReLU I (k) ∈
(k)
d F2f
-5
10
13
4
1
14
24
7
-9
12
10
-2
(k)
0
0
2
0
0
10
13
4
1
14
24
7
0
12
10
0
LRF-P 0 LRF-P 1
(k)
×df
(k)
Ô(k) ∈ Rho ×wo = R4×4
= F16×16 2
LRF-P 2 LRF-P 3
(k)
(k)
Y (k) ∈ Rdf = R16
Z (k) ∈ Rdf = R16 (k)
Fig. 9: Local view of the ReLU activation σc
expanded activation matrix is constructed as follows. We highlight the entire main diagonal in bold: 0 0 0 0 0 0 0 0 I (k) = 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
(78)
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
43
Applying this masking matrix to Y (k) zeros out its non-positive components, yielding the activated vector Z (k) : Z (k) = I (k) Y (k) = [0, 0, 2, 0, 0, 10, 13, 4, 1, 14, 24, 7, 0, 12, 10, 0]T .
(79)
The Max Pooling Matrix (P (k) ) In the pooling layer ρ(k) , the 2 × 2 max pooling operation with stride 2 partitions the 4 × 4 intermediate feature map Ô(k) into 4 disjoint Local Receptive Fields of Pooling (LRF-Ps). For each LRF-P, the pooling function selects the maximum value. Fig. 10 illustrates the operation
(k) h(k) ×wm
M (k),0,0 ∈ F2 m 0
0
0
1
(k) h(k) ×wm
= F2×2 2
(k)
M (k),0,1 ∈ F2 m
(k)
Ô(k) ∈ Rho ×wo = R4×4 0
0
2
0
0
10
13
4
1
14
24
7
0
12
10
0
LRF-P 0 LRF-P 1
0
0
1
0
= F2×2 2
(k)
(k)
IN (k+1) ∈ (k+1) Rhρ ×wρ (k+1) = Rhin ×win = R2×2
Pool P (k) ∈ (k)
d(k+1) ×df
F2
= F4×16 2
LRF-P 2 LRF-P 3
10
13
14
24
X (k+1) ∈ Rd
(k+1)
= R4
(k)
0
1
0
0
Z (k) ∈ Rdf = R16
(k) h(k) ×wm
M (k),1,0 ∈ F2 m
1
0
0
0 (k) h(k) ×wm
= F2×2 2
M (k),1,1 ∈ F2 m
= F2×2 2
Fig. 10: Local view of the max pooling ρ(k)
of max pooling. According to Eq. (60), the first element of the pooled output (k) (k) is the maximum value within the (i · wρ + j) = (0 · wρ + 0) = 0-th LRF-P denoted as Ω0,0 : (k+1)
(k)
(k)
(k)
(k)
(k)
= max{ÔΩ0,0 } = max(Ô0,0 , Ô0,1 , Ô1,0 , Ô1,1 ) = max(0, 0, 0, 10) = 10. (80) Since the maximum value “10” in Ω0,0 is located at local index (h∗ = 1, w∗ = 1), the Boolean matrix M (k),0,0 assigns 1 exclusively to this position, making its (k),0,0 (k),0,0 row vectors M0 = (0, 0) and M1 = (0, 1). According to Eq. (64), the first row (r = 0) of the pooling matrix is constructed by mapping these Boolean (k) (k) rows of M (k),0,0 into the padded structure. Given wo = 4 and sρ = 2, the substitution explicitly demonstrates how the selected bits are positioned within IN0,0
44
Z. Chen et al.
(k)
P0 : (k)
P0
(k),0,0
= ( 0, · · · , 0 , 0, · · · , 0, M0 | {z } | {z } (k) (k) wo ·0·sρ
(k),0,0
, 0, . . . , 0, 0, · · · , 0, M1 | {z } | {z } padding
(k) 0·sρ
{z
|
} |
(k)
wo
, 0, . . . , 0, 0, · · · , 0) | {z } | {z } padding
(k) 0·sρ
{z
(k)
wo
padding
}
= (|{z}, |{z}, 0, 0, 0, 0 , |{z}, 0, 1, 0, 0 , 0, · · · , 0) |{z} |{z} | {z } 0 0 0 2 2 8 {z } | {z } | 4
4
= (0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0). (81) By extending this construction to all four LRF-Ps, the entire equivalent matrix P (k) extracts exactly one element per row. We highlight these selected positions in bold:
0000010000000000 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 P (k) = 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0000000000100000
(82)
The final output vector for the entire layer is therefore: X (k+1) = P (k) Z (k) = [10, 13, 14, 24]T .
B
(83)
Sign Recovery in Hard-label CNN
According to [12, Sect. 4.3 and 5.3], for raw-output CNNs, sign recovery is inherently straightforward. The situation and the recovery procedure remain identical for hard-label CNNs. Sign Recovery from Dual RPCPs. For Dual RPCPs, after recovering Â(k) and B̂ (k) up to an unknown sign, we compute the input vector of the neurons as Â(k) (F k−1 X + B k−1 ) + B̂ (k) , where X is the Dual RPCP of the t-th neuron of layer k. Assume that neuron t belongs to the u-th pooling window Ωu . According to Prop. 1, all the inputs of the neurons within Ωu should be ≤ 0. Then, – if all these inputs are ≤ 0, the sign of the extracted kernel matrix is correct; – if there exists a positive input, the extracted kernel matrix has an inverted sign, and we multiply the matrices Â(k) and B̂ (k) by “−1”. Sign Recovery from Dual PSPs. For Dual PSPs, we reconstruct the convolutional matrix Â(k) , and once we extract p̂ and q̂, the involved pooling window Ωu (0 ≤ u < d(k+1) ) corresponding to the PSP could be deduced. According to Prop. 2, the outputs of the p-th and q-th neurons should be the maximum value in Ωu . Then, with Â(k) ,
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks (k)
(k)
45
(k)
– if Âp (F k−1 X +B k−1 ) = Âq (F k−1 X +B k−1 ) > Âℓ (F k−1 X +B k−1 ), ℓ ∈ Ωu \ {p, q}, the sign of the extracted kernel matrix is correct; (k) (k) (k) – if Âp (F k−1 X +B k−1 ) = Âq (F k−1 X +B k−1 ) < Âℓ (F k−1 X +B k−1 ), ℓ ∈ Ωu \{p, q}, the extracted kernel matrix has an inverted sign, and we multiply (k) the vector Âp by “−1”.
C
Detailed Distribution of the Cosine Similarity between (k) At and A(k) s
Fig. 11: Empirical distribution of absolute cosine similarity between distinct neurons across fully connected layers.
D
Detailed Model Structure Information in Experiments
(2+1)-Deep CNN: 1. Convolutional Round 1: (1) – Convolutional layer fc : 32 × 32 Input matrix IN (1) , convolved with (1) (1, 1, 5, 5) convolution kernel, with stride sc = 1, padding pad(1) = 0, (1) produces 28 × 28 output matrix O , followed by ReLU activation. (1) – Max Pooling layer ρ(1) : 2 × 2 max pooling kernel, with stride sρ = 2, produces 14 × 14 output matrix IN (2) . 2. Convolutional Round 2: (2) – Convolutional layer fc : 14 × 14 Input matrix IN (2) , convolved with (2) (1, 1, 5, 5) convolution kernel, with stride sc = 1, padding pad(2) = 0, (2) produces 10 × 10 output matrix O , followed by ReLU activation. (2) – Max Pooling layer ρ(2) : 2 × 2 max pooling kernel, with stride sρ = 2, produces 5 × 5 output matrix IN (3) . 3. FCNN Round 1: – Flatten the matrix IN (3) and get the 25-dimensional vector X (1) . – Fully-connected Layer f (1) : d(1) = 25 input neurons and d(2) = 18 output neurons, followed by ReLU activation. 4. Last Layer f (2) : d(2) = 18 input neurons and d(3) = 10 output neurons.
46
Z. Chen et al.
(2+2)-Deep LeNet-5: 1. Convolutional Round 1: (1)
– Convolutional layer fc : 32 × 32 Input matrix IN (1) , convolved with (1) (6, 1, 5, 5) convolution kernel, with stride sc = 1, padding pad(1) = 0, produces 6 output matrices O(1) of size 28 × 28 , followed by ReLU activation. (1) – Max Pooling layer ρ(1) : 2 × 2 max pooling kernel, with stride sρ = 2, (2) produces 6 output matrices IN of size 14 × 14 .
2. Convolutional Round 2:
(2)
– Convolutional layer fc : 6 Input matrix IN (2) of size 14 × 14, con(2) volved with (6, 16, 5, 5) convolution kernel, with stride sc = 1, padding (2) (2) pad = 0, produces 16 output matrix O of size 10 × 10, followed by ReLU activation. (2) – Max Pooling layer ρ(2) : 2 × 2 max pooling kernel, with stride sρ = 2, produces 16 output matrix IN (3) of size 5 × 5.
3. FCNN Round 1:
– Flatten the matrix IN (3) and get the 400-dimensional vector X (1) . – Fully-connected Layer f (1) : d(1) = 400 input neurons and d(2) = 120 output neurons, followed by ReLU activation. 4. FCNN Round 2: – Fully-connected Layer f (2) : d(2) = 120 input neurons and d(3) = 84 output neurons, followed by ReLU activation. 5. Last Layer f (3) : d(3) = 84 input neurons and d(3) = 10 output neurons.
E
The Experiments on the DGap among the ASV and the weight for CNN
E.1
White-box Experiment for Verification of DGap(⃗ v, ω ⃗ ) → 0 in Hard-Label CNN
We experiment on a (2+1)-deep CNN with detail configurations given in Supp. D. We randomly sample 1000 valid dual points across the input space and compute their corresponding ASVs ⃗v . For each ⃗v , we then calculate the DGap with respect (k) (k) (k) to all row vectors At , as well as all possible pairwise differences Ap − Aq (neurons p and q are in the same pooling window) of the convolutional matrix A(k) . As shown in Fig. 12, the distributions exhibit a clear separation: the direc(k) tional distances between ASVs and their corresponding target row vectors At (k) (k) (or Ap − Aq ) tightly cluster near 0, while the distances to all other non-target row vectors consistently concentrate around 1.
Algebraic Cryptanalytic Extraction on Hard-Label Neural Networks
ASV v vs. target At(k) (or Ap(k) Aq(k))
ASV v vs. non-target At(k) (or Ap(k) Aq(k))
Percentage of Pairs
Layer 1 80% 60% 40% 20% 0%
47
Layer 2 40% 20%
10 4
10 2
100
0%
10 4
10 2
100
Cosine Distance DGap (log scale) Fig. 12: Distribution of the Cosine Distance (DGap) between ASV ⃗v and all possible pairs of row vectors across CNN layers
E.2
Experimental Verification of ASV-based Consistency Check
Targeting a (2 + 1) CNN, we evaluate the consistency scores across pairs of dual (k) points. As shown in Fig. 13, dual points from the same target vector At (or (k) (k) Ap − Aq ) yield a significantly different distribution compared to pairs from different targets. This separation in distribution demonstrates that the ASVbased consistency score provides a reliable criterion for clustering dual points.
Percentage of Pairs
Consistent Pairs 100%
Layer 1
Inconsistent Pairs 80%
Layer 2
75%
60%
50%
40%
25%
20%
0% 0.0 0.2 0.4 0.6 0.8 1.0
0% 0.0 0.2 0.4 0.6 0.8 1.0
Consistency Score (S) Fig. 13: Distribution of Consistency Scores for pairs sharing the same target vector versus those from different target vectors across CNN layers.
Related documents
- End-to-End Hard-Label Cryptanalytic Model Extraction Using Efficient Sign Recovery#1036329
- End-to-End Hard-Label Cryptanalytic Model Extraction Using Efficient Sign Recovery#1006780
- Security and Machine Learning#490971
- Is the Hard-Label Cryptanalytic Model Extraction Really Polynomial?#670395
- Is the Hard-Label Cryptanalytic Model Extraction Really Polynomial?#668330
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive