用大模型自动配置加密推理参数,让不懂密码学的人也能用上隐私保护的机器学习。
FHE-Agent: Automating CKKS Configuration for Practical Encrypted Inference via an LLM-Guided Agentic Framework
- 用大模型+工具链分步搜索,先筛无效配置再优化关键层
- 在复杂模型上实现128位安全且低延迟,比固定策略快3倍以上
- 适合想用加密推理但缺乏密码学知识的开发者和研究者
全同态加密(FHE),尤其是CKKS方案,是实现隐私保护机器学习即服务的有力技术,但其实际应用面临巨大障碍:严重依赖领域专业知识。配置CKKS涉及环尺寸、模数链和打包布局之间的紧密耦合空间。缺乏密码学知识的实践者只能使用基于固定启发式方法的编译器,这些“一次性”工具常生成过度冗余或完全无法为深层网络找到可行解的配置。我们提出FHE-Agent,一个通过大语言模型(LLM)控制器与确定性工具链结合的智能体框架,将搜索过程分解为全局参数选择与逐层瓶颈修复。该框架采用多保真度工作流,先用低成本静态分析剔除无效配置,再对最有希望的候选方案进行昂贵的加密评估。我们在Orion编译器上实现了FHE-Agent,评估了标准基准(MLP、LeNet、LoLa)和更深层架构(AlexNet)。结果表明,FHE-Agent在精度和延迟上均优于朴素搜索策略;更重要的是,它能自动发现复杂模型下128位安全的可行配置,而基线启发式方法和单次提示无法生成有效设置。
原文摘要 · Abstract (English)
Fully Homomorphic Encryption (FHE), particularly the CKKS scheme, is a promising enabler for privacy-preserving MLaaS, but its practical deployment faces a prohibitive barrier: it heavily relies on domain expertise. Configuring CKKS involves a tightly coupled space of ring dimensions, modulus chains, and packing layouts. Without deep cryptographic knowledge to navigate these interactions, practitioners are restricted to compilers that rely on fixed heuristics. These "one-shot" tools often emit rigid configurations that are either severely over-provisioned in latency or fail to find a feasible solution entirely for deeper networks. We present FHE-Agent, an agentic framework that automates this expert reasoning process. By coupling a Large Language Model (LLM) controller with a deterministic tool suite, FHE-Agent decomposes the search into global parameter selection and layer-wise bottleneck repair. The agents operate within a multi-fidelity workflow, pruning invalid regimes using cheap static analysis and reserving expensive encrypted evaluations for the most promising candidates. We instantiate FHE-Agent on the Orion compiler and evaluate it on standard benchmarks (MLP, LeNet, LoLa) and deeper architectures (AlexNet). FHE-Agent consistently achieves better precision and lower latency than naïve search strategies. Crucially, it automatically discovers feasible, 128-bit secure configurations for complex models where baseline heuristics and one-shot prompts fail to produce a valid setup.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。