SPDZCoder: Combining Expert Knowledge with LLMs for Generating Privacy-Computing Code

Privacy computing receives increasing attention but writing privacy computing code remains challenging for developers due to limited library functions, necessitating function implementation from scratch, and data-obliviousness requirement, contradicting intuitive thinking and usual practices of programmers. Automating the generation of privacy computing code with large language models (LLMs) can streamline development effort and lower the barrier to using privacy computing frameworks since LLMs exhibit strong capabilities in coding tasks. However, existing LLMs still encounter challenges in code translation for privacy-preserving computation—such as translating Python to MP-SPDZ—due to the scarcity of MP-SPDZ data required for effective pre-training or fine-tuning. Moreover, the lack of benchmark further hinders the evaluation of translation quality. To address the limitations, this work proposes SPDZCoder, a training-free framework that combines LLMs with expert knowledge for generating privacy computing code. Specifically, SPDZCoder employs a rigorous procedure for collecting high-quality expert knowledge to represent the semantic-expressing differences between Python and MP-SPDZ, and derives transformation rules for translating Python to MP-SPDZ based on these knowledge. Then, SPDZCoder progressively converts Python code into MP-SPDZ code using transformation rules in a three-stage pipeline. To evaluate SPDZCoder, we manually constructed a benchmark dataset, SPDZEval, which comprises six data splits, each representing a distinct class of challenging tasks in MP-SPDZ implementation. Extensive experiments demonstrate that SPDZCoder achieves superior performance, significantly surpassing baselines in pass@1 and pass@2. Specifically, SPDZCoder with GPT-4 as its backbone attains overall correctness values of \\(85.94\\%\\) and \\(92.01\\%\\) in pass@1 and pass@2, respectively, whereas the best-performing baseline achieves only \\(63.58\\%\\) and \\(76.36\\%\\) , respectively.

Authors

Institutions

Publication Details

Journal
ACM Transactions on Software Engineering and Methodology
Published
2026-09-18
DOI
https://doi.org/10.1145/3845985
Primary Topic
Advanced Malware Detection Techniques
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
article

SPDZCoder: Combining Expert Knowledge with LLMs for Generating Privacy-Computing Code

Xiaoning Dong, Wei Xu, Yanlin Wang, Jia Li et al.
ACM Transactions on Software Engineering and Methodology
Advanced Malware Detection Techniques
article

SPDZCoder: Combining Expert Knowledge with LLMs for Generating Privacy-Computing Code

Xiaoning Dong, Wei Xu, Yanlin Wang, Jia Li, Ling Huang, Peilin Xin
article en

Abstract

Privacy computing receives increasing attention but writing privacy computing code remains challenging for developers due to limited library functions, necessitating function implementation from scratch, and data-obliviousness requirement, contradicting intuitive thinking and usual practices of programmers. Automating the generation of privacy computing code with large language models (LLMs) can streamline development effort and lower the barrier to using privacy computing frameworks since LLMs exhibit strong capabilities in coding tasks. However, existing LLMs still encounter challenges in code translation for privacy-preserving computation—such as translating Python to MP-SPDZ—due to the scarcity of MP-SPDZ data required for effective pre-training or fine-tuning. Moreover, the lack of benchmark further hinders the evaluation of translation quality. To address the limitations, this work proposes SPDZCoder, a training-free framework that combines LLMs with expert knowledge for generating privacy computing code. Specifically, SPDZCoder employs a rigorous procedure for collecting high-quality expert knowledge to represent the semantic-expressing differences between Python and MP-SPDZ, and derives transformation rules for translating Python to MP-SPDZ based on these knowledge. Then, SPDZCoder progressively converts Python code into MP-SPDZ code using transformation rules in a three-stage pipeline. To evaluate SPDZCoder, we manually constructed a benchmark dataset, SPDZEval, which comprises six data splits, each representing a distinct class of challenging tasks in MP-SPDZ implementation. Extensive experiments demonstrate that SPDZCoder achieves superior performance, significantly surpassing baselines in pass@1 and pass@2. Specifically, SPDZCoder with GPT-4 as its backbone attains overall correctness values of \(85.94\%\) and \(92.01\%\) in pass@1 and pass@2, respectively, whereas the best-performing baseline achieves only \(63.58\%\) and \(76.36\%\) , respectively.

ACM Transactions on Software Engineering and Methodology
Sun Yat-sen University (CN), ShangHai JiAi Genetics & IVF Institute (CN), Nuctech (China) (CN), Tsinghua University (CN)
Openalex Percentile: Top 10%
Advanced Malware Detection Techniques
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.