用专家知识+大模型自动生成隐私计算代码,准确率超基准30%以上。
SPDZCoder: Combining Expert Knowledge with LLMs for Generating Privacy-Computing Code
- 结合专家规则与LLM,分三阶段将Python代码转为MP-SPDZ代码
- 在6类挑战任务上,pass@1正确率达85.94%,pass@2达92.01%
- 自建SPDZEval数据集,解决隐私计算代码生成缺乏评估标准问题
隐私计算受关注日益增加,但开发者编写隐私计算代码仍具挑战性,因库函数有限需从零实现,且需满足数据无关性要求,违背程序员直觉与常规实践。利用大语言模型自动化生成隐私计算代码可降低开发门槛。然而,现有模型在隐私保护计算代码转换(如从Python转为MP-SPDZ)方面仍面临困难,主要因缺乏用于有效预训练或微调的MP-SPDZ数据。此外,缺乏基准也阻碍了质量评估。为此,本文提出SPDZCoder,一种无需额外训练数据的基于规则的框架,融合大模型与专家知识生成隐私计算代码。SPDZCoder通过严谨流程收集高质量专家知识,刻画Python与MP-SPDZ间的语义差异,并据此推导出转换规则。随后,采用三阶段流水线逐步将Python代码转化为MP-SPDZ代码。为评估性能,手动构建了包含六个数据划分的基准数据集SPDZEval,涵盖MP-SPDZ实现中的六类挑战性任务。大量实验表明,SPDZCoder表现优异,在pass@1和pass@2上分别达到85.94%和92.01%,显著优于最佳基线模型(63.58%和76.36%)。
原文摘要 · Abstract (English)
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-oblivious requirement, contradicting intuitive thinking and usual practices of programmers. Automating the generation of privacy computing code with Large Language Models can streamline development effort and lower the barrier to using privacy computing frameworks. 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 a benchmark further complicates the evaluation of translation quality. To address the limitations, this work proposes SPDZCoder, a rule-based framework that combines LLMs with expert knowledge for generating privacy-computing code without requiring additional training data. Specifically, SPDZCoder employ a rigorous procedure for collecting high-quality expert knowledge to represent the semantic-expressing differences between Python and MP-SPDZ, and to derive 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 show that SPDZCoder achieves superior performance, significantly surpassing baselines in pass@1 and pass@2. Specifically, SPDZCoder attains an overall correctness of 85.94% and 92.01% in pass@1 and pass@2, respectively, whereas the best-performing baseline achieves 63.58% and 76.36%, respectively.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。