arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.00363cs.CRcs.AIcs.SE
收藏

SPDZCoder:结合专家知识与LLM生成隐私计算代码

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

Tsinghua University(清华大学);Peking University(北京大学)

Xiaoning Dong, Peilin Xin, Jia Li, Wei Xu

AI总结:

本文提出SPDZCoder框架,结合专家知识与LLM,无需额外训练数据即可通过三阶段流水线将Python代码转换为MP-SPDZ隐私计算代码,并构建了SPDZEval基准,在pass@1和pass@2上显著超越基线。

摘要:

隐私计算日益受到关注,但由于库函数有限,需要从头实现函数,且数据无关性要求与程序员的直觉思维和常规实践相矛盾,编写隐私计算代码对开发者而言仍具挑战性。利用大型语言模型(LLM)自动生成隐私计算代码,可以简化开发工作并降低使用隐私计算框架的门槛。然而,由于有效预训练或微调所需的MP-SPDZ数据稀缺,现有的LLM在面向隐私保护计算的代码翻译(例如将Python翻译为MP-SPDZ)方面仍面临挑战。此外,缺乏基准进一步使翻译质量的评估变得复杂。针对这些局限性,本工作提出了SPDZCoder,这是一个基于规则的框架,将LLM与专家知识相结合,无需额外训练数据即可生成隐私计算代码。具体而言,SPDZCoder采用严格程序收集高质量专家知识,以表示Python与MP-SPDZ之间的语义表达差异,并基于这些知识推导出将Python翻译为MP-SPDZ的转换规则。随后,SPDZCoder在三阶段流水线中使用转换规则逐步将Python代码转换为MP-SPDZ代码。为评估SPDZCoder,我们手动构建了一个基准数据集SPDZEval,它包含六个数据划分,每个划分代表MP-SPDZ实现中一类独特的挑战性任务。大量实验表明,SPDZCoder取得了卓越性能,在pass@1和pass@2上显著超越基线。具体而言,SPDZCoder在pass@1和pass@2上分别达到85.94%和92.01%的总体准确率,而表现最佳的基线则分别为63.58%和76.36%。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑