I gave this talk at the 7th Privacy-Preserving Machine Learning Workshop (PPML 2026). The workshop was an affiliated event of CRYPTO 2026 at UC Santa Barbara.

Problem statement. FHE code is difficult to write. The programmer must do all of these tasks:

  • Track the multiplicative depth of each block of code.
  • Replace each operation that CKKS does not support with a polynomial approximation.
  • Monitor the growth of the noise.
  • Select the position of each bootstrapping operation.
  • Select cryptographic parameters that give correct results, sufficient speed, and the target security level.

Today, only applied FHE experts do this work reliably. This gap in expertise is one of the main obstacles to the adoption of FHE.

The agent. Our agent removes this manual work. The user writes a prompt in plain language. The agent returns CKKS code for the OpenFHE-Python library. The user writes no FHE code.

The agent divides FHE development into a pipeline of seven skills. An orchestrator routes the work between the skills, but it writes no code. Each skill validates its output before the next skill starts. If a skill fails, the pipeline stops immediately. This behavior prevents a large token cost on a broken workflow.

The first four skills work on cleartext data, without encryption:

  1. Prompt Formalizer turns the free-form prompt into a formal specification. It marks the sensitive data and gives a verdict of feasible or infeasible.
  2. FHE Algorithm Design designs an FHE-friendly algorithm in three parts: client run, server run, and post process. It also writes cleartext Python code, which becomes the ground truth for the later tests.
  3. Chebyshev Approximation fits a polynomial to each non-linear function. The default error threshold is 0.001.
  4. Bootstrap Planning divides the circuit into blocks that fit the level budget. This skill starts only when the estimated depth is more than 20.

The last three skills make the encrypted program:

  1. Code Generator translates the plan into OpenFHE-Python code. It selects the cryptographic parameters, makes the crypto context and the keys, and runs the code against the ground truth.
  2. Optimizer applies dense packing, depth minimization, lazy reduction, and multi-threaded execution.
  3. Verifier makes sure that the program runs, that it agrees with the ground truth within the precision margin, and that the parameters give 128-bit security.

Case study 1: private MLP inference. The network is a binary classifier with four fully connected layers (8-16-16-8-2), three tanh activations, and a softmax output. The agent generated correct code with 128-bit security. The encrypted inference took 2.8 min, and the full session took 61.8 min, 12.03 M tokens, and US $11.77.

Case study 2: fetch-by-similarity. This challenge comes from the FHE Benchmarking Suite Consortium. The server holds 50,000 encrypted records. Each key is a unit vector of 128 dimensions, and each payload holds 7 integers of 16 bits. The client sends an encrypted query. The server returns the records with a cosine similarity of more than 0.8, or the count of those records. The agent solved both variants of the challenge. The agent generated and validated functional code in about 57 min, with 13.1 M tokens and a cost of US $12.47.

Abstract
Developing functional, optimized, and secure FHE code is a challenging task that typically requires expert cryptographers. It demands carefully tracking multiplicative depth, monitoring noise growth, strategically placing bootstrapping operations, and selecting appropriate cryptographic parameters. Given the emergence of powerful AI coding agents, we ask: can we automate this process, to what extent, and how reliably?

In this work, we present a multi-skill, LLM-based coding agent that compiles a free-form natural-language prompt into functionally correct and secure CKKS code for the OpenFHE-Python library, without the user writing any FHE code by hand. Our agent decomposes the FHE development process into a seven-stage pipeline that first designs and validates an FHE-friendly algorithm for the invoked task using cleartext data, and then lowers it to FHE. We evaluate the agent on two case studies: (1) private MLP inference and (2) the encrypted fetch-by-similarity challenge of the FHE Benchmarking Suite Consortium. Experiments demonstrate that the agent successfully generates functionally correct and secure FHE code for both case studies, suggesting a positive answer to the research question posed above.

PPML 2026 workshop

CRYPTO 2026