ZKCache: a cache side-channel attack on zero-knowledge machine learning systemsZKCache: Cache Side-Channel Attacks on Zero-Knowledge Machine Learning Systems
The authors propose ZKCache, which recovers the model architecture from cache contention during ZKML proof generation; the average operator-type accuracy across four system–model pairs is 98.6%.
A hosted proving service keeps the model graph and hyperparameters confidential. The attacker is an unprivileged process on the same server, with no shared pages or privileged counters, and observes LLC contention during proof generation only via Prime+Probe; weights and private inputs are not recovered.
- Zero knowledge constrains only the content of the proof interaction, not the execution of the proving program. In a hosted ZKML service, model shapes change the memory accesses of proof generation, and a process on the same machine may recover confidential operators, hyperparameters and computation graphs via cache contention.
- ZKCache separates the dummy-layout and synthesis-composite views, learns trace representations for each, then fuses candidates and jointly decodes using source-code-derived convolution relations and graph constraints. The defense groups compatible convolutions into fixed envelopes, hiding per-layer parameters under a developer budget.
- The authors test VGG16 and ResNet-18 each on EZKL and TeleSparse, with 30 single-trace trials per pair. The equal-weight average operator-type and hyperparameter accuracy over the four pairs are 98.6% and 93.2%; ResNet-18 recovers the full topology in 50 of 60 trials.
- The authors state that the specific boundaries and trace models depend on the implementation, and do not prove transfer across binary embeddings; STARK and GPU provers are not evaluated. Results are also affected by cache placement, scheduling, prefetching and database coverage; weights are not recovered, and graphs outside the supported residual graph grammar may not be recoverable.
- Metrics
- Operator-type accuracyHyperparameter accuracyExact topology rate (ETR)
Researchers from HKUST and other institutions propose ZKCache, a cache side-channel attack against zero-knowledge machine learning systems that recovers proprietary model architectures from cache contention during proof generation. The zero-knowledge property protects only the proof text, whereas proof generation is ordinary software whose memory access behavior depends on the hidden model; the attack combines cache contention measurements with source-level model analysis to recover operator types, hyperparameters, and the computation graph without shared memory or privileged performance counters. In tests on VGG16 and ResNet-18 on two open-source Halo2-based systems, EZKL and TeleSparse, operator type recovery accuracy is 98.6% and hyperparameter accuracy is 93.2%, and the exact topology of ResNet-18 (the complete operator type sequence plus all residual connections) was recovered in 83.3% of trials. The paper also proposes a compiler defense that groups shape-compatible layers according to a developer-specified budget, with an end-to-end overhead of 53% for the TeleSparse VGG16 prototype.
Why it was selectedShows that zero-knowledge protects only the proof text itself, that proprietary model architectures in hosted proof services can be recovered by co-resident processes via cache side channels, and presents a compiler defense with 53% end-to-end overhead.
Related events and news
1 events · 0 news mentions
- This event's paper
ZKCache利用缓存侧信道窃取ZKML模型架构
Paper analysis
What problem does this paper attempt to solve?
The authors study whether same-machine cache contention can leak the model architecture kept secret by a ZKML proof service.
Core question: when the proof transcript is zero-knowledge, can ZKML proof generation still hide the proprietary model architecture from a same-machine cache side channel?
- Setting and importance: a hosted proof service keeps the model, weights, compiled circuit, proving key and witness on the server, and the client receives only the proof and the public statement. The authors treat the architecture, operators and hyperparameters as intellectual property that needs protection.
- Gap in existing attacks: the authors state that prior DNN architecture side channels target ordinary inference and rely on shared framework or library pages, physical or privileged observation interfaces, or a specific inference stack; these conditions do not apply to a ZKML prover that shares only the cache.
- New difficulties of the proving trace: proof generation first computes the witness, then recomputes tensors during circuit construction, and then performs the cryptographic proof. An attack must isolate the model-dependent phases, infer shapes from coarse-grained contention, and recover residual connections rather than only the layer sequence.
- Core observation: both model executions in EZKL, dummy-layout and synthesis-composite, contain memory work determined by shape; the authors derive this relation from public source code and use it as trace interpretation and candidate constraints.
- Proposed approach: ZKCache fuses learned dual-view trace evidence with analytic constraints and graph constraints to recover operator types, hyperparameters and the computation graph; it also proposes block-level envelopes defenses grouped by developer overhead budget.
- Threat model:
- Goal: recover operator types, hyperparameters and edges in an attributed directed acyclic graph; do not recover numerical weights or private inputs.
- Knowledge and preparation: before the attack, the attacker can compile and run their own models on the same system and hardware to build shadow profiles; the online attack does not access the prover source code, model, weights or memory.
- Capability: an unprivileged process on the same server, with no shared memory pages and no privileged performance counters, using only Prime+Probe to measure cache contention.
- Victim system: a locally deployed Halo2-based ZKML proof service, with EZKL and TeleSparse as the experimental subjects.
What related research exists?
Related work covers DNN architecture side channels, ZKML systems and zero-knowledge implementation leakage; this paper turns to proof execution.
DNN architecture side channels
- Hong et al. (2018), Liu et al. (2024), Yan et al. (2020): Infer layer sequences, operators and hyperparameters respectively from shared framework calls, matrix dimensions of tiled GEMM, or cache traces of compiled executables; DeepCache also learns repeated trace structures and matches them against a profiled operator database.
- Hong et al. (2020), Liu and Srivastava (2020), Hu et al. (2020): The paper's introduction classifies these as cache side-channel work that recovers layer sequences and tensor dimensions from ordinary inference, including GANRED and DeepSniffer.
- Batina et al. (2019), Yu et al. (2020), Zhu et al. (2021): Recover DNNs using electromagnetic or accelerator bus leakage; Wu et al. (2022) and Liu et al. (2023) reconstruct models from compiled executables. The authors state that these works rely on shared pages, physical or privileged interfaces, or specific inference stacks and compilers.
Zero-knowledge machine learning
- SafetyNets (2017), Mystique (2021), zkCNN (2021): Establish verifiable inference and improve zero-knowledge transformations, convolution proofs and private model support.
- EZKL (2026), Chen et al. (2024): Compile quantized inference into arithmetic constraints, trading off cost, accuracy and expressiveness; EZKL is the source-code audit target of this paper.
- TeleSparse (2025): Reduces Halo2 proof cost through model sparsification and neural teleportation; this paper uses it to test whether leakage persists after switching codebases.
Side channels of zero-knowledge implementations
- Pailoor et al. (2023), Wen et al. (2024): Study implementation issues in zero-knowledge circuits such as under-constraint or inconsistency.
- Mukherjee et al. (2025): Analyzes cache timing leakage in finite-field libraries and ZK-friendly hash implementations. The authors position this paper's distinction as model shapes controlling tensor traversal, circuit rows and assignment scheduling, rather than whether field operations are constant-time.
Experimental controls and evaluation targets
- Feature baselines: Table IV uses Duration only and Handcrafted matcher, and compares generic contrastive learning, single vs. dual views, pooling heads, encoder sharing and constraints item by item.
- Targets and shadow sources: VGG16 and ResNet-18 are evaluated on EZKL and TeleSparse; shadow configurations come from image classification models in the ONNX Model Zoo, and the two target architectures are excluded by graph.
The authors position this paper as prover-aware recovery for ZKML proof generation: modeling two temporal views separately and combining local learned evidence with source-code derivation and whole-graph consistency, rather than directly applying operator matching from ordinary inference.
How does the paper address this problem?
ZKCache preserves weak evidence with dual-view encoding, then jointly recovers the architecture using analytical and graph constraints.
The overall idea is to make the recovery process correspond to the prover's execution structure: ZKCache builds a shadow database offline and freezes the detector, encoder and decoding parameters, processes only one Prime+Probe trace online, and after fusing candidates outputs the feasible architecture with the lowest cost.
Recovery targets and source-code derivation
- Graph representation: the model is an attributed directed acyclic graph, whose nodes contain operator types and hyperparameters, and whose edges represent tensor flow, branching, shortcuts and merges. Convolution dilation is fixed at 1 and is neither recovered nor scored.
- Two views: dummy-layout traverses tensors during circuit sizing but does not write Halo2 cells; synthesis-composite recomputes intermediate activations and interleaves tensor accesses and cell assignments on the same timeline.
- Three kinds of evidence: the dummy-layout stream provides work volume and repetition counts; the tensor-access stream in synthesis-composite provides stable window order and stride clues, and the assignment stream provides write volume. Figure 1 and Table V compare the complementary features of Conv, MaxPool, ReLU and FC.
- Convolution relations: the core size relations are Ldot=(Cin)/gKhKw, Ndot=BCoutHoWo, describing the dot-product length and the repetition count respectively. The output grid, window overlap and assignment volume together rule out inconsistent candidates; stride is provided as primary evidence only by the tensor-access stream.
Shadow profiling and trace preparation
- Target versions: EZKL 23.0.5 and TeleSparse 1.0.0, both using native CPU proving; VGG16 and ResNet-18 are imported with fixed inputs, quantization, circuits and proving configurations.
- Database construction: configurations are extracted from image classification models in the ONNX Model Zoo, with the target graphs excluded entirely; each joint key q=(t,h) is compiled into an isolated single-operator circuit, and 60 complete traces are collected per target system, covering new inputs, process restarts, allocation and scheduling conditions.
- Cache collection: eviction sets are constructed for 2,048 candidate LLC sets, followed by priming, a 2,000-cycle wait, and probing in permuted order; mutual information selects m=64 sets for each system and hardware.
- Boundary recovery: full-request cross-correlation and dynamic time warping align the coarse phases, and change-point detection and dynamic programming determine operator boundaries. Low-confidence views are discarded at that position; shadow instrumentation labels are used only for training and the oracle upper bound, and are unavailable to the online attack.
Dual-view representation and training
- Encoding structure: Fd encodes dummy-layout and Fs encodes the full synthesis-composite; Fs is followed by two attention-pooling heads, tensor-access and assignment, without splitting the interleaved timeline into additional phases.
- Network parameters: both encoders contain three residual 1-D convolution blocks with 64, 128 and 128 channels; each head outputs a 128-dimensional normalized embedding, which is then projected to 64 dimensions into the shared dual-view space.
- Training objective: Lrep=Lintra+α Lcross+β Lsrc, combining within-view supervised contrast, cross-view alignment of the same execution, and source-code descriptor distance supervision. Training runs for 120 epochs with AdamW, batch size 256, learning rate 3×10−4, weight decay 10−4 and temperature τ=0.07.
- Data perturbations: these include 10% time warp, 0.05 standard deviation latency jitter, short gaps covering at most 1% of a segment, and 10% monitored-set dropout; after training, single embeddings and class prototypes are saved per system and hardware.
Candidate fusion and architecture decoding
- Retained candidates: each view independently retrieves joint keys, and the union of the top-k is taken rather than the intersection, retaining ties within a calibrated margin around the k-th item; all learned variants use k=5. Type evidence takes the minimum distance over the hyperparameter keys of that type, but does not fix the type first.
- Calibrated fusion: held-out calibration maps cosine distances to a comparable scale, then weights them by fixed view reliability, alignment and boundary quality; when a view is discarded, the weights are renormalized.
- Analytic and graph constraints: convolution candidates are checked for output size, padding, groups, window overlap and assignment volume; graph constraints propagate tensor shapes and check both ends of residual Add, cycles and merges. Shape disagreements caused by missing database keys are counted as a cost rather than rejected outright.
- Final search: sequences containing merges use beam search over identity/projection shortcuts; without merges it reduces to dynamic programming over propagated shapes. The system never refuses and always outputs a top-1, so errors all count toward the metric accuracy.
Budgeted block envelopes defense
- Fixed envelopes: the compiler buckets by output resolution, stride, operator type and successor semantics, then attempts to merge similar shapes; all convolutions in a group execute the full profile range, and inactive work is represented by zero-sum masks that cannot be skipped by data-dependent branches.
- Developer budget: a per-layer cap Blayer and a whole-network cap Bnet limit the relative work volume, and the compiler reduces observable profiles under the constraints. The defense intentionally exposes a coarser profile identifier and does not hide operator types.
- Prototype settings: TeleSparse VGG16 uses Blayer=4×, Bnet=2×, with automatically generated envelope groups and a fixed schedule; the paper reports one measured design point, not a general constant.
What experiments did the paper conduct?
The four system–model pairs are each tested on 30 single traces, and the components are ablated, the oracle bound is examined and the defense is evaluated.
Experimental setup
- Targets: VGG16 and ResNet-18 run on EZKL 23.0.5 and TeleSparse 1.0.0 respectively, for four system–model pairs in total; no other neural network models are trained or evaluated.
- Number of trials: 30 independent trials per pair, each with a new input and a process restart, and the attack receives only one trace; recovery accuracy is the mean of 30 per-trial percentages, and component ablations are averaged with equal weight over the four pairs.
- Target scale: VGG16 has 37 nodes, 113 hyperparameter fields and 36 edges; ResNet-18 has 49 nodes, 147 fields and 56 directed edges (Table II, Section V-B).
- Database coverage: The instance-weighted coverage of complete configuration keys for the four pairs is 97.3%, 95.9%, 94.6% and 91.8% respectively (Table II); uncovered keys remain in the denominator of hyperparameter accuracy.
- Metric definitions: Operator-type accuracy penalizes missing or extra operators; Hyperparameter accuracy counts only the pre-registered fields of nodes whose type prediction is correct, and tuple fields require all components to match. ETR requires the complete operator type sequence and all graph edges to match, and does not require all hyperparameter tuples to be covered by the database.
- Hardware environment: Appendix C Table VI is Intel Core i7-9700K, bare metal; the victim is pinned to core 2 and the attacker to core 6, sharing only the LLC. Turbo Boost is disabled, hardware prefetching remains at BIOS default; no LLM judge or human rating is used.
Main results
Swipe horizontally to read the table
System Model Operator-type accuracy Hyperparameter accuracy ETR (auxiliary metric) EZKL VGG16 99.4% 95.6% 93.3% EZKL ResNet-18 98.8% 94.1% 86.7% TeleSparse VGG16 98.5% 92.7% 90.0% TeleSparse ResNet-18 97.7% 90.4% 80.0% According to Table III; each cell is 30 trials, and the first two items are means of per-trial accuracy.
- Equal-weight average: The operator-type and hyperparameter accuracy over the four pairs are 98.6% and 93.2% respectively. ResNet-18 fully matches the topology in 26/30 trials on EZKL and 24/30 on TeleSparse, 50/60 in total, i.e., 83.3%.
- System differences: The authors state that TeleSparse's lower profiled-key coverage and larger sparsity-dependent trace variation co-occur with its lower recovery rate; the paper does not make a causal decomposition on this basis.
- Decoding path: All results use automatic boundaries and the full pipeline; ResNet-18 uses residual beam search because the recovered sequence contains merges, while VGG16 uses sequential dynamic programming. The two systems are trained and built separately, and the authors do not claim portability across binary representations.
Component ablation and boundary upper bound
- Representation evolution: In Table IV, Duration only achieves 58.2%/36.4% operator/hyperparameter accuracy, Handcrafted matcher 65.5%/44.9%; shared encoder plus dual pooling heads 85.4%/80.3%, and the full representation with source-code supervision 86.7%/85.8%.
- Constraint contribution: The full representation with analytical constraints and then graph constraints added in turn reaches 97.4%/90.9% and 98.6%/93.2%. The authors conclude from this that learned local evidence and explicit consistency are complementary.
- oracle segmentation: Replacing only the view boundaries reaches 99.2%/94.5%, 0.6 and 1.3 percentage points higher than the full attack; the authors attribute the remaining gap of 0.8 and 5.5 percentage points mainly to similar or missing database configurations. This row is an upper bound, not the main attack result.
Defense prototype and security re-test
- What was tested: Budgeted block envelopes are enabled on TeleSparse VGG16 with Blayer=4× and Bnet=2×, and ZKCache is rerun with the same single-trace pipeline and hyperparameter metrics.
- Results: Hyperparameter recovery accuracy drops from 92.7% undefended to 24.6%, a reduction of 68.1 percentage points; the normalized end-to-end overhead of the protected prover is 1.53×, i.e., an increase of 53%, below the requested Bnet=2× (Section VI).
- Authors' interpretation: This metric covers all pre-registered fields of supported parameterized operators, and the drop includes both convolution tuples being directly hidden and graph decoding losing exact convolution anchors. The authors do not attempt to hide operator types and call this orthogonal future work.
Other ablations and analyses
- Single view: Generic contrastive with dummy-layout only is 72.3%/53.8%, and synthesis-composite only is 77.8%/61.7% (Table IV, operator/hyperparameter).
- Dual views, single head: Two views, single synthesis-composite pooling head is 81.6%/68.9% (Table IV).
- No encoder sharing: Two views, dual pooling heads, untied encoders is 83.8%/74.8%; the shared encoder adds 1.6 and 5.5 percentage points relative to it.
- Effect of dual heads: Shared encoder with dual heads adds 3.8 and 11.4 percentage points relative to a single head; both heads still process the same synthesis-composite segment.
- Negative scope: The cryptographic proving phase can only help estimate the total circuit size and locate the end of synthesis; the authors state that specific layers or strides cannot be identified from this phase.
What are some points that can be further explored?
The authors list limitations including implementation dependence, measurement noise and database coverage, and leave the problem of hiding operator types open.
Limitations and future directions noted by the authors
- Implementation specificity: Section VII states that the method can be adapted to other PLONKish implementations that still retain model-dependent sizing or synthesis, but the specific timing boundaries and learned-trace stack depend on the implementation; the TeleSparse results do not demonstrate cross-binary embedding transfer.
- Other provers: Section VII explicitly places STARK- and GPU-based provers outside the evaluation, and adapting to them would require re-analyzing execution scheduling, collectors and learned models.
- Measurement and training noise: Section VII states that Prime+Probe has lower resolution than shared-memory attacks and depends on placement, stable scheduling and profiling; prefetchers and allocators can create or eliminate signatures, contrastive training cannot guarantee allocation invariance, and it may learn shortcuts from duration, process placement or system noise.
- Database coverage: Section VII states that unseen parameter tuples will not be created by nearest-neighbor retrieval, and exact recovery is bounded by database coverage.
- Graph grammar scope: Section VII states that graphs outside the supported residual grammar may not be recoverable, or may leave multiple feasible topologies.
- Future defenses: Section VI states that the current work does not hide operator types; executing in a generic circuit style and masking all supported paths costs more than its convolution work-proxy and developer-budget model, and hiding types is orthogonal future work.
Scope of experimental coverage
- Subjects and repetitions: the experiments contain only the four combinations of EZKL and TeleSparse with VGG16 and ResNet-18, with 30 single-trace trials per pair; Table III reports results pair by pair.
- Deployment conditions: Appendix C is a bare metal environment on one Intel Core i7-9700K, with an LLC shared across physical cores; the shadow and target prover are on the same machine, with no VM or container.
- Recovery scope: Sections II-E and VII limit the target to tensor dimensions, operators and graph structure, and do not recover numerical weights, private inputs, sparsity masks or quantized values.
- Defense evaluation: Section VI gives only one budget design point for TeleSparse VGG16, with re-measured metrics of hyperparameter recovery accuracy and normalized end-to-end load.
- Statistics: the paper reports 30 trials and the mean for each pair, and does not report confidence intervals or statistical significance tests; it also does not report end-to-end recovery experiments across hardware or across binaries.
Summarize the main content of the paper
The authors state that the zero-knowledge property of ZKML transcripts does not equal leak-free execution, and present a cache attack and a budget defense.
ZKCache is a cache side-channel study of Halo2-based ZKML provers: in a hosted proof service that keeps the model architecture secret, an unprivileged process on the same machine shares no memory pages and uses no privileged counters, and observes only Prime+Probe contention during proof generation.
- Problem: the model shape determines the tensor traversal and circuit assignment of the proving program, and this execution information is not covered by the zero-knowledge transcript. The authors do not attack Halo2 soundness, nor do they recover weights or private inputs.
- Method: separate the dummy-layout and synthesis-composite views, and extract interleaved evidence with a shared encoder and dual pooling heads; after joint-key retrieval, decode using convolution relations derived from source code, tensor shapes and residual graph constraints.
- Main results: the equally weighted average across the four system–model pairs in Table III is 98.6% operator-type accuracy and 93.2% hyperparameter accuracy; with 30 trials per pair, the attack uses only one trace.
- Topology recovery: ResNet-18 achieves 26/30 and 24/30 complete operator-sequence and graph-edge matches on EZKL and TeleSparse respectively, for a combined ETR of 83.3%; this metric does not require all hyperparameter keys to be covered by the database.
- Ablation evidence: in Table IV the full representation gives 86.7%/85.8%, and adding analytic and graph constraints reaches 98.6%/93.2%; the oracle segmentation upper bound is 99.2%/94.5%.
- Defense and conclusion: the TeleSparse VGG16 prototype at Blayer=4×, Bnet=2× reduces hyperparameter recovery from 92.7% to 24.6%, with an end-to-end load of 1.53×. The authors conclude that private-architecture deployments should include both model-dependent timing views in the side-channel boundary, and that constant-time field arithmetic alone is not sufficient.