Securing ChatGPT & LLMs with End-to-end Encryption

Date: 18-01-24


Securing ChatGPT & LLMs with End-to-end Encryption

A booming area of technological advancement is Generative AI. OpenAI’s ChatGPT reached 100 million monthly active users only two months post-launch, making it the fastest-growing consumer app ever. Bloomberg finds that Generative AI could become a $1.3 trillion market by 2032, growing at a CAGR of 42% over the decade.

GenAI uses Large Language Models (LLMs) trained on public or custom data. While users of any AI application understand that data is the fuel for these solutions, privacy concerns such as the following loom large:

  • Users are denied knowledge about how their data is used, stored, and shared once it enters a GenAI chatbot.
  • GenAI applications generate content based on proprietary information, raising concerns about intellectual property theft. Three artists sued multiple GenAI platforms for AI using their original work without a license to train in their style and ultimately creating unauthorized derivative works.
  • In a lack of data privacy and governance, LLMs may inadvertently reveal Personally Identifiable Information.

On November 2, 2023, a Stanford University student, Kevin Liu, used a prompt injection attack on “New Bing”, Microsoft’s conversational bot powered by GenAI, launched a day ago. The attack revealed Bing Chat’s initial prompt fed by Microsoft to govern how the service would interact and behave with its users, which was intended to be kept private.

GenAI has a long way to go to quell these concerns. Let’s delve into the crucial aspect of end-to-end encryption for protecting LLMs data.

The Need for Encryption in LLMs

Encrypting LLMs is the answer if you want to use GenAI to:

1. Contextualize LLMs for enterprises

For internal GenAI use, enterprises would want to safeguard internal sensitive information while enabling GenAI to boost employee productivity. Customer-facing GenAI applications require custom data and robust privacy features on LLMs to safeguard proprietary data.

2. Navigate regulatory frameworks

Sharing private datasets with third parties (GenAI chatbots) can open a company to severe fines for non-compliance with regulations such as GDPR and CCPA. Countries such as Italy implemented a temporary ban on ChatGPT over data protection and privacy concerns. Several other European countries are assessing the tool’s compliance with the GDPR.

3. Fortify user interest

Cambridge Analytica comes to mind as one of the most controversial breaches of user privacy, where the political consulting company used the personal information of millions of Facebook (Meta) users for political advertising. Encrypting LLM data would be an ethical step in the general direction of ensuring data privacy.

4. Safeguard proprietary data

In an alarming incident, employees at Samsung Semiconductor used ChatGPT’s AI writer to resolve issues in their source code, feeding proprietary source code into a publicly available OpenAI, which would use the data to train itself. In two other instances at Samsung, proprietary information was provided to ChatGPT, raising IP and data privacy concerns and leading the company to ban the tool.

5. Unlock use cases

Most of all, it’s exciting to see encryption technologies coming to LLMs as they unlock potential use cases of GenAI. Developers get extremely restricted when privacy is insufficient or nearly impossible. Several use cases in industries such as finance, banking, law, and healthcare can’t come to fruition if data privacy remains a bottleneck.

Privacy concerns continue to abate innovation and commercialization of LLMs in enterprises for serious use cases particularly in sensitive industries, including finance and healthcare.

It’s not news that OpenAI’s ChatGPT refines its abilities using user data, and Google’s Bard has retention policies that contradict users’ data privacy expectations. This underscores a growing industry need for a user-centric approach to data privacy in GenAI implementation.

Various Encryption Solutions for LLMs

First, let’s consider encryption solutions that don’t work for modern technologies. Traditional encryption methods, such as AES and DES encryption, fall short in scenarios where data needs to be processed and safeguarded.

End-to-end encryption methods like those adopted by Web2 messaging services such as WhatsApp only protect data in transit. “It’s just a protection, a layer of encryption on top of the transmission”, says Pascal Paillier, CTO at Zama.

Why do these solutions fall short? If you want to process medical health data for predictive analysis, you’d want to preserve data privacy even during processing, which traditional encryption methods can’t achieve.

This is where Fully Homomorphic Encryption (FHE) comes in as a game-changer, allowing operations on data without ever exposing it.

Public LLMs are attack vectors unless you use FHE

FHE enables third parties to perform operations on underlying data without decrypting it. FHE is the third pillar of encryption. “We’ve had encryption in transit. We had encryption at rest. We never had encryption at use.”, says Paillier. FHE represents encryption at use.

This is what we are solving for at Fhenix, along with our partner, Zama. Our mission is to empower developers and data scientists to leverage FHE without having to learn cryptography to secure LLMs.

Here’s how FHE will end-to-end encrypt LLMs and ChatGPT:

  • Encrypt the query and contextual data using a secret key known only to the user
  • Send the encrypted prompt to the service provider running the LLM
  • Compute the LLM on encrypted data and produce an encrypted response
  • Send the encrypted response to the user, who then decrypts it using their key

This way, FHE would encrypt all communications between the user and the GenAI bot so that the application owners don’t retain and misuse users’ sensitive data. FHE would enable better use cases of GenAI by eliminating the privacy issue and permitting users to feed custom datasets to derive the most value from GenAI.

While FHE is the solution, the journey to implementing it isn’t without its hurdles. Let’s explore the challenges and how we’re tackling them.

Challenges and the Road Ahead

While FHE computation performance has improved by 20x in the last 3 years, we still have a ways to go before FHE encrypts LLMs. Estimates show that generating one encrypted LLM token would need up to 1 billion FHE operations, due to which FHE remains cost-prohibitive.

However, three significant trends are contributing to FHE readiness for LLMs:

  • Compression techniques are making LLMs faster, resulting in less data to compute homomorphically. This will likely bring a 2x performance improvement for FHE.
  • The cryptography behind FHE is improving, and we can realistically expect a 5x acceleration in the next five years.
  • Several companies, including Duality, Intel, and IBM, are currently developing custom ASICs and FPGAs optimized for bootstrapping and homomorphic operations. These companies are targeting a 1,000x speedup for their first generation (planned for 2025) and up to 10,000x for their second generation. Consequently, you’d only need about 5 FHE accelerators to run an encrypted LLM, on par with the number of GPUs you need today for non-encrypted LLMs.

Our focus at Fhenix so far has been to make FHE possible. Next, we aim to make it feasible.

Fhenix: Bringing FHE to LLMs

Despite the challenges ahead, the FHE landscape is evolving. Fhenix, partnered with Zama, is at the forefront of this transformation with the FHE-enabled EVM protocol that provides fully homomorphic encryption natively for Solidity developers.

Fhenix was founded by Guy Zyskind, the Founder of Secret and is led by Guy Itzhaki, a former Director at the Homomorphic Encryption & Blockchain Group at Intel.

Fhenix enhances the developer experience and empowers developers to use the same tools they already do but with added privacy using fhEVM. Read more about Fhenix, a pioneer in FHE, here. Stay tuned for more advancements and news!

Cracking the Code: Overcoming Challenges of On-chain FHE/ part 1

Date: 09-01-24


Cracking the Code: Overcoming Challenges of On-chain FHE/ part 1

TLDR:

  • FHE vs. ZKP:Fully Homomorphic Encryption (FHE) offers a more flexible solution than ZKPs for blockchain, enabling private data validation. Their combination could transform confidential decentralized finance (DeFi).
  • Challenges in FHE Implementation: Implementing FHE on blockchain involves overcoming hurdles like developing advanced FHE schemes, creating user-friendly libraries and compilers, establishing secure threshold decryption, optimizing data availability, and enhancing hardware.
  • Choosing FHE Schemes and Libraries: For effective FHE use, developers must select appropriate schemes and libraries, considering the trade-offs between computational efficiency and accuracy. New Web3 FHE libraries and compilers aid immensely.
  • Advances in Secure Threshold Decryption: Key to FHE’s success is secure decryption, with emerging solutions including N/2 threshold decryption and hardware-based security enhancements.

Introduction
Fully Homomorphic Encryption (FHE) is one of the most promising areas of blockchain research, enabling data to be proven as valid without revealing any of the underlying data details.

While zero-knowledge proofs (ZKPs) have gained widespread attention as of late, and are great for certain use cases, they are insufficient for the creation of confidential computing blockchain applications. FHE has many advantages over ZK technology and use cases could include a private Uniswap, trustless gaming applications, private payments, and much more which we’ve covered elsewhere.

It turns out that combining both ZKPs and FHE could create a fully generalizable, confidential system. ZKPs can prove the integrity of data and computation, while FHE can process arbitrary computations over encrypted data that remains secure throughout its entire journey.

This will fundamentally shift the blockchain landscape, but both are emerging technologies and FHE currently faces 5 major challenges.

  1. Nascent FHE Schemes, Libraries, and Compilers: a need for technological advancements and a computing paradigm shift.
  2. Secure Threshold Decryption
  3. ZKPs for User Inputs + Computing party
  4. Data Availability Optimization: the need for a secure, performant, and cost-efficient DA layer for FHE.
  5. FHE Hardware: optimized software/hardware and FHE accelerator advancements.

This is a 2-part series that will illustrate the rapid steps being taken to address each of these challenges so that FHE can be easily implemented into the developer workflow.

Challenge 1: Nascent FHE Schemes, Libraries and Compilers

First, let’s look at each term in turn:

  1. Schemes: standardized and systematic approaches that help developers manage data or code to efficiently solve problems. This could include architectural designs, patterns, and best practices.
  2. Libraries: collections of pre-written code that programmers can use to efficiently perform common tasks or access specific functionalities.
  3. Compilers: these translate high-level programming languages into low-level machine code that can be easily executed on a blockchain platform.  Developers require a fully functional FHE compiler that handles complexities on their behalf, such as parameter selection.

Various challenges exist. For instance, existing FHE schemes (particularly TFHE) are around 1000x slower compared to plain computation. Developers need easy-to-use front-end libraries that abstract away the low-level FHE complexities, and a fully functional FHE compiler that handles complexities on their behalf.

We’ll cover the challenges associated with each, before showcasing how the appropriate solution is nearly here.

FHE Schemes

To begin implementing FHE into one’s application, the appropriate scheme must be chosen, which can be summarized in the table below.

While not all terms may be familiar to the reader, they may be worth further exploration if of interest.

Each of the above has inherent trade-offs, such as BGV/BFV being ideal for DeFi, but requiring knowledge of a circuit’s depth in advance. While FHEW/TFHE could also be used in DeFi, BGV/BFV are considered more efficient due to batching operations whereby multiple computations are batched together.

Developers must choose their scheme very carefully as it will impact other design decisions and future application performance, though for blockchain purposes, Exact Arithmetic tends to be most beneficial.

FHE Libraries

Depending on the chosen scheme, there are different libraries available to aid in the front-end programming experience.

Each scheme has a different relationship with each library, and the developer must also set parameters for their choices.

Another challenge for developers is that writing FHE programs requires a mental shift. For instance, one cannot write a branch (if-else) depending on a variable in the program, because programs cannot directly compare the variables like plain data. They also cannot write loops in their code for the same reason.

Solution: Web3 FHE Libraries & Compilers

Both FHE libraries and compilers have already been developed by leading technology firms such as Google and Microsoft, but primarily use the CKKS scheme which is focused on Machine Learning. These cannot adequately support ZKP schemes nor the intricacies of program chaining, which involves the sequential connection of multiple computer programs or software modules. Instead, DeFi-specific schemes such as BFV/BGV are needed. Fortunately, these Web3 FHE libraries and compilers now exist and are addressing all of the above challenges.

1. FHE Libraries

Zama’s open source TFHE-rs (Fully Homomorphic Encryption over the Torus) library enables the creation of FHE-based smart contracts in Solidity for Zama’s fhEVM. Additionally, there are ongoing developments in the TFHE ecosystem, with libraries like TFHE Rust and TFHE C++ (though the latter is still in the process of being fully developed).

2. FHE Compilers

Sunscreen FHE Compiler is a recently emerged Web3 compiler designed for DeFi use cases, allowing developers to program in Rust. It relies on Microsoft’s SEAL library and utilizes the BFV scheme.  Sunscreen simplifies the complexities mentioned earlier by offering features such as automatic parameter selection, circuit setup, data encoding, key selection, and more. Notably, it has demonstrated high performance among FHE compilers.

Moreover, the ongoing development of other FHE compilers signals positive advancements in this field, with the expectation of continued optimizations in the future.

Challenge 2: Secure Threshold Decryption

Given that FHE provides the computation of encrypted data, there’s a need to have a secure encryption and decryption key for the data to start its journey or arrive at its destination.

Therefore, there’s a need for an extremely secure and yet efficient threshold decryption protocol. This refers to a protocol or mechanism used to collectively decrypt data in a secure and distributed manner. It ensures that multiple parties must cooperate to decrypt information, making it difficult for any single entity to corrupt the process.

Currently, there are two bottlenecks here:
1. Overhead: FHE-based computation is complex and therefore requires high-performance nodes, which reduces the potential number of eligible nodes.
2. Latency: While more nodes improve decentralization, this also increases latency.

We therefore require a decryption technique that a) minimizes the chances of collusion (given that we may have a smaller set of nodes), b) is permissionless for new nodes, and c) is low-latency.

Solution: Threshold Decryption or Dynamic MPC

We see a few potential threshold decryption solutions:
1. N/2 threshold decryption: this means that more than half of the participants must cooperate in the decryption process, making it harder for malicious actors to collude.
2. Hardware Security Module (HSM) threshold decryption: these are specialized devices designed to protect cryptographic keys and perform secure operations, which adds an extra layer of security.
3. Trusted Execution Environment (TEE) threshold decryption: a secure environment for executing code involving sensitive data.

Alternatively, we could use Multiparty Computation (MPC), the common wallet security technique. An example of a possible technique that could be used for FHE is a variation of a traditional MPC implementation known as the 2PC-MPC algorithm. It requires all validators to participate, with 2/3 of validators (plus the user) required to generate a signature. One potential trade-off is that MPC may be more computationally complex and with more participants, which affects latency. This is an area of on-going research and may improve over time.

In summary, both threshold decryption and MPC variations such as the 2PC-MPC algorithm are being rapidly developed and show great promise for on-chain FHE.

Conclusion

The above covered two significant challenges currently hindering the implementation of on-chain FHE: lackluster FHE schemes, libraries, and compilers, as well as the need for secure, high-speed, and permissionless decryption techniques.

FHE libraries are required for developers to access pre-written code needed in their workflow. Various FHE libraries have been developed, such as Zama’s TFHE which enables programming in the fhEVM language.

FHE compilers are also required or turning high-level programming languages into low-level machine code required for on-chain FHE. The Sunscreen FHE Compiler is the leader thus far, but many others are also being developed, rapidly enhancing the developer experience

Last of all, secure threshold decryption is required in a highly secure, low-latency, and permissionless manner. Various possible threshold architectures exist, while MPC is also possible. The 2PC-MPC algorithm is one such MPC implementation that appears to satisfy all necessary requirements.

This concludes the first part of the article. There are still three more challenges that we will cover in part 2:
1. ZKPs for Correct Computations: FHE requires ZKPs that verify correct node behavior
2. Data Availability Optimization: Encrypted FHE data is stored in ciphertext format, which is much more efficiently stored by an FHE-compatible data availability layer.
3. FHE Hardware: FHE requires significant computational overhead. Optimized hardware and software, and FHE accelerators can both address this.

Visit our website to learn more, and stay connected with us via both Twitter and Discord.

Meet Us IRL: Fhenix Q1/24 Events & Conferences

Date: 04-01-24


Meet Us IRL: Fhenix Q1/24 Events & Conferences

Fhenix is pioneering a new era in computing where privacy and security are foundational elements for all. Core to this is forming meaningful relationships and sharing insights with industry leaders, aspiring developers, and the blockchain community alike.

In Q1 2024, we’re actively participating in key events, aligning with a significant milestone: the launch of our public testnet.

These events have been carefully chosen to showcase our advancements and engage with the tech community, as we shape a secure, private digital future. Stay tuned for more on these exciting developments.

Penn Blockchain Week: February 23-24

Penn Blockchain Week is one of the leading academic blockchain events. It includes speakers from various top-tier DeFi projects such as Eclipse, Berachain, and Gauntlet, as well as VC firms such as Bain Capital, Portal Ventures, and Union Square Ventures.

Learn more about Penn Blockchain Week.

ETH Denver: February 23 – March 6

Fhenix will be either hosting or attending four different ETHDenver events:

  • DeFi Day: Organized by Dystopia Labs, this February 26th event will showcase talks from various DeFi projects, including Fhenix. More information shortly.
  • Private Research Dinner: On February 27th we will be hosting a private research dinner for encryption leaders. More information shortly.
  • Encryption Day: On February 28th we are bringing together the top minds in the encryption space, including the Founders of Fhenix, Zama, Arbitrum, EigenLayer, and Bankless, as well as researchers from Flashbots, Starkware, and more. Click here to register.
  • ETHDenver Hackathon: Renowned for incubating top Ethereum projects, this hackathon stands out as a highlight of the year. Learn more here.

ETHGlobal London: March 15-17

ETHGlobal events are worldwide and focused on fostering a global Ethereum community, with speeches, hackathons, workshops, and more.

Learn more about ETHGlobal.

ETHSeoul: March 29-31

This annual event in Seoul, Korea is known to attract leading Ethereum researchers, developers, and community members from the APAC region.

Learn more about ETHSeoul.

Conclusion

The events outlined for Q1 2024 are just the beginning of our extensive roadmap for the year. Our active participation in these events highlights Fhenix’s steadfast dedication to spearheading a new era in computing, where privacy and security are integral from the outset.

Our engagement with industry pioneers, forward-thinking developers, and the expansive blockchain community is a strategic effort to propel the industry forward. Through these interactions, we aim not only to contribute to the current dialogue but also to cultivate an environment ripe for innovation and built on a foundation of trust.

This is our commitment as we navigate and shape the future of technology.

Visit our website to learn more, and stay connected with us via both Twitter and Discord.