Porcupine: A Compiler That Translates Plain Text To Encrypted Code On The Go

Homomorphic encryption, a ‘privacy-preserving’ technique, allows computation directly on the encrypted data. However, this encryption technique faces significant performance and programmability challenges.

Researchers from Facebook, New York University, and Stanford University have created a synthesising compiler caller Porcupine to unleash the true potential of homomorphic encryption technique. This compiler can translate plain text to encrypted code on the go. 

The team claimed the compiler had increased the processing speed by 51 percent compared to hand-optimised and heuristic-driven code.

What Is Homomorphic Encryption

The first step while working with encrypted data is decryption. However, it leaves the data vulnerable to attack, defeating the very purpose of encryption. In such a case, an ideal solution would be to have a system that could process information without compromising privacy and security.

Dr Craig Gentry, the creator of the first Fully Homomorphic Encryption scheme, compares the technique a glovebox, a sealed container where you can put your hands to work the material inside, but can’t take anything out of it.

Homomorphic encryption is beneficial when data needs to be outsourced to cloud environments and other partners for research and analytics purposes. The encryption technique makes it possible to analyse data without jeopardising the privacy and have applications in financial services, healthcare, and information technology. Unlike other modern encryption models, the technique doesn’t yield to the decryption bids of quantum computers. 

That said, homomorphic encryption has its share of shortcomings. The technique, being a slowpoke, is not practical in many applications. Plus, several performance overheads and compilation challenges stand in the way of its widespread adoption.

How Does Porcupine Help?

Many scientists are working towards fixing the drawbacks of homomorphic encryption technique. However, not much work has been done in the automatic compilation of homomorphic encryption kernels.

On a broader scale, homomorphic encryption has three major compilation challenges:

  • It supports only a limited set of a single instruction, multiple data (SIMD)-type operators
  • It uses long-vector operands
  • If the ciphertext noise growth is not controlled, it may result in the failure of the decryption process.

In this encryption technique, a programmer is first required to break the input kernel into SIMD addition, multiplication, and rotation instructions. This makes kernel implementation complex. Currently, these kernels are handwritten by experts, making it difficult to scale up. As a result, there is a need for automated compiler support for privacy-preserving computation.

To overcome the challenges, the team has presented an optimising compiler Porcupine. Given a plaintext code, Porcupine automatically synthesises a homomorphic encryption code using a component called Quill. This component helps search for ‘verifiably correct’ kernels and minimises kernel’s costs such as latency and noise accumulation. With Porcupine and Quill, we get a synthesis procedure that automates the mapping and scheduling process of plaintext kernels to the homomorphic encryption instructions.

The Porcupine compiler was tested using a range of image processing and linear algebra problems. This compiler was evaluated using nine kernels to demonstrate that it could successfully translate plain text specification to homomorphic encryption-equivalent implementations. It was found that, over the handwritten-baselines, Porcupine delivered 51 percent faster with a geometric mean of 11 percent across the test kernels.

For smaller programs, Porcupine was able to find the same optimised implementation as the handwritten ones. For larger and complex programs, Porcupine could discover application-specific optimisation involving separable filters.

Wrapping Up

By automating the tasks, Porcupine frees up application designers to focus on other priorities. The researchers believe the homomorphic encryption technique is a rapidly developing area with a lot of scope for improvements, including enhancing compilation infrastructures such as Porcupine.

Read the full paper here.

Download our Mobile App

Shraddha Goled
I am a technology journalist with AIM. I write stories focused on the AI landscape in India and around the world with a special interest in analysing its long term impact on individuals and societies. Reach out to me at

Subscribe to our newsletter

Join our editors every weekday evening as they steer you through the most significant news of the day.
Your newsletter subscriptions are subject to AIM Privacy Policy and Terms and Conditions.

Our Upcoming Events

15th June | Bangalore

Future Ready | Lead the AI Era Summit

15th June | Online

Building LLM powered applications using LangChain

17th June | Online

Mastering LangChain: A Hands-on Workshop for Building Generative AI Applications

20th June | Bangalore

Women in Data Science (WiDS) by Intuit India

Jun 23, 2023 | Bangalore

MachineCon 2023 India

26th June | Online

Accelerating inference for every workload with TensorRT

MachineCon 2023 USA

Jul 21, 2023 | New York

Cypher 2023

Oct 11-13, 2023 | Bangalore

3 Ways to Join our Community

Telegram group

Discover special offers, top stories, upcoming events, and more.

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Subscribe to our Daily newsletter

Get our daily awesome stories & videos in your inbox

Can Apple Save Meta?

The iPhone kicked off the smartphone revolution and saved countless companies. Could the Pro Reality headset do the same for Meta?