<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Zama - Medium]]></title>
        <description><![CDATA[Zama’s Privacy and Cryptography Blog - Medium]]></description>
        <link>https://medium.com/zama-ai?source=rss----1c82e4c8d84c---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Zama - Medium</title>
            <link>https://medium.com/zama-ai?source=rss----1c82e4c8d84c---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 23:30:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/zama-ai" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Monetizing Open Source Projects]]></title>
            <link>https://medium.com/zama-ai/monetizing-open-source-projects-5da94ffc1a7f?source=rss----1c82e4c8d84c---4</link>
            <guid isPermaLink="false">https://medium.com/p/5da94ffc1a7f</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[monetization]]></category>
            <category><![CDATA[monetization-model]]></category>
            <category><![CDATA[homomorphic-encryption]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Rand Hindi]]></dc:creator>
            <pubDate>Wed, 03 Aug 2022 17:05:43 GMT</pubDate>
            <atom:updated>2022-08-03T17:05:42.978Z</atom:updated>
            <content:encoded><![CDATA[<h3>How we monetize our open-source products at Zama</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UHiEIvyvt4SNniN_fXGLag.jpeg" /></figure><p>At <a href="http://zama.ai/">Zama</a>, we believe in <a href="https://en.wikipedia.org/wiki/Kerckhoffs%27s_principle#:~:text=Kerckhoffs&#39;s%20principle%20(also%20called%20Kerckhoffs&#39;s,the%20key%2C%20is%20public%20knowledge.">Kerckhoffs’s principle</a>: that security by obscurity cannot exist. The only way to feel confident about a cryptosystem’s security is to have the community try to break it and fail. In practice, this means we need to <a href="https://www.zama.ai/research">publish our results</a> and <a href="http://github.com/zama-ai/concrete">open source our implementation</a>.</p><p>As an ambitious startup, we have dedicated vast resources to build our technology, with the expectation that eventually we will become profitable. Profitability is necessary to achieve our vision — to make the internet safe by encrypting everything end-to-end — because it enables us to be independent and free from external influence.</p><p>A common belief is that open source and monetization are incompatible.<strong> Not only is this incorrect, but it is also dangerous</strong> when it comes to cryptography: it makes companies sell proprietary technology that hasn’t been validated by the community. If, instead, companies utilized an open-source approach, they would benefit in many ways:</p><ul><li>Software would be more secure, as fresh eyes would inspect the code and report bugs.</li><li>New features would be contributed by the community, especially those that the company may not have envisioned internally.</li><li>Customers would feel more confident adopting the solution, as the code would be safeguarded against future uncertainty.</li><li>Organic brand awareness would be cultivated through word of mouth amongst developers, the most influential group regarding technology adoption.</li><li>Support would be better, as they could rely on both their team and the community to answer questions.</li><li>A low-touch sales model would be facilitated, with potential customers creating their own proof-of-concept ahead of purchasing the solution. PoCs are a startup’s death kiss and should be avoided at all costs, as they require enormous time and effort and rarely convert into recurring revenue.</li></ul><p>A decade ago, open source was thought to be the lesser version of proprietary software. This is no longer true, and many industry giants were built on top of open-source projects: MongoDB, Datastax, Elastic Search, Docker, Mapbox, … These companies share the distinction that their business models combine at least two of the following revenue streams: support, hosting, proprietary features and dual licensing.</p><h3>Support</h3><p>The most common and simplest model for open source companies is to offer premium support. When a company adopts an open-source solution, they typically require help integrating it, maintaining it and debugging it. Relying purely on community support won’t be enough, as there is no guarantee that a response will be given promptly, if ever.</p><p>Although anyone could sell support for a given open-source solution, the company behind the solution will often be the preferred choice as they are more likely to know the internals and be able to ship custom patches swiftly.</p><p>The disadvantage of relying on support alone is the stress it places on human resources, making it hard to scale. It is, however, essential, and thus must be offered eventually.</p><h3>Hosting</h3><p>Another good way to monetize is to host the solution for other companies, thereby making it easier to integrate, maintain and debug. Take MongoDB as an example: you can either use MongoDB directly and host it yourself, having to patch it, etc; or you can host your data on Mongo’s SaaS platform, letting them do all the work and paying only for what you use.</p><p>The advantage here, of course, is simplicity for both the provider and the customer, but the disadvantage is the need for consumer trust in the host. As an open-source company, it also means SLA guarantees are a necessity, which involves heavier internal processes to guarantee uptime, etc.</p><h3>Proprietary features</h3><p>Sometimes keeping some features closed source is acceptable, in particular when it doesn’t prevent the community from using the core solution. Automated backups, integration, hardware acceleration and other options are all more convenient if available, but they aren’t deal-breakers and can be kept closed-source and sold as enterprise features.</p><p>Choosing what to open source and what to sell as a premium feature can be tricky, however, and many companies have burnt themselves following this open-core business model. It also doesn’t create as much defensibility, as large companies can easily replicate the enterprise features and sell them as their own.</p><h3>Dual licensing</h3><p>The idea behind dual licensing is that some open-source licenses have provisions that make it difficult for proprietary software companies to use the open-source code commercially.</p><p>For example, GPL licenses include a copyleft provision, meaning that when a company distributes software that incorporates GPL code, they have to make their own software freely available under GPL as well. There is a debate currently, however, on whether using AGPL in a SaaS product would trigger the copyleft provision. Some claim SaaS isn’t distribution and thus it doesn’t trigger the provision. Others maintain it does. The Free Software Foundation has a <a href="https://www.gnu.org/philosophy/who-does-that-server-really-serve.en.html">good article specifically on this issue</a>. Further, this is the reason that MongoDB and Elastic Search are using a modified GPL license that specifically addresses SaaS usage.</p><p>Another example is the BSD3-clear license, which is completely permissive, without copyleft, but doesn’t include a patent license (the original BSD3 license did not mention patents at all, creating an ambiguity that the BSD3-clear version resolves).</p><p>These legal constraints create an opportunity for monetization of the open-source software:</p><ul><li>If a company open sources their code under GPL, they can sell the same code with a non-GPL license to companies that don’t want to worry about the GPL copyleft provision. In this case, what is being sold isn’t the software, but rather the peace of mind of not having to deal with GPL.</li><li>If a company open sources their code under BSD3-clear, they can sell additional licenses to use the patents included in the open source code. In this case, it still isn’t the software that is sold, but rather the usage rights of the patented intellectual property it contains.</li></ul><p>There are other possible models available as well, such as a dual commercial/non-commercial license. But regardless of which model is used, the idea is always the same: big proprietary companies would much rather pay a license fee than worry about the potential legal risks of using open source code.</p><p>At Zama, we have thoughtfully chosen the BSD3-clear dual licensing model, with an added explicit clause that grants full patent usage rights for non-commercial purposes. This means anyone can use, fork, extend and distribute our software for free for development, research, prototyping and experimentation purposes.</p><p>There are several things that motivated our choice:</p><ul><li>We want to be profitable so that we can remain independent and continue investing in privacy-preserving technologies;</li><li>We want to contribute to science by publishing our work and enabling other researchers to build on top of it;</li><li>We want our code to be auditable so that users don’t have to trust us;</li><li>We want companies to freely experiment and evaluate our solution;</li><li>And we want to use a well-known license family.</li></ul><p>All these requirements are nicely addressed by our BSD3-clear license scheme:</p><ul><li>Open research, auditability and experimentation are covered by the BSD3-clear license with our added free patent license for non-commercial use.</li><li>Profitability is covered by our commercial license, that includes both software and patent usage rights.</li><li>BSD is a widely-used license family with which developers are familiar.</li></ul><p>We reviewed, in detail, every other major license, and decided to avoid them for the following reasons:</p><ul><li>We were initially using AGPLv3, but we decided to change because too many of our partners and users were not allowed to run GPL code on their work machines and thus couldn’t experiment freely.</li><li>Apache2 grants explicit patent rights, which means we wouldn’t be able to monetize our IP. Without the ability to monetize our IP, we would effectively be spending millions developing a technology that other companies would profit from, without Zama getting anything in return.</li><li>MIT and BSD2/3 (without the clear clause) are permissive but do not explicitly mention patents, creating a legal ambiguity that can lead to expensive patent infringement lawsuits down the line.</li></ul><p>We believe that our users and partners deserve to know the risks they take using our code, which is why we have made things very simple: do whatever you want as long as it’s non-commercial, or purchase a license if you want to use our code for commercial purposes.</p><p>Additionally, we have purposefully omitted consulting as a business model, as we don’t consider it to be viable for startups. Consulting is great if you want to be a consulting company, but not when you want to be a product company.</p><p>Hopefully by now you are convinced that going open source can be profitable for your company. We need more open source in our industry because too many critical infrastructures rely on opaque code that hasn’t been audited. That creates unnecessary risk for all of us.</p><p>It’s time we built big businesses that actually make the internet safer!</p><ul><li>Follow us on twitter <a href="https://twitter.com/randhindi">@randhindi</a> and <a href="https://twitter.com/zama_fhe">@zama_fhe</a></li><li>If you want to make the internet safer, <a href="http://jobs.zama.ai/">join our team!</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5da94ffc1a7f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zama-ai/monetizing-open-source-projects-5da94ffc1a7f">Monetizing Open Source Projects</a> was originally published in <a href="https://medium.com/zama-ai">Zama</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nigel Smart is joining Zama as Chief Academic Officer]]></title>
            <link>https://medium.com/zama-ai/nigel-smart-is-joining-zama-as-chief-academic-officer-831fb55991de?source=rss----1c82e4c8d84c---4</link>
            <guid isPermaLink="false">https://medium.com/p/831fb55991de</guid>
            <category><![CDATA[hiring]]></category>
            <category><![CDATA[homomorphic-encryption]]></category>
            <category><![CDATA[privacy]]></category>
            <dc:creator><![CDATA[Rand Hindi]]></dc:creator>
            <pubDate>Mon, 04 Apr 2022 13:24:55 GMT</pubDate>
            <atom:updated>2022-04-04T13:24:55.417Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*znc4Tc5rqOl3-Ksj.png" /></figure><p>I remember the first time I met Nigel. It was back in 2015, when at my previous startup we started investigating homomorphic encryption. One thing that struck me was how practical Nigel was in terms of technology. Our first discussion wasn’t about some hypothetical future breakthrough, but rather about immediate practical applications of secure computation. Thanks to his help and to Pascal’s (my co-founder and CTO at Zama), we were able to ship an open source protocol for private analytics on mobile devices, long before privacy and GDPR were requirements for companies.</p><p>When Pascal and I started Zama, we naturally asked Nigel to come onboard as an academic advisor. For the last two years, Nigel has been helping us with defining research questions and various other endeavors, including setting up the FHE.org conference.</p><p>Today, I am proud to announce that Nigel will be joining us officially as Chief Academic Officer (CAO). What exactly is a CAO? It’s the person in charge of making sure Zama’s open source technology is being used for research in academia, and not exclusively by developers and companies. With his help, we hope to contribute to long term academic research on homomorphic encryption by providing the tools and support researchers need. In exchange, we hope these new breakthroughs will percolate into the open source codebase, and be used by millions of developers in the next decade.</p><p>If you don’t know Nigel, here is his short bio:</p><p><em>Professor Nigel Smart is a cryptography researcher and entrepreneur. He is known for his work on FHE, elliptic curves and MPC.</em></p><p><em>From 2000 to 2017, he founded and ran the cryptology research group at the University of Bristol, before joining COSIC at KU Leuven in 2018. In parallel, he founded several successful companies, including Identum (acquired by Trend Micro) and Unbound Security (acquired by Coinbase).</em></p><p><em>Nigel has held a Royal Society Wolfson Merit Award, two ERC Advanced Grants, is an IACR fellow and was a director and vice-president of the International Association for Cryptologic Research. He is also the co-founder of the popular crypto conference, Real World Crypto.</em></p><p>Nigel, welcome to Zama!</p><p>Rand</p><p>If you’re interested in learning more about the work that Prof Nigel Smart and our team at Zama are doing, you can read our <a href="https://whitepaper.zama.ai/whitepaper.pdf">technical whitepaper here</a> or, better yet, <a href="https://docs.zama.ai/?utm_source=the_revolution_of_fhe&amp;utm_medium=post&amp;utm_campaign=blogpost">get started developing now</a> using Concrete.</p><p>Get the latest news about homomorphic encryption and what we do at Zama: <a href="https://zamafhe.substack.com/">subscribe to our newsletter</a>.</p><h4>Zama is growing!</h4><p>We are hiring more than 100 people to work on homomorphic encryption, machine learning and blockchain. If you would like to join us, apply here: <a href="https://jobs.zama.ai/?utm_source=nigel_smart_joins_zama&amp;utm_medium=post&amp;utm_campaign=blogpost">jobs.zama.ai</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=831fb55991de" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zama-ai/nigel-smart-is-joining-zama-as-chief-academic-officer-831fb55991de">Nigel Smart is joining Zama as Chief Academic Officer</a> was originally published in <a href="https://medium.com/zama-ai">Zama</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The (r)Evolution of FHE]]></title>
            <link>https://medium.com/zama-ai/the-r-evolution-of-fhe-485b54a6e69c?source=rss----1c82e4c8d84c---4</link>
            <guid isPermaLink="false">https://medium.com/p/485b54a6e69c</guid>
            <category><![CDATA[homomorphic-encryption]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[data-privacy]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Jeremy Bradley-Silverio Donato]]></dc:creator>
            <pubDate>Thu, 10 Mar 2022 12:25:08 GMT</pubDate>
            <atom:updated>2022-03-11T10:46:22.042Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5XrIoUFzBcOK4DAaVqAz_w.png" /></figure><h4>Machine Learning and Homomorphic Encryption</h4><p>Fully Homomorphic Encryption (FHE) is a subject that is gaining more and more traction these days. But from all the talk and news articles and exciting developments, too few people still understand what FHE actually is, what it does, and how it can be used. If you’re one of them, don’t worry, you’re not alone. Let’s have a little background lesson and then look at how FHE is shaping the future of data science and machine learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8J8_6wC1UGM4oe44TOMoHg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zu_2ylCv6HCfXWDM0FyKcA.png" /><figcaption>Data processing with and without FHE</figcaption></figure><p>To start with, it’s not a stretch of the imagination to say that FHE is the holy grail of cryptography. FHE allows you to perform computations on encrypted data without first decrypting that data. The resulting computations are left in an encrypted form which, when finally decrypted, result in an identical output to that produced had the operations been performed on the unencrypted data. Simply put, FHE enables processing data without decrypting it. This means companies can offer their services without ever seeing their users’ data — and users will never notice a difference in functionality.</p><p>If you’re a developer and you don’t know much of the gory details on how FHE works — and trust us, there are plenty of gory details — your first stop would be to look into the <a href="https://github.com/jonaschn/awesome-he">existing set of FHE libraries</a>. Each of them have various degrees of usability, many of them are open source, and each has its own degree of readiness. At the same time, most of them are experimental in nature. You may be able to test or play around with code, but you might not be able to do anything useful or long-term sustainable. That’s where Zama’s <a href="https://docs.zama.ai/?utm_source=the_revolution_of_fhe&amp;utm_medium=post&amp;utm_campaign=blogpost">Concrete Framework</a> is revolutionary. With Concrete, developers can easily build fast homomorphic applications.</p><p>The underlying key technology in an effective Fully Homomorphic Encryption scheme like Concrete is something called ‘programmable bootstrapping’. It enables the homomorphic evaluation of any function of a ciphertext, with a controlled level of noise. A ciphertext is what encryption algorithms, or ciphers, transform an original message into. We’ll talk more about bootstrapping below, but for now it is sufficient to say that with Concrete, you’re able to easily use FHE in an application without having to be a professional cryptographer. You’re given the tools upfront and then you’re free to start developing.</p><h3>How FHE will change the world</h3><p>It’s common to come across web-based services that work off cloud solutions. Think of any service where you book something online or through an app, or a website where you share your data with a third party. These kinds of solutions are all around us and you probably use many of them every day. The companies providing these solutions offer a value-added service by aggregating data, but the downside to this is that the company can also see (and use to nefarious ends, if they wish) that data. In short, you don’t have a strong guarantee of the privacy or security of your data, even if the service provider promises otherwise. Every day, thousands and even millions of pieces of identifiable data are leaked or stolen. However, by using homomorphic encryption from the beginning, what you send to the service provider is encrypted with your own private key. The whole world might be colluding against you, but if you’re the only one with the private key, nobody can have access to your data.</p><p>Likewise, homomorphic encryption is an interesting proposition for companies and service providers themselves. Homomorphic encryption doesn’t prevent a company from carrying out its stated purpose; it simply prevents them from using that data to devious ends. You can still send your information to a third party using FHE, and that party can provide you the service you expect it to provide, but they can do this without needing to know that the data belongs to you as an individual. Using FHE thus allows a company to guarantee to its customers that their data is truly encrypted end to end and is secure by design.</p><h3>Application to Machine Learning</h3><p>Tall buildings. Metal everywhere. Self-driving cars that fly. Endless rows of flashing digital billboards. Robot cops and Matrix-like simulators. These are the images many of us have when we think of a future world where drones and droids dominate. This kind of narrative has been reinforced by everything from Hollywood blockbusters to mainstream media outlets. But at Zama, we see things differently.</p><p>When we picture the future, we don’t see a place where machines have taken over and where your privacy as a human being has been reduced to a currency, essentially used as a bargaining chip. Instead, we imagine a world where privacy is fiercely defended; a place where data security is paramount.</p><p>It is easy to understand why machine learning — part of the broader field of artificial intelligence — and privacy are often perceived to be at odds. The basic idea behind machine learning is to observe a set of data and <em>learn </em>from that data, uncovering processes and patterns in the process. Many people fear that machines may one day ‘learn too much’ or become too powerful, but in fact machine learning enables the development of numerous applications: regression, classification, recommendation, clustering, anomaly detection, and so on. The reality is that machine learning is already widespread, used in everything from driving assistants to language translation apps and face recognition software.</p><p>Clearly, the type of data machine learning deals with is often very sensitive or personal. The data processed through machine learning can also be used in many different ways from ‘less’ harmful uses such as targeted advertising to blatantly devious uses such as blackmail. But it doesn’t have to be this way.</p><p>What makes FHE stand out is that unlike traditional encryption algorithms that only protect data while it is in transit or at rest, meaning that the data has to be decrypted for it to be processed, FHE allows data to be computed whilst still encrypted. This makes Fully Homomorphic Encryption a perfect fit for machine learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iMEnERweT4AJKq5Z" /></figure><p>The specific kind of machine learning we want to highlight involves <em>neural networks</em>. A neural network is a collection of units called artificial neurons. These are inspired by real-life neurons, the basic working units of the brain. Like human neurons, artificial neurons are a specialized ‘cell’ designed to transmit information. Each cell can transmit a signal to other neurons. After the neuron receives the signal, it processes it, and then can signal it to other connected neurons. Neural networks can be trained and used to do many things such as to detect disease patterns, classify objects, and aid in image recognition.</p><p>It’s possible to use FHE to evaluate these deep neural networks. One of the major challenges with any homomorphic encryption scheme is that at some point, the noise present in the ciphertext (data encrypted through an algorithm) becomes so prevalent that it levels out. We use the technique called <em>bootstrapping, </em>mentioned above,<em> </em>to refresh the ciphertext. The faster the bootstrapping process, the better for its application in machine learning. To that end, Concrete implements a variation of a fast FHE scheme called <a href="https://medium.com/zama-ai/whats-new-in-concrete-aa414d17e535">TFHE</a>. This is important because many people wrongly assume that homomorphic encryption is too slow to be practically useful. In fact, we’ve already shown great progress in making FHE useful and practical.</p><h3>Practical use cases examples</h3><h4>Preventive Medicine</h4><p>Imagine knowing in advance what you need to do to stay healthy throughout your life. This is increasingly possible with AI, but requires sharing all your health data — everything from your DNA, to your medical history, to your lifestyle habits. With FHE, you could send all this data while keeping it encrypted, and the AI would respond with encrypted health recommendations that you alone have the ability to see.</p><h4>Facial Recognition</h4><p>From science fiction to the palm of your hand, facial recognition is now a part of our everyday experience. We use facial recognition to enter buildings, to unlock our phones, to tag people in pictures and soon to login to websites everywhere. This however requires someone to have your biometric fingerprint, which in the wrong hands can be used to impersonate you, and cannot be replaced by a simple password. With FHE, you could authenticate yourself securely, without anybody being able to steal your biometric data.</p><h4>Voice Assistants</h4><p>Every time your family speaks to a voice assistant, they send personal information to the companies behind them, increasing the risk that someone can steal this data. With FHE, you could send encrypted voice queries to AI assistants, who would have no way of knowing what you just asked, while still being able to respond. It wouldn’t matter that you have a microphone in your house, because nobody would be able to listen to what you say!</p><h3>And we’re not stopping there.</h3><p>We envision a future where all data is truly encrypted from end to end, and we also recognise that there are a number of real-world applications for FHE that exist today. Now we’re expanding our research into how to extend the reach of homomorphic training of neural networks, and moreover how to apply that research to machine learning tasks. We’re calling on the developer community to join our efforts. <strong>Try out Concrete for yourself, as our friends at </strong><a href="https://medium.com/zama-ai/concrete-boolean-and-conways-game-of-life-a-tutorial-f2bcfd614131"><strong>Optalysys have done</strong></a><strong>, and let us know what you build.</strong></p><p>If you’re interested in learning more, you can read our <a href="https://whitepaper.zama.ai/whitepaper.pdf">technical whitepaper here</a> or, better yet, <a href="https://docs.zama.ai/?utm_source=the_revolution_of_fhe&amp;utm_medium=post&amp;utm_campaign=blogpost">get started developing now</a> using Concrete.</p><p><strong>Get the latest news about homomorphic encryption</strong> and what we do at Zama: <a href="https://zamafhe.substack.com/">subscribe to our newsletter</a>.</p><p><strong>Zama is growing! </strong>We will be hiring up to 100 new people. To help make a safer internet faster, we’re looking to fill the following roles: <a href="https://jobs.zama.ai/?utm_source=the_revolution_of_fhe&amp;utm_medium=post&amp;utm_campaign=blogpost">jobs.zama.ai</a>.</p><p><strong>We’re open source </strong>— follow Zama on Github here: <a href="https://github.com/zama-ai">github.com/zama-ai</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=485b54a6e69c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zama-ai/the-r-evolution-of-fhe-485b54a6e69c">The (r)Evolution of FHE</a> was originally published in <a href="https://medium.com/zama-ai">Zama</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Encrypted search using fully homomorphic encryption]]></title>
            <link>https://medium.com/zama-ai/encrypted-search-using-fully-homomorphic-encryption-99cd163b94?source=rss----1c82e4c8d84c---4</link>
            <guid isPermaLink="false">https://medium.com/p/99cd163b94</guid>
            <category><![CDATA[homomorphic-encryption]]></category>
            <category><![CDATA[zama]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[cryptography]]></category>
            <dc:creator><![CDATA[Zama]]></dc:creator>
            <pubDate>Fri, 25 Feb 2022 10:33:54 GMT</pubDate>
            <atom:updated>2022-02-25T10:33:54.702Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Aoh4uoDLkMFRvM7mFTmumw.png" /></figure><h4>An article by <a href="https://medium.com/@optalysys">Optalysys</a> on implementing an encrypted search operation using <a href="https://docs.zama.ai/concrete/boolean-lib/master/">Zama’s Concrete Boolean library</a>, and running it with the assistance of optical Fourier transform hardware.</h4><p><em>by </em><a href="https://medium.com/u/f0fec005a59a?source=post_page-----d7c37d74bbaf--------------------------------"><em>Florent Michel</em></a><em>, </em><a href="https://medium.com/u/9326ad4c51d1?source=post_page-----d7c37d74bbaf--------------------------------"><em>Joseph Wilson</em></a><em> and </em><a href="https://medium.com/u/2158f00e598e?source=post_page-----d7c37d74bbaf--------------------------------"><em>Edward Cottle</em></a><em>.</em></p><p>Information is the lifeblood of the modern internet. <a href="https://techjury.net/blog/how-much-data-is-created-every-day/">As of January 2021</a>, 4.66 billion people were active internet users, each one sending and receiving a torrent of data.</p><p>Quite of lot of this data is (relatively speaking) harmless and can be shared and accessed to various degrees. A vast and lucrative market around analysing this data has sprung up, taking advantage of this highly accessible information, with associated concerns about how this data is used.</p><p>However, what about information that is both valuable and <em>sensitive</em>? Too sensitive to run the risk that an unauthorised party could even <em>see</em> it, let alone work with it?</p><h3>The problem of privacy</h3><p>There are plenty of cases like this, and the standards for how this data can be used and shared are exceptionally high. This can be a pretty significant barrier to getting the full value out of that information. Consider the following example:</p><blockquote><em>A man walks into a bank and wishes to open an account. The bank is legally obliged to ensure that the money entering that account isn’t from the proceeds of crime, so the first thing they must do is establish who this man is and where the funds have come from. This process is known as KYC or Know-Your-Customer, a key part of Anti-Money Laundering (AML) compliance.</em></blockquote><p>Sounds simple right? Companies: banks and other financial institutions; keep computerised records, so surely verification is simply a matter of searching the relevant databases?</p><p>In fact, such checks are a <em>headache</em> for all involved because of the need to preserve privacy. For example, in the EU, GDPR legislation imposes tight restrictions on how personal data can be used and shared. And that is <em>entirely understandable</em>, because the damage that can be done with the important information is enormous.</p><p><strong>And all of this is down to a problem with <em>encryption</em>.</strong></p><h3>A new approach to security</h3><p>Information can be stored in encrypted form when travelling or at rest, but under current encryption methods, the data must be decrypted when it is being processed. That means that if you want to <em>search</em> a central repository of information, the information has to (at some point) be decrypted.</p><p>Securing a large-scale repository of unencrypted information against intrusion is already extremely hard; being able to safely grant access to external parties is even harder, so information sharing between companies and other record-holders is generally a slow process.</p><p>The solution to this (and many other problems) is Fully Homomorphic Encryption, a new model of cryptography that allows computation on encrypted data. Under FHE, an encrypted database can be searched for information without the need to decrypt the information at <em>any</em> point. At a stroke, a major barrier to safe information management can be eliminated, although not without a cost; the computational nature of FHE makes it notoriously slow, even on modern computing systems.</p><p>However, FHE is only slower than unencrypted processing from a <em>computational</em> standpoint. When compared against the lengthy (and not to mention <em>still fundamentally insecure) </em>processes that currently ensure data security, an FHE-enabled world will not only guarantee privacy but will also work a <em>lot</em> faster in general.</p><h3>Speeding up FHE via optical computing</h3><blockquote><em>With optical computing, we can start to address the computational overhead too; now the FHE world will move even faster, breaking down the limits imposed by current encryption methods. However, to reach that point, we’re still going to need the software tools and the broader algorithmic understanding to make this a reality.</em></blockquote><p>So, in the interests of illustrating the value that can already be unlocked, this article is dedicated to the task of implementing an encrypted search operation using <a href="https://docs.zama.ai/concrete/boolean-lib/master/">Zama’s Concrete Boolean library</a>, and running it with the assistance of optical Fourier transform hardware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hZz5zYgvyVKxamPd.png" /><figcaption>Visualisation of the core of our optical Fourier transform system, a chip-scale hybrid CMOS/Photonic processor for ultra-fast Fourier transforms. In this article, we use our system-level simulators (developed for our Beta program) to execute the Fourier transforms required for FHE operations in Concrete-Boolean, allowing us to provide a projected benchmark for the benefits of this technology in performing an encrypted search.</figcaption></figure><p>Visualisation of the core of our optical Fourier transform system, a chip-scale hybrid CMOS/Photonic processor for ultra-fast Fourier transforms. In this article, we use our system-level simulators (developed for our Beta program) to execute the Fourier transforms required for FHE operations in Concrete-Boolean, allowing us to provide a projected benchmark for the benefits of this technology in performing an encrypted search.</p><p>Concrete Boolean is the library we applied in our <a href="https://medium.com/optalysys/fully-homomorphic-encryption-and-the-game-of-life-d7c37d74bbaf">last article</a>, where we used it to execute Conway’s Game of Life in encrypted space. This library provides us with the programming tools that we need to start working with the computational properties of FHE in a direct and secure way.</p><p>Indeed, the speed with which we’ve been able to start using it is testament to the power that it places in the hands of users. Concrete Boolean was released about a month ago; in that time, we’ve been able to put out two articles on non-trivial applications. It’s an extremely encouraging development for the field in general.</p><p>Some FHE applications (such as Conway’s Game of Life) are <em>interesting. </em>This is an application which is <em>useful</em>. By using our optical Fourier transform approach, we can then take that useful application and make it run <em>much</em> faster than it would on conventional electronics.</p><p>How much faster? We put the string searching model we built to the test on our simulator architecture, which replicates the functionality of our physical demonstrator systems. Under the parameters of the commercial-grade system we have designed, this example search algorithm can be made to run <strong>60x<em> </em></strong>faster when the Fourier transforms are executed by an optical process.</p><h3>Summary</h3><blockquote><a href="https://medium.com/p/4431e987ba40/#1c9c"><strong><em>String searching</em></strong></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#0985"><strong><em>Techniques for string searching</em></strong></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#15c2"><em>The naive approach</em></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#5b8e"><em>Tries</em></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#bd40"><em>The naive approach: bringing Booleans into the picture</em></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#0043"><em>Applications</em></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#a47e"><strong><em>Encrypted string search with Concrete Boolean</em></strong></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#a0d4"><em>Import the Concrete-Boolean library</em></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#b1ea"><em>Encrypt a string</em></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#1a8e"><em>The FHEError type</em></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#de37"><em>Checking the equality of two characters</em></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#f500"><em>The string search function</em></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#e073"><em>An example</em></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#9dee"><em>Alternative version</em></a></blockquote><blockquote><a href="https://medium.com/p/4431e987ba40/#af45"><em>Potential for optical acceleration</em></a></blockquote><h3>String Searching</h3><p>Search algorithms are common tools for information retrieval and assessment. For example, consider the way that email is currently filtered. This usually involves a range of different techniques, but one of the simplest, and earliest methods (<a href="https://en.wikipedia.org/wiki/Naive_Bayes_spam_filtering">the “naive Bayes” classifier</a>) involved detecting key words or phrases. For example, emails containing the following in the subject line or message body:</p><blockquote><em>“Free money”<br>“Free offer”<br>“$$$”<br>“Weight loss”</em></blockquote><p>Are highly unlikely to be legitimate, and may be actively harmful. These phrases are made of sequences of characters (like any other text), which in computing are represented as <em>strings</em>, sequences of bits that represent characters. For example, the “$$$” string in ASCII encoding is a sequence of bytes (8 bit sequences), each of which represents a “$” character:</p><p>00100100 00100100 00100100</p><p>A straightforward key-word based approach to filtering means that detecting this sequence in an email indicates it is likely to be spam.</p><p>This kind of identification is an example of <em>string searching</em>. String searching is an extremely common task in computing; if you’ve ever searched a document for a particular word or typed a message on a phone that auto-predicts what the next word will be, you’ve seen it in action. We’ll use strings as an example in this article, but the approach we take to encrypted searching can be broadly generalised.</p><h3>Techniques for string searching</h3><p>As we did with the Game of Life application in our previous article, we’ll start by exploring approaches for unencrypted information.</p><p>The fundamental problem of string searching can be described compactly as:</p><p><em>“Given string </em><strong><em>S1</em></strong><em> of length </em><strong><em>n</em></strong><em> and search string </em><strong><em>S2</em></strong><em> of length </em><strong><em>m</em></strong><em> where </em><strong><em>m</em></strong><em> ≤ </em><strong><em>n</em></strong><em>, find all instances of </em><strong><em>S2</em></strong><em> in </em><strong><em>S1</em></strong><em>”.</em></p><p>For example, finding the word “fox” in a longer string:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xa8PG3D8AklrxQbX.png" /></figure><h3>The naive approach</h3><p>The simplest way to approach this problem is to iteratively compare sections or “windows” of length <em>m</em> of S1 against S2. Starting from the beginning of S1…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h-le7ynZ7g6Jr_Kc.png" /></figure><p>…we check to see if these characters match and then move on to the next sub-string. Spaces count as characters, so we end up having to check these too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aPRyOwzR8bZ0HBeV.png" /></figure><p>Eventually, we’ll reach the correct pairing. If we’re checking a long document for multiple instances of a word, we’ll have to continue on like this to the end, making a note of the indices where matches were found.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ENqqJTV-vGOsa01P.png" /></figure><p>This is the <em>naive</em> approach; the first thing that would come to mind. However, consider a different S1 and S2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/0*h68eC9CQNyVwhc8m.png" /></figure><p>Now the string that we’re searching for is right at the end of S1, which means that the total number of checks that we have to perform in the <em>worst-case </em>leads to a runtime complexity of <em>O(</em><strong><em>nm</em></strong><em>).</em></p><p>What if there were other ways of representing string information in a searchable form?</p><h3>Tries</h3><p>If we’re allowed to consider a <em>dictionary</em> of words, we can also use a structured approach. Consider the previous string:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/0*9LrGG1m-nsVMVjFA.png" /></figure><p>This was the worst-case scenario for the naive example. If we’re allowed to operate on the assumption that these words are stored in a dictionary, there’s a faster way of storing and representing information in the form of a <a href="https://en.wikipedia.org/wiki/Trie#:~:text=In%20computer%20science%2C%20a%20trie,key%2C%20but%20by%20individual%20characters."><em>Trie</em> data structure</a>. When we load the string, we can split it on the basis of the “ “ (space) delimiter into a dictionary:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oueqXE3XNdlDd_ep.png" /></figure><p>We can then build up a tree structure by taking each word and adding each character to sequential nodes. Each node can itself contains a list of other characters, like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/0*1SUqjMzJw8N4dvU5.png" /></figure><p>The cost of building this structure in runtime complexity is linear, i.e. <em>O(</em><strong><em>n</em></strong><em>)</em>. This is because, in the worst case, we will have to add one node to the trie per character in the dictionary of words.</p><p>By searching over this structure, we can notionally reduce the search time significantly. For example, if we want to search to see if the word “fox” is present, we now only have to perform at <em>worst</em> 3 operations as we search through the nodes. We first query the root node to see if it contains the “f” character, if it does not, then we know “fox” cannot exist in the set of words. If we do find an “f”, then we perform similar checks recursively on the node containing “f”, until we find the terminal character.</p><p>The cost of checking a node for a character is <em>O(1)</em> if we use an efficient structure to store subnodes e.g. a hashmap. This means that the runtime complexity of searching for a given word in the trie is <em>O(</em><strong><em>m</em></strong><em>)</em> where m is the length of the word we are searching for.</p><p>Tries are also more compact than a straightforward dictionary, as many prefixes are duplicated (e.g the sequence “Fo”, which starts many words such as “for” “fortune”, “Fourier” and so on, only needs to appear once). Overall, this approach works very well; tries (or similar approaches) are foundational data structures for tasks like auto-complete and spell-checking.</p><p>However, the catch is that implementing such a structure also involves a lot of <em>decisional</em> branching, and that’s an issue for FHE. Over the course of an encrypted computation, there’s no easy way to perform the kinds of comparison that are needed to execute a jump to another section of the computation. So to begin with, we’re going to settle for the naive approach.</p><p>That’s not to say that the idea of using a better-than-naive approach to searching is <em>impossible</em> with FHE; we can certainly improve upon things, so after we’re done with the naive method, we’ll also outline an alternative approach that falls somewhere between the naive approach and the more advanced trie method.</p><h3>The naive approach: bringing Booleans into the picture</h3><p>Thus far, we’ve described string searching in terms of characters, but paid little attention to the way that computers actually work. As we mentioned before, computer’s don’t see characters; each character is represented by a sequence of bits.</p><p>Bits can be 1 or 0, so we can implement a string check via Boolean operations. This is in fact what’s going on behind the scenes whenever we perform a string check; it’s just that there’s usually one or more layers of abstraction between the code we write and what’s actually going on.</p><p>If we have a word such as “fox” and we’re checking through strings where the characters are encoded with ASCII, then each character is represented by an 8-bit value. There are two Boolean operations which are useful here.</p><p>The first is the “exclusive not-OR” or XNOR gate. Here’s the inputs and outputs (the “truth-table”) for such a gate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/0*NYxN4QG5b1Hgdi6C.png" /></figure><p>And the second is the AND gate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/559/0*OWJEmZP3y_bGyG15.png" /></figure><p>We can combine the utility of these gates like so; Let’s say we have two sequences of bits, e.g</p><p>S1 = “011000011101110110000101”</p><p>S2 = “01110110”</p><p>And we want to find S2 in S1 via the naive sliding-window approach. For each comparison window, we can XNOR each bit together and then apply a cascade of AND gates to the output. If the bit sequences don’t match…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/0*UoBO4c_gawp9-EjF.png" /></figure><p>… then the output of the final AND bit will always be zero</p><p>The <em>only</em> time this process will return a non-zero output bit is if all the bits match:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/0*4tTpyFK0VuliIXlA.png" /></figure><p>This allows us to reduce a query over multiple binary values to a single binary outcome.</p><h3><strong>Applications</strong></h3><p>This by itself is a pretty big deal! It’s not a new<em> </em>idea<em>, </em>but it is a key piece of understanding before we leap into <em>encrypted</em> string searching, so we’ll stop for a moment and consider what we can do with it.</p><p>Thus far we’ve phrased everything in terms of searching a single string of text to see if it contains another string. That’s fine; it’s been a useful tool for introducing us to the link between Boolean operations and the way that information is represented on computers.</p><p>However, beyond this, if we can convert the problem of searching human-readable text strings into a Boolean model, we can implement this approach to searching over <em>other</em> data types too. This is what we need to begin developing the more complex applications of encrypted search.</p><p>In fact, some of these data types are actively <em>easier</em> to work with than text. For ASCII text representations we’re working with a byte per character, which means comparing 8 binary values. That’s not a big deal on a modern machine, but when working with encrypted FHE operations, every additional Boolean gate we need to apply translates into meaningful extra work.</p><p>Text requires an 8-bit representation because written human language contains many different symbols. English contains 26 lower case characters, 26 upper case characters, punctuation, and various other symbols that are used often ($!&amp; etc). If we’re representing the complete English character set with unique binary values, then of course we need quite a few of them.</p><p>However, <em>language</em> doesn’t always mean human communication; language in the broader sense can be seen as any formal system of symbols.</p><p>For example, DNA is formed from 4 nucleotide base pairs: adenine, cytosine, guanine and thyamine. This is an example of a symbolic language that only requires 2 bits to represent the full range of characters. In light of the methods we use in our example, an encrypted search over a DNA sequence would be much faster on a per-character basis than over a text string.</p><p>We’ll likely come back to this idea in a later article, but for now we’ll move on to how we translate this into an <em>encrypted</em> search.</p><h3>Encrypted string search with Concrete-Boolean</h3><p>To perform an <em>encrypted</em> string search, we can combine Concrete-Boolean with the Boolean comparison process. In our example, we’ll be searching the S1 string</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/0*1lmDbfds5wTe0KSx.png" /></figure><p>For the S2 string</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/87/0*uWTHgvdUoZBDXRXg.png" /></figure><p>We begin by encrypting each individual bit of each character in both S1 and S2 as a ciphertext. Each discrete character (e.g “l”) can now be thought of as being represented by a vector of 8 ciphertexts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/229/0*7d92iXAa-Ocp01Yx.png" /></figure><p>To compare two characters, we first have to perform an encrypted XNOR operation between each ciphertext just as we did before.</p><p>If we do this for each character in S2, we now have a collection of ciphertexts containing the output of all the XNOR operations between the section of S1 and S2. We can then apply encrypted AND operations to these ciphertexts. This will return a single ciphertext containing an encryption of either “0” if the strings don’t match or “1” if they do.</p><p>This is just like our initial Boolean search method, but now everything is encrypted. The only information that can be extracted is whether the S2 string is present in S1 and, if so, where it is in S1. At the same time, the only person or organisation that can retrieve this information is the holder of the decryption key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SZ4tAvrtZr6tGdIi.png" /></figure><p>Let’s see how this works in practice.</p><h3>Import the Concrete-Boolean library</h3><p>We first import the elements we will use from the Concrete-Boolean library: the gen_keys function used to generate the keys, and the ServerKey, Ciphertext, and ClientKey types. We also import Concrete’s CryptoAPIError type and define the number of bits per character.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/294e936cd8532433ed5d4a3e22094fac/href">https://medium.com/media/294e936cd8532433ed5d4a3e22094fac/href</a></iframe><h3>Encrypt a string</h3><p>The next thing we need is a function to encrypt a string into a vector of ciphertexts. The simplest approach is to convert the string to bytes, loop over the bits, and encrypt each of them. Since Concrete-Boolean works with Boolean values rather than integers, we identify 0 with False and 1 with True.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/438822461ff979dc879c5f38a8bfab72/href">https://medium.com/media/438822461ff979dc879c5f38a8bfab72/href</a></iframe><h3>The FHEError type</h3><p>This step is not strictly needed, but will make error handling easier. The string function we will write may fail for different reasons. Some of them are due to how Concrete-Boolean works, and will result in a CryptoAPIError. But others may not be related to the cryptography algorithm at all. For instance, one of the strings may be empty, and we choose to throw an error in this case. To deal with these different possibilities, we define a custom error type, FHEError. We also implement the From&lt;CryptoAPIError&gt;trait so that a CryptoAPIErrorcan be converted to an FHEError.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1faa106747e92c1dbf1894d526cf331d/href">https://medium.com/media/1faa106747e92c1dbf1894d526cf331d/href</a></iframe><h3>Checking the equality of two characters</h3><p>We now define the function which checks if two sequences of ciphers decrypt to the same sequence of bits. The function bits_are_equal below takes a server key and two ciphertexts a and b as arguments, and returns another ciphertext which decrypts to trueif a and b encrypt the same boolean value or false otherwise.</p><p>The function are_equal does the same for two sequences of ciphertexts, returning an error if they are empty or have different lengths.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9cb7ba673336e8a25ff851d982bdf25c/href">https://medium.com/media/9cb7ba673336e8a25ff851d982bdf25c/href</a></iframe><h3>The string search function</h3><p>Finally, the function search_word takes a server key and two sequences of ciphertexts a and b as arguments. If a is empty, it returns an error. Otherwise, it returns an encryption of true if the string used to generate a is in that used to generate b or of false otherwise.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31666810d684c6c9785bda1b1466ad49/href">https://medium.com/media/31666810d684c6c9785bda1b1466ad49/href</a></iframe><h3>An example</h3><p>As an example, the code shown below will look for the words “like” and “hate” in the sentence “I like making FHE easy!”.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c91a7cb3700b07b8e8c494e93b69444/href">https://medium.com/media/6c91a7cb3700b07b8e8c494e93b69444/href</a></iframe><p>Here is the result:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/50eca763dc2425d1a42fab927d625c42/href">https://medium.com/media/50eca763dc2425d1a42fab927d625c42/href</a></iframe><h3>Alternative version</h3><p>As we mentioned earlier, this algorithm is not the most optimal when working with plaintext data: it is much better to first split the list into words, assemble them into a trie structure, and use it to search each word. There are two reasons why this is not possible in (or, at least not easily transferable to) FHE:</p><ul><li>First, using FHE, we can’t use conditionals based on the plaintext data to terminate the calculation early. This is a fundamental property of all well-designed FHE schemes, as the time needed to perform a calculation would otherwise leak information about the plaintext data.</li><li>Second, if we want to leak no information at all about the string, we can’t even provide the function with the length of each word, as a statistical analysis on these lengths could reveal something about the text. (For instance, some technical fields are more prone to long words than others.)</li></ul><p>However, sometimes faster computation may be worth leaking some information about the original string. If the string is short enough, there is only so much that a statistical analysis will reveal. And, for longer strings, one could imagine padding them with random words to partially hide the information that word lengths reveal.</p><p>In cases where this trade-off is acceptable, one can split the string into individual words, encrypt them, and check a word to be searched against each of them sequentially. For additional security, one may pad or crop each word to a fixed length, so that the only information the server gets is the total number of words. This has the added benefit over the above version that the server does not even know the length of each word to be searched for. The complexity of the search algorithm then becomes O(m l), where m is the number of words in the string and l is the fixed length.</p><p>For completeness, we give here the full lib.rs file (a large part of which has already been explained above):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cf6f4e02643d83c0c50250138625d897/href">https://medium.com/media/cf6f4e02643d83c0c50250138625d897/href</a></iframe><p>And the associated main.rs file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/878abef4582116fa370577a232d4d1e5/href">https://medium.com/media/878abef4582116fa370577a232d4d1e5/href</a></iframe><p>This version has a slightly different trade-off than the previous one. Indeed,</p><ul><li>In the previous version, the function performing the computation had access only to the total length of the text and to the length of each word which is searched.</li><li>In this version, it has access to the total number of words in the text but not their individual length nor the length of the words which are searched for.</li></ul><p>In both cases, the small information leak can be resolved (at the expense of a longer runtime) by padding the text with additional words and, in the first version, by padding each word with spaces to be searched for and adding a comparison to an encryption of a space to the function comparing characters.</p><p>As far as the runtime is concerned,</p><ul><li>The first version requires about <strong><em>nm</em></strong> character-to-character comparisons, where <strong>m </strong>is the length of the text and <strong>n </strong>that of the word to be searched for.</li><li>The second version requires <strong><em>wl</em></strong> character-to-character comparisons, where <strong><em>w</em></strong> is the number of words in the text and <strong><em>l</em></strong> the maximum length of a word.</li></ul><p>The second version will thus be faster on average if <strong><em>l</em></strong> is smaller than the squared average length of a word, and slower if it is larger.</p><h3>Potential for optical acceleration</h3><p>The above example runs in about 40s on an Intel i7 CPU @ 3.6 GHz. By comparison, we project (again, based on the parameters of our optical device design) that the Fourier transforms required for the full computation, which are by far the main bottleneck, would take less than 0.4s on the Optalysys optical Fourier transform system. <strong>The chip-scale technology we are developing could thus accelerate this more advanced application by a factor of 100.</strong></p><p>Thanks again to <a href="https://optalysys.com/">Optalysys</a>, and the writers, <a href="https://medium.com/u/f0fec005a59a?source=post_page-----d7c37d74bbaf--------------------------------"><em>Florent Michel</em></a><em>, </em><a href="https://medium.com/u/9326ad4c51d1?source=post_page-----d7c37d74bbaf--------------------------------"><em>Joseph Wilson</em></a><em> and </em><a href="https://medium.com/u/2158f00e598e?source=post_page-----d7c37d74bbaf--------------------------------"><em>Edward Cottle</em></a> for this article.</p><p><strong>Get the latest news about homomorphic encryption</strong> and what we do at Zama: <a href="https://zamafhe.substack.com/">subscribe to our newsletter</a>.</p><p><strong>We are hiring!</strong> Join Zama and help us safeguard privacy by making the internet encrypted end-to-end. All the info here: <a href="https://jobs.zama.ai/?utm_source=guest_article_optalysys_2&amp;utm_medium=post&amp;utm_campaign=blogpost">jobs.zama.ai</a>.</p><p><strong>We’re open source </strong>— follow Zama on Github here: <a href="https://github.com/zama-ai">github.com/zama-ai</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99cd163b94" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zama-ai/encrypted-search-using-fully-homomorphic-encryption-99cd163b94">Encrypted search using fully homomorphic encryption</a> was originally published in <a href="https://medium.com/zama-ai">Zama</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Concrete-core v1.0.0-alpha]]></title>
            <link>https://medium.com/zama-ai/concrete-core-v1-0-0-alpha-90012b2a4a98?source=rss----1c82e4c8d84c---4</link>
            <guid isPermaLink="false">https://medium.com/p/90012b2a4a98</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[homomorphic-encryption]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[zama]]></category>
            <dc:creator><![CDATA[Zama]]></dc:creator>
            <pubDate>Wed, 09 Feb 2022 14:44:27 GMT</pubDate>
            <atom:updated>2022-02-09T14:44:27.830Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oPrkFFXeIS64qUy4g58ijA.png" /><figcaption>📁 <a href="https://github.com/zama-ai/concrete/tree/master/concrete-core">https://github.com/zama-ai/concrete/tree/master/concrete-core</a></figcaption></figure><h4>Introducing support for FHE hardware accelerators</h4><p>In March 2021, we released the beta version of Concrete-core, the low-level crypto library that powers the Concrete Framework we build at Zama. This first implementation was focused on CPUs, which was just the beginning: at Zama, we believe that hardware acceleration is the cornerstone of the FHE revolution. Since then, we have been working hard to release an architecture that would make Concrete-core the perfect platform to experiment and integrate new FHE-related hardware-acceleration.</p><p>Today, it is our pleasure to deliver the release-candidate of the 1.0.0 version of Concrete-core, including a completely refreshed architecture. It is now easier than ever to accelerate any of the already existing FHE operators. By accelerating Concrete-core, you are accelerating the entire suite of applications built with the Concrete Framework, including our recently released Concrete-numpy library (check out our blog post <a href="https://medium.com/zama-ai/announcing-concrete-numpy-8b22abbaf355">here</a>).</p><p>Our latest CPU-based implementation is included in this new version of Concrete-core, and we plan to add more backends in the near future, for example using GPUs and FPGAs. We’re confident that this new version will be a useful tool for both hardware developers and cryptographers, and will ultimately bring FHE to a larger audience!</p><h3>Paving the way for seamless hardware contributions</h3><p>Our main goal here was to make it as simple as possible to plug hardware specific implementations into Concrete-core. The Rust programming language and its Trait system prove to be a great help for what we were looking to achieve.</p><p>We decided to implement a specification module which contains a set of interacting Traits, that completely define the FHE scheme implemented in Concrete-core:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/0*2W8R_OpCnHCRFKns" /></figure><p>You can think of this module as a blueprint explaining all the interfaces of the Concrete scheme. So instead of being a written document, it is actual Rust code, which can be used to check the compliance of an implementation at compile-time. You can see that this specification contains two kinds of traits:</p><ul><li><strong>Entities</strong>, which represent data types used in the framework (in green)</li><li><strong>Engines</strong>, which represent operators acting on entities (in orange)</li></ul><p>The specification is full of entities and engines, and you can have a look <a href="https://docs.rs/concrete-core/1.0.0-alpha/concrete_core/">here</a> to see all the data types and all the operations currently supported.</p><p>So, how will this help to accelerate FHE? Next to this specification module, we have a backend module, which currently contains a core submodule:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T8bEvRfFYIP4sR3H" /></figure><p><strong>That</strong> is our current implementation of concrete-core. It provides multiple objects that follow the pattern described in the specification module. As such, we have:</p><ul><li>Multiple <em>entities</em> which are actual FHE data types, each implementing one *Entity trait</li><li>One <em>engine</em>, which implement many of the *Engine traits present in the specification</li></ul><p>As a hardware designer, to accelerate an entry point in Concrete-core, all you have to do is to create a new module in this backend folder, which implements the part of the specification you are interested in. The point of the specification design is that you do not need to rely on us to create a new backend. You can work your implementation at your own pace, while relying on the Rust compiler to verify that your logic follows the specification at every step.</p><h3>Simplifying the benchmarking of new accelerations</h3><p>An important step in the process of integrating a new acceleration with Concrete-core, is to verify that performances meet expectations. To make it fast to benchmark a new backend, we introduce a generic benchmarking facility that makes it a breeze to benchmark your implementation. Indeed, having this abstract specification module makes it possible to develop a generic benchmark harness:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F7mXHurP7t5hlUhZ" /></figure><p>This Concrete-benchmark application (already available in the repository) makes it possible to benchmark the operators you implemented in a matter of minutes. You just need to instantiate the bits of the generic benchmarking harness that your implementation covers. Even better, thanks to the generic nature of this benchmark, it is easy to compare with the existing implementation, and the ones that will be added later on.</p><p>In the same spirit, we are about to bring a comparable smoothness to verify the correctness of the operators. The Concrete-test application we’re currently working on will bring a set of generic tests that can be instantiated within minutes to verify the correctness of your implementation.</p><p>Fast verification and benchmarking of your accelerations will greatly reduce the hardships of accelerating FHE, and will help the community get up to speed to make homomorphic encryption more mainstream.</p><h3>Summing Up</h3><p>With this release candidate of the 1.0.0 version of Concrete-core, we’re bringing you a new architecture that allows fast integration of hardware accelerations.</p><p>We reworked the entire architecture of the library, to make it as simple as possible for hardware designers to integrate with the library. We also delivered a generic benchmark application which makes it possible to quickly compare the performance of your implementation with the other existing ones.</p><p>We hope that this will help Concrete-core to become the hub where compiler makers, library writers, and hardware designers meet to build the future of FHE. If you believe in this vision, and want to contribute, check out our <a href="https://docs.zama.ai/concrete/core-lib/master/dev/tutorial.html">tutorials</a> and start a pull request!</p><p><strong>Get the latest news about homomorphic encryption</strong> and what we do at Zama: <a href="https://zamafhe.substack.com/">subscribe to our newsletter</a>.</p><p><strong>We are hiring!</strong> Join Zama and help us safeguard privacy by making the internet encrypted end-to-end. All the info here: <a href="https://jobs.zama.ai/?utm_source=Concrete_Core_v100&amp;utm_medium=medium&amp;utm_campaign=blogpost">jobs.zama.ai</a></p><p><strong>We’re open source </strong>— follow Zama on Github here: <a href="https://github.com/zama-ai">github.com/zama-ai</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90012b2a4a98" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zama-ai/concrete-core-v1-0-0-alpha-90012b2a4a98">Concrete-core v1.0.0-alpha</a> was originally published in <a href="https://medium.com/zama-ai">Zama</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quantization of Neural Networks for Fully Homomorphic Encryption]]></title>
            <link>https://medium.com/zama-ai/quantization-of-neural-networks-for-fully-homomorphic-encryption-b4a60f0c359b?source=rss----1c82e4c8d84c---4</link>
            <guid isPermaLink="false">https://medium.com/p/b4a60f0c359b</guid>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[homomorphic-encryption]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Zama]]></dc:creator>
            <pubDate>Wed, 26 Jan 2022 14:15:12 GMT</pubDate>
            <atom:updated>2022-01-26T16:28:48.520Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Machine Learning and the Need for Privacy</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vlShJORm6Hti-L-9W8ANpw.png" /></figure><p>In machine learning, a neural network is a circuit of artificial neurons or nodes. Neural networks are the standard used to produce high quality models over unstructured data (images, sound and text). When it comes to solving tasks like image segmentation, raw audio generation, or machine translation, machine learning models based on neural networks provide by far the best performance. The rise of neural networks can be summarized in two main points:</p><ol><li>Hardware infrastructure (i.e. GPU and distributed training. Fast inference even for huge models)</li><li>Model complexity (essentially number of parameters)</li></ol><p>With ever more complexity and overhead, it’s more and more difficult for machine learning specialists to build, maintain, and serve these models, and as a result, a few corporations own most of the artificial intelligence (AI) space. As a result, most ML models running in the cloud are only accessible via an API. Trust and privacy are becoming important topics as the end users lack visibility and thus privacy is at stake.</p><p>In this article, we’re going to look at how <a href="https://zama.ai/?utm_source=Quantization_of_Neural_Networks&amp;utm_medium=medium&amp;utm_campaign=blogpost">Fully Homomorphic Encryption</a> offers a unique and unmatched solution to tackle the problem of trust and privacy in data and AI. We’ll focus on <em>Quantization</em>, which is all about mapping continuous infinite values to a smaller set of discrete finite values for efficiency reasons. Quantization is also a way to make existing models more FHE-friendly, and we’ll explain what that means below.</p><h3>Fully Homomorphic Encryption</h3><p>Fully Homomorphic Encryption (FHE) allows you to <a href="https://medium.com/zama-ai/homomorphic-encryption-101-c1524fb76013">compute on encrypted data</a>. The computation can be done with a series of publicly-available keys without endangering the security. The encrypted result is returned to the legitimate owner, who is the only one<strong> </strong>able to decrypt the message with the private key. Mathematically, it is computationally unachievable for the untrusted server to decrypt anything, since it does not ‘know’ the keys.</p><p>Here at Zama, we use FHE to turn neural networks into equivalent computations that work end to end over encrypted data. The goal is to make this as efficient as possible while limiting any drop in accuracy. <a href="https://whitepaper.zama.ai/">Programmable Bootstrapping</a><em> </em>(PBS) is the technique that makes this possible. This is a critical aspect in machine learning since activation functions are essentially nonlinear. In the rest of this post, we’ll assimilate the PBS to a simple table lookup over encrypted data.</p><h3>Quantization and FHE-friendly Neural Networks</h3><p>FHE allows you to use a large panel of operations that can be applied to machine learning models effectively. In a previous <a href="https://medium.com/zama-ai/privacy-preserving-insurance-quotes-356b9719b760">post</a>, we showed you a practical example for a linear model; neural networks work in a similar way.</p><p>Zama initially used <a href="https://medium.com/zama-ai/announcing-concrete-numpy-8b22abbaf355">an approximate solution</a> to convert neural networks into their FHE counterparts. The problem with this solution was that handling the FHE parameters for different neural network architectures is not trivial, and so we had to shift toward an exact paradigm where FHE can provide the exact same results as in clear.</p><p>The limitations of this new paradigm are two fold:</p><ul><li>Only multiplication by integers is possible.</li><li>The precision of PBS is limited (i.e.: the table lookups we can apply have a maximal size, typically 2⁷ or 128 different values; the larger the precision needed, the slower the inference).</li></ul><p>We can tackle these limitations with neural network quantization. Quantization is generally used to improve the efficiency or compression of neural networks, but it is also well adapted to circumventing some of the limits of FHE:</p><ul><li>Quantization can replace floating point value multiplications by integer multiplications, which are doable in FHE.</li><li>Quantization even allows reduction to small integers, which is a way to avoid the limited precision in PBS.</li></ul><h3>Quantization in Neural Networks</h3><p>Quantization of neural networks is a subdomain of neural network compression. Such techniques are mainly used to improve neural network inference time on embedded hardware or browser-like interfaces. The goal is to replace costly operations done on floats by much more efficient and relatively good approximations done on small integers. Quantization is currently implemented in some of the best-known deep learning libraries. A common approach is the affine quantization using <em>p</em> bits of precision. In a nutshell, when you want to reach lower precision than 8 bits, <a href="https://pytorch.org/blog/introduction-to-quantization-on-pytorch/#quantization-aware-training">Quantization Aware Training</a> is used to maintain a high accuracy between the quantized network and its floating points values counterpart.</p><p>Here’s a brief overview of how quantization works. Let X be a set of weights, inputs or activations outputs we want to quantize. Here is an example doing unsigned quantization (i.e. the quantization outputs integers that are greater or equal to 0):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7cb00f640531ce4b67b6d2d49c880d43/href">https://medium.com/media/7cb00f640531ce4b67b6d2d49c880d43/href</a></iframe><p>With the above equations, you can transform the entire neural network from floating point values to integers over p bits of precision and adapt the matrix multiplication as it is done in a fully connected layer or in a convolutional neural network (CNN) by replacing real values by their quantized values<em>.</em></p><h3>FHE-friendly Neural Network</h3><p>Moving forward, we’ll use PyTorch and Numpy to advance our example. We also make use of <a href="https://github.com/zama-ai/concrete-numpy">Concrete Numpy </a>and some preliminary versions of the tools that allow us to directly compile torch models. Note that the torch compilation functions are in a very early stage of development for now, while the numpy compilation functions are more robust. The next version of our framework will contain more stable torch compilation functions. In the compilation, we also include quantization in a transparent way for the user.</p><p>Now let’s start the coding by defining a standard pytorch model and use concrete.torch to convert it to a full numpy model.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/22c05d008a80739bf9114afc8400ceb9/href">https://medium.com/media/22c05d008a80739bf9114afc8400ceb9/href</a></iframe><p>In this snippet of code, we have a fully connected network in numpy that has a 97% accuracy on the MNIST test set.</p><p>Then, in the next snippet, we can start playing with quantization provided in the framework to transform our model to integers. We select a precision of 6 bits for our weights, activations, and layer outputs.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b9918e8aa48789d2f58cabdd48eb848/href">https://medium.com/media/3b9918e8aa48789d2f58cabdd48eb848/href</a></iframe><p>Post training quantization with 6 bits quantized precision allows us to maintain the model to its full performance (only 0.07% drop in performance, which is almost negligible). As expected, all layers, activations and inputs have been converted to integers, which allows us to get rid of one of the constraints of FHE: no more difficulties in limiting us to integer multiplications. The core computation (the matrix multiplication) is in full integers and the rest (scales in floats and zero point values) can take advantage of a table lookup along with the activation function (basically done with a PBS).</p><p>Finally, in classical quantization, inputs, first layer, and last layer are often left in floating point values to gain accuracy. For FHE, we need to deal with integers even for first and last layers. This will be done by applying an affine quantization process to the input, first, and last layers as well as the rest of the network. Note that in some tasks such as NLP the input is tokenized and thus already a good representation for FHE (one-hot vector along with the learnable embedding layer).</p><p>Another challenge is that a 32-bit accumulator is commonly used in the major ML frameworks for the core operation in a neural network (multiply-add). Due to the low-precision you can expect from PBS (currently, 7 bits in <a href="https://docs.zama.ai/concrete-numpy/stable/user/index.html">Concrete Numpy</a>), this is a much more complicated task to solve for the moment. This will soon be solved by the breakthroughs in FHE!.</p><p>Stay tuned to our blog to see how this work develops!</p><p>Thank you to <a href="https://medium.com/@jordan.frery_67753">Jordan Frery</a> for his contribution to this article.</p><p><strong>Get the latest news about homomorphic encryption</strong> and what we do at Zama: <a href="https://zamafhe.substack.com/">subscribe to our newsletter</a>.</p><p><strong>We are hiring!</strong> Join Zama and help us safeguard privacy by making the internet encrypted end-to-end. All the info here: <a href="https://jobs.zama.ai/?utm_source=Quantization_of_Neural_Networks&amp;utm_medium=medium&amp;utm_campaign=blogpost">jobs.zama.ai</a></p><p><strong>We’re open source </strong>— follow Zama on Github here: <a href="https://github.com/zama-ai">github.com/zama-ai</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4a60f0c359b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zama-ai/quantization-of-neural-networks-for-fully-homomorphic-encryption-b4a60f0c359b">Quantization of Neural Networks for Fully Homomorphic Encryption</a> was originally published in <a href="https://medium.com/zama-ai">Zama</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Privacy-preserving insurance quotes]]></title>
            <link>https://medium.com/zama-ai/privacy-preserving-insurance-quotes-356b9719b760?source=rss----1c82e4c8d84c---4</link>
            <guid isPermaLink="false">https://medium.com/p/356b9719b760</guid>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[homomorphic-encryption]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Zama]]></dc:creator>
            <pubDate>Wed, 19 Jan 2022 14:00:05 GMT</pubDate>
            <atom:updated>2022-01-19T14:00:04.960Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>A fully-encrypted use case using Concrete Numpy</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QjHLxoadb4oLfLLUgy6hoA.png" /><figcaption>📁 <a href="https://github.com/zama-ai/concrete-numpy">https://github.com/zama-ai/concrete-numpy</a></figcaption></figure><p>Last week <a href="https://medium.com/zama-ai/announcing-concrete-numpy-8b22abbaf355">we released Concrete Numpy</a>, a python package that contains the tools data scientists need to compile various numpy functions into their Fully Homomorphic Encryption (FHE) equivalents.</p><p>Today, we will show you how to build an FHE-enabled insurance incident predictor. You can reproduce the results shown here by running the associated <a href="https://docs.zama.ai/concrete-numpy/stable/user/advanced_examples/PoissonRegression.html?utm_source=privacy_preserving_insurance_quotes&amp;utm_medium=medium&amp;utm_campaign=blogpost">notebook</a> in the Concrete Numpy documentation.</p><p>Let’s say you’re looking for a new car insurance policy and would like to compare some quotes. You can compare quotes online, but this requires you to fill in some personal information, such as your home address, date of birth, and driver license number. This data could be stored by the websites and your implicit permission is buried somewhere in a very long Terms of Service contract. You might be aware of data leaks where large databases of personal data were obtained by malicious parties using it for identity theft, so you’re quite hesitant to use such a service.</p><p>How can technology overcome this issue of trust? The answer is <a href="https://zama.ai/?utm_source=privacy_preserving_insurance_quotes&amp;utm_medium=medium&amp;utm_campaign=blogpost">Fully Homomorphic Encryption</a> (FHE), a technology that allows third parties to provide applications on your data without actually getting access to it, meaning the data stays encrypted during processing. Thus, the service processes your data without having access to it, and you receive the quote without giving away any of your information. At the end, you will be the only one who can read the quote by decrypting it, and the remote service can only store encrypted data that would be useless to an attacker.</p><h3>Building a simple insurance incident predictor</h3><p>Let’s now peer through an application developer’s perspective: <strong>How can I use my insurance quote predictor model on encrypted data?</strong></p><p>At Zama, we are developing Concrete Numpy to allow data scientists and developers to train or convert machine learning models into the FHE paradigm. Let’s look at an example for car insurance.</p><p>First, we’ll train a model based on some <a href="https://www.openml.org/d/41214">open data from OpenML</a>, following a <a href="https://scikit-learn.org/stable/modules/linear_model.html#generalized-linear-regression">tutorial</a> from the popular scikit-learn framework. This data set contains 670,000 examples giving the frequency of car accidents for drivers of various ages, past accident history, car type, car color, geographical region, and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6DMWuh5V8IcswBox7lwQQA.png" /></figure><p>Some of the features are continuous, some ordinal, and some nominal. The target feature which is the frequency of car accidents (ClaimNb/Exposure), has a Poisson distribution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/0*aL8a-EjQ3BxswyCo" /></figure><p>This suggests that if we are to model the frequency based on the other features we should use Poisson Regression. This technique is a generalized linear model with a log-link function:</p><pre>Ln (lambda) = w . x + b</pre><pre>Frequency ~ Poisson(lambda)</pre><p>Let’s first build a model with a single predictor variable, for which we can easily visualize the regression trend line. We will then build a full model with all the predictors. With scikit-learn, training a model only takes a line of code, and with a second line we will predict on the independent test set.</p><pre>reg = PoissonRegressor(alpha=1e-12, max_iter=300)</pre><pre>reg.fit(df_train[“DrivAge”].values.reshape(-1,1), df_train[“Frequency”])</pre><pre>predictions = reg.predict(test_data)</pre><h3>Converting your model to FHE</h3><p>So, how can you run this model in FHE? It’s simple if you use <a href="https://github.com/zama-ai/concrete-numpy">Concrete Numpy</a>. We first need to quantize the model’s parameters to integers. In our implementation of FHE we cannot use floating point operations, but computations with floating points on integers <em>can</em> be pre-computed into lookup tables. These table lookups are executed with what is known as <a href="https://whitepaper.zama.ai/">Programmable Bootstrapping</a> (PBS), a unique FHE bootstrapping approach.</p><p>For Poisson regression, prediction requires to compute the linear part of the model w.x + b and then apply the inverse of the link function. In our case the link function is the natural logarithm so the inverse-link is the exponential function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/139/0*QB0uKOCy9UFHYDlg" /></figure><p>Using the Generalized Linear Model from Concrete Numpy, converting the model to FHE is easy, but requires a calibration set that converts the parameters <strong>w</strong> from floating point to integer and builds the PBS lookup table.</p><pre>calib_data = np.expand_dims(df_calib[“DrivAge”].values, 1)</pre><pre>n_bits = 5</pre><pre>q_glm = QuantizedGLM(n_bits, reg, calib_data)</pre><pre>q_test_data = q_glm.quantize_input(test_data)</pre><p>Next, you compile the model to FHE with Concrete Numpy:</p><pre>engine = q_glm.compile(q_test_data)</pre><p>And you are ready to predict on encrypted test data:</p><pre>for i, q_sample in enumerate(q_test_data.qvalues):</pre><pre>q_pred_fhe = engine.run(q_sample)</pre><p>Let’s compare the results of the model in clear, working on floating point with the one compiled in FHE working with 5-bit quantized inputs and parameters:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/0*pDnxo6MI3pQXpDRO" /></figure><h3>Analysis of the univariate model</h3><p>It appears that this univariate model based on age is not a good predictor. The Poisson deviance which measures the goodness of fit is quite high. We do note that there is a slight degradation in the Poisson deviance (let’s call it <strong>d </strong>in the following) with the quantized FHE model. This is due to the fact that we quantized the inputs and the weights to 5 bits. We also note some noise in the FHE quantized model which is caused by the encryption scheme.</p><h3>Building a more complex model</h3><p>Following the scikit-learn tutorial, we will now build a more complex model that uses all the predictor features. We proceed by transforming the raw features into ones that can be input to a regression model. Thus, the categorical features are transformed into one-hot encoding, and we also bin vehicle and person age. Transforming the data this way, we end up with a total of 57 continuous features (instead of the initial 11).</p><p>Here is where we encounter one of the limitations of our framework. We perform a dot product in the prediction, w . x, but in our framework the maximum integer size is, for now, limited to 7 bits. As every multiplication doubles the number of bits of precision of the inputs performing 57 multiplication-additions of integers to compute w.x would quickly overflow 7 bits.</p><p>We can compute the number of accumulator bits necessary for a certain number of dimensions of <strong>w</strong> and <strong>x </strong>when they are represented in <strong>b</strong> bits as :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/0*MhPdtDJF4LohrO27" /></figure><p>With 2 bits for the values in <strong>w</strong> and <strong>b</strong>, to keep the accumulator at 7 bits, we can afford up to 14 dimensions. Luckily we have tools, such as Principal Component Analysis (PCA), to reduce data dimensionality while minimizing the loss of information.</p><p>Let’s first perform a PCA to reduce dimensionality from 57 to 14 dimensions, and normalize the transformed features to have zero-mean. We create a scikit-learn pipeline to transform the features, do PCA, then fit the GLM:</p><pre>poisson_glm_pca = Pipeline(</pre><pre>  [</pre><pre>      (“preprocessor”, linear_model_preprocessor),</pre><pre>      (“pca”, PCA(n_components=15, whiten=True)),</pre><pre>      (“regressor”, PoissonRegressor(alpha=1e-12, max_iter=300)),</pre><pre>  ]<br>)</pre><pre>poisson_glm_pca.fit(</pre><pre>      df_train,</pre><pre>      df_train[“Frequency”],</pre><pre>      regressor__sample_weight=df_train[“Exposure”]</pre><pre>)</pre><p>Performing PCA in this case very slightly reduces our model’s predictive power:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZmfxWdVBICxOWTD0wMNIBg.png" /></figure><p>Now let’s examine the effects of quantization and FHE compilation on the model. Note that when running the compiled FHE program, the results are identical to those of the quantized model in the clear, our FHE compiler does not introduce any loss of precision, thanks to <a href="https://medium.com/zama-ai/announcing-concrete-numpy-8b22abbaf355">the exact approach we have taken</a>! We’ll now make a graph of the Poisson deviance for multiple quantization bit-widths.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*li_EBpsLdmk2QqI1bAHkKw.png" /></figure><p>You’ll notice in this graph that the quality of the prediction (high deviance) starts getting worse around 3–4 bits. With 14 features we are forced to work in 2 bits. This will improve soon when we improve quantization tools in Concrete Numpy.</p><p>We can now complete the comparison:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iWF0fqIgauw7qr7kNpPcZQ.png" /></figure><h3>Conclusion</h3><p>In this article, we looked at how you can use Concrete Numpy to convert a scikit-learn-based Poisson regression model to FHE. We have shown that, with the proper choice of pipeline and parameters, we can do the conversion with little loss of precision. This decrease in the quality of prediction is due to quantization of model weights and input data, and some minor noise can appear due to FHE.</p><p>All the results of this article can be produced by running the associated python <a href="https://docs.zama.ai/concrete-numpy/stable/user/advanced_examples/PoissonRegression.html?utm_source=privacy_preserving_insurance_quotes&amp;utm_medium=medium&amp;utm_campaign=blogpost">notebook</a>.</p><p><em>Thank you to</em><a href="https://medium.com/@andrei.stoian"><em> Andrei Stoian</em></a><em> for his contribution to this article.</em></p><p><strong>Get the latest news about homomorphic encryption</strong> and what we do at Zama: <a href="https://zamafhe.substack.com/">subscribe to our newsletter</a>.</p><p><strong>We are hiring!</strong> Join Zama and help us safeguard privacy by making the internet encrypted end-to-end. All the info here: <a href="https://jobs.zama.ai/?utm_source=privacy_preserving_insurance_quotes&amp;utm_medium=medium&amp;utm_campaign=blogpost">jobs.zama.ai</a></p><p><strong>We’re open source </strong>— follow Zama on Github here: <a href="https://github.com/zama-ai">github.com/zama-ai</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=356b9719b760" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zama-ai/privacy-preserving-insurance-quotes-356b9719b760">Privacy-preserving insurance quotes</a> was originally published in <a href="https://medium.com/zama-ai">Zama</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Concrete Numpy]]></title>
            <link>https://medium.com/zama-ai/announcing-concrete-numpy-8b22abbaf355?source=rss----1c82e4c8d84c---4</link>
            <guid isPermaLink="false">https://medium.com/p/8b22abbaf355</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[fhe]]></category>
            <category><![CDATA[homomorphic-encryption]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Zama]]></dc:creator>
            <pubDate>Wed, 12 Jan 2022 14:29:35 GMT</pubDate>
            <atom:updated>2022-01-12T17:15:00.218Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uYyA-y7jX22xjsyAbEO_dQ.png" /><figcaption><em>📁 </em><a href="https://github.com/zama-ai/concrete-numpy"><em>https://github.com/zama-ai/concrete-numpy</em></a></figcaption></figure><p>Zama are very excited to announce our release of <em>Concrete Numpy</em> as a public beta. Building on the efficiency, usability, and simplicity of the <a href="https://docs.zama.ai/concrete/lib/">Concrete</a> library, we are releasing this open source compiler and a Numpy frontend.</p><h4><strong>Learning from our past prototype</strong></h4><p>In October 2021, <a href="https://medium.com/zama-ai/homomorphic-rnns-with-numpy-and-concrete-ed890402ab86">we showcased our HNP</a> (Homomorphic Numpy) prototype. It allowed data scientists without any prior knowledge of cryptography to automatically turn Numpy functions into their FHE equivalent. Concrete Numpy incorporates many of the things we learned from the original HNP prototype.</p><h4><strong>HNP: A great API to build encrypted programs</strong></h4><p>HNP (<a href="https://github.com/zama-ai/hnp-examples">see examples</a>) is far more user friendly than other APIs for cryptographers. Install our tool, open your Jupyter notebook, and simply import the HNP package in python. Then, you just have to write Numpy as you would normally do. No prior understanding of cryptography is required to create an equivalent program running over encrypted values. You only have to give the shapes, data types, and whether the inputs of the program are clear or encrypted at runtime.</p><p>We believe that over-complex systems can easily introduce vulnerabilities, this is why we want to provide an automatically secured configuration. Of course, if you are curious, you can still check <a href="https://medium.com/zama-ai/homomorphic-encryption-101-c1524fb76013">Homomorphic Encryption 101</a>.</p><h4><strong><em>Concrete Numpy</em>: A fully fledged toolkit for data scientists.</strong></h4><p>With our new package, more information is inferred from the function itself, making things even more user-friendly. How? In HNP, we used a dataset in the compilation call. The dataset is a set of representative entries to the function that let the compiler know what is the typical dynamic range of the data in each of the intermediate computations. Knowing this range, Concrete Numpy is able to compute the appropriate FHE parameters. Our package also uses this (unlabelled) dataset to automatically recover information like shapes or bitsize of inputs. You only have to define what is encrypted and what is clear, and that’s it!</p><p>The call is as simple as this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Spj8OLGna2O7aZ3ZGUT8-g.png" /></figure><p>Then you can use the compiler object to calibrate with the dataset.</p><h4><strong>Difficulties with precision</strong></h4><p>With our previous HNP prototype, the user had nothing to manage and everything was done under the hood. The downside was that if anything went wrong (like an accuracy drop during compilation), nothing could be done. These errors are notably due to the fact that FHE has limited precision. Presently at Zama, we have the analogy of FHE with an 8-bit CPU.</p><p>With our new Concrete Numpy, your job is to convert high precision ML models (typically, machine learning algorithms using float32 or float64) into models with less precision, and with smaller and more discretized values. It is a common practice in the ML world, and many tools (as well as academic literature) exist to help you perform model quantization and compression. We will soon release another blog post about quantization and its use for FHE-friendly models, so make sure to <a href="https://zamafhe.substack.com/">subscribe to our newsletter</a>.</p><h4><strong>Approximate vs Exact approaches</strong></h4><p>A worthwhile change from the deprecated HNP that can be tricky to understand for a non-cryptographer is the difference between the approximate approach and the exact approach.</p><p>Our HNP prototype used the approximate approach, meaning that, while it accepted a larger dynamic range for data, it also allowed some minor errors during computation (this is due to the so-called drift in the programmable bootstrapping, and you can <a href="https://whitepaper.zama.ai/">read more about it here</a>).</p><p>Such errors can be acceptable for some ML models with favorable parameter distributions (eg: several neural networks) as some neural networks can absorb tiny differences in intermediate values. But the approximate approach and its stochastic nature made debugging model accuracy issues very difficult in case of problems. It also made noise management (which is a critical cryptographic parametrization for the security) much more complicated.</p><p>The new Concrete Compiler and <a href="https://youtu.be/lZ-abZy9S5k?t=2441">its exact approach</a> (<em>from 40:41s</em>) accepts a much smaller range for data, and it only supports integers. In a way, we’re back at using an 8-bit CPU, but this restricted type of data assures the exactitude of computations (with a high degree of probability). The exact nature of the computation allows you to simplify the choice of FHE parameters and the functions compiled will be turned into bit-exact FHE-equivalents.</p><h4><strong>Splitting the work: You take care of the data science, we do the cryptography</strong></h4><p>With this new version, we have split the task done by our previous HNP prototype in two parts:</p><ul><li>Data science: you are now responsible to adapt your models so that they respect FHE constraints such as using low precision values.</li><li>Cryptography: we take care of all the tasks related to cryptography.</li></ul><p>We encourage you to do the initial work on what you do best: data science. Therefore, you have more control on your ML models and we, on our part, can guarantee the best accuracy in FHE. We will continue to focus on our main job: the compilation into FHE, handling every aspect of FHE security and optimizations for execution, speed and RAM usage.We will also deliver examples and tricks on how to do these model optimizations, so you’ll be able to deal with FHE constraints. We’re also working on other ML tools that will simplify the work of data scientists. Stay tuned for more information, and rest assured that, as promised, we can’t wait to open source them.</p><blockquote><strong><em>Here is the </em></strong><a href="https://docs.zama.ai/concrete-numpy/stable"><strong><em>documentation</em></strong></a>, <strong><em>the </em></strong><a href="https://github.com/zama-ai/concrete-numpy"><strong><em>Github repo</em></strong></a><strong><em> and some interesting </em></strong><a href="https://docs.zama.ai/concrete-numpy/stable/user/advanced_examples/index.html"><strong><em>ML examples</em></strong></a><strong><em> that we were able to build with Concrete Numpy.</em></strong></blockquote><p>And while you can already start playing with Concrete Numpy, next week we will show you how to build an FHE-enabled insurance incident predictor with this tool, <a href="https://zamafhe.substack.com/">so stay tuned</a>.</p><p><strong>Get the latest news about homomorphic encryption</strong> and what we do at Zama: <a href="https://zamafhe.substack.com/">subscribe to our newsletter</a>.</p><p><strong>We are hiring!</strong> Join Zama and help us safeguard privacy by making the internet encrypted end-to-end. All the info here: <a href="https://jobs.zama.ai/">jobs.zama.ai</a></p><p><strong>We’re open source </strong>— follow Zama on Github here: <a href="https://github.com/zama-ai">github.com/zama-ai</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b22abbaf355" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zama-ai/announcing-concrete-numpy-8b22abbaf355">Announcing Concrete Numpy</a> was originally published in <a href="https://medium.com/zama-ai">Zama</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data governance is in desperate need of innovation]]></title>
            <link>https://medium.com/zama-ai/data-governance-is-in-desperate-need-of-innovation-19dfd66e62d0?source=rss----1c82e4c8d84c---4</link>
            <guid isPermaLink="false">https://medium.com/p/19dfd66e62d0</guid>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[internet]]></category>
            <category><![CDATA[homomorphic-encryption]]></category>
            <category><![CDATA[privacy]]></category>
            <dc:creator><![CDATA[Jeremy Bradley-Silverio Donato]]></dc:creator>
            <pubDate>Wed, 22 Dec 2021 14:23:23 GMT</pubDate>
            <atom:updated>2022-01-07T14:50:26.954Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uJSdnud0BJXJRFqXMu2uFw.png" /></figure><blockquote><strong>Jeremy Bradley-Silverio Donato </strong>is Chief of Staff at <a href="https://zama.ai/">Zama</a>, an open source framework for securing AI applications in the cloud. <strong>Lorrayne Porciuncula</strong> is the Executive Director of the<a href="https://www.thedatasphere.org/"> Datasphere Initiative</a>. They discuss how the data governance policy landscape is evolving and examples of the new technologies that can offer innovative ways of transferring and securing data.</blockquote><h3>How has the thinking on data governance evolved over the past decade?</h3><p><em>Lorrayne Porciuncula</em><strong><em>, Datasphere Initiative</em></strong></p><p>From a policy perspective, historically, from about the late seventies, the topic of data governance has been framed with a focus on concerns around privacy and data protection. It became a trade issue at the end of the nineties and since then there has been very little progress in multilateral fora in terms of finding a common vocabulary to discuss data governance more systemically, and to measure the value of data, both from an economic and social perspective.</p><p><em>Jeremy Bradley, Chief of Staff</em><strong><em>, Zama</em></strong></p><p>If we look at the private sector, many companies have to deal with the problem of data governance. In the past years, the amount of data collected has grown, and very often this data is sensitive. Many laws and international regulations (such as the European Union’s General Data Protection Regulation) act to protect this data. But companies might be victims of attacks and data theft even with these regulations in place. Many examples have happened recently. This has a strong judiciary and economic cost for companies. Better solutions are required: crypto can help.</p><h3>Why can data governance be challenging?</h3><p><em>Jeremy Bradley, Chief of Staff</em><strong><em>, Zama</em></strong></p><p>With the advent of the internet, the amount of private data we generate has increased exponentially — and with it a massive rise in data breaches and mass surveillance.</p><p>These sorts of risks can be mitigated with end-to-end encryption in our everyday apps such as WhatsApp, however, techniques such as ‘Encryption’ can sometimes be used as a buzzword these days which can be unhelpful for data governance.</p><p>Many websites and online services claim to be encrypted and most of us rest assured that our data is protected as we navigate around the internet. However, when a service provider claims that your data is being encrypted on the internet, it often just means that the data is transformed into an insignificant form that no one can make use of, except if they hold a private key that allows decryption. The reverse operation, encryption, transforms useful data into random data, and decryption can transform it back to its original form. However, there is a point where the data needs to be decrypted, and that point comes just before it is necessary to compute the data. At this point, the data is left unencrypted and ripe for interference. If the data is sensitive, we should not allow online services to access them. Something more than just encryption/decryption is necessary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*e3g7v5PL5c5BAGj8" /></figure><p><em>Lorrayne Porciuncula</em><strong><em>, Datasphere Initiative</em></strong></p><p>What Jeremy points to here is an interesting example of how buzz words around data governance can lead to confusion on how data is managed and secured.</p><p>If we look at policy debates, data governance is increasingly challenging because the world of data is growing. Data is different from traditional goods and services, very diverse, and prone to overlapping models of classification. This complexity is exasperated by the many different actors connected by non-linear value chains in the data economy.</p><p>The issue of data governance, therefore, becomes very complex, and innovative frameworks are needed for us to address competing policy objectives and also clarify how different techniques such as encryption and others can be used.</p><h3>How can we shift the perspective on data governance and consider more innovative models for transferring as well as securing data?</h3><p><em>Lorrayne Porciuncula,</em><strong><em> Datasphere Initiative</em></strong></p><p>Approaching the environment in which all digital data exists as a global Datasphere could provide the fundamental perspective shift needed for the holistic multi-disciplinary approach that governing data for the public interest requires.</p><p>For example, discussion on data governance often focuses on the location of data. Like the atmosphere or the stratosphere, the concept of the Datasphere can ​​de-territorialize data and frame it as an ecosystem and a common resource.</p><p>This encourages us to take a step back and question whether we should be concerned with only the location of storage and processing of data, or rather who is collecting and accessing the data and for what purposes.</p><p>At the Datasphere Initiative, our intention is to use the concept of the Datasphere, defining it as — the ecosystem encompassing all types of data and the complex dynamics between data, human groups, and norms — to help overcome some of the current tensions and polarization around data and encourage a new, holistic and positive approach.</p><p><em>Jeremy Bradley, Chief of Staff</em><strong><em>, Zama</em></strong></p><p>A first step in shifting perspective on data governance is recognizing that we need mechanisms to secure data end to end, from the time we send it, to the time we receive it, and on any result inferred from it. Until recently, this wasn’t part of the cryptography toolkit.</p><p>Fortunately, there are innovative models for transferring as well as securing data and true end to end encryption can now be provided for by what we call <a href="https://zama.ai/?utm_source=article&amp;utm_medium=article&amp;utm_campaign=datasphere_article">Fully Homomorphic Encryption</a> (FHE for short).</p><p>FHE is a technology that enables processing data without decrypting it. This means companies can offer their services without ever seeing their users’ data — and users will never notice a difference in functionality. With data encrypted both in transit and during processing, everything we do online could now be encrypted end to end, not just sending messages. This also means no data theft and, importantly, the location of the server is kept private.</p><h3>How is homomorphic encryption different from other tools and do you have any real-life examples and applications?</h3><p><em>Jeremy Bradley, Chief of Staff</em><strong><em>, Zama</em></strong></p><p>Homomorphic encryption is an extension of public-key cryptography, but it has an additional evaluation capability for computing over encrypted data without access to the secret key. The result of such computation thus remains encrypted.</p><p>Other privacy-preserving solutions are possible, but FHE is the easiest to deploy and offers functionalities that other technologies cannot offer. It was not usable until a few years ago, but the advancement has been impressive, and we can now see some real-world applications with FHE.</p><p>For sensitive data, such as healthcare information or contact tracing, FHE can be used to enable new services by removing privacy barriers inhibiting data sharing or by increasing security to existing services. Predictive analytics is another strong use case. Predictive analytics are typically hard to apply via a third-party service provider due to data privacy concerns. FHE would allow a predictive analytics service provider to operate on encrypted data instead, meaning these privacy concerns would be diminished. Moreover, even if the service provider’s system is compromised, the data would remain secure, because it is encrypted all the time.</p><p>At Zama, we believe that all online services should offer full end-to-end encryption. You should be able to rely on the knowledge that any service using private data is transferring and manipulating only encrypted data. This way, you can make sure your sensitive information is never leaked by the service provider.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3YYa4kn8bESyjzxL" /></figure><h3>How can we catalyze these sorts of innovations for data governance?</h3><p><em>Lorrayne Porciuncula,</em><strong><em> Datasphere Initiative</em></strong></p><p>We need a platform to discuss data that is truly global and cross-sectoral. We need the participation of the global south of companies of all sizes from sectors such as health, agriculture, and transport to name a few. We need better institutions that are agile to advance not only normative measures but also tech-enabled ones that foster trust, prosperity, sustainability, and well-being for all.</p><p>The work of actors like Zama is exemplary of the type of innovations that can emerge when we privacy is not seen as opposed to the usability of data. We need to take stock of these innovative solutions and business models, such as those offered also by data fiduciaries and data collectives and imagine their use and applicability in a variety of contexts, including to advance the global debate around data governance. At the Datasphere Initiative, we plan to provide a space for that type of exchange with the goal to catalyze human-centric technical, policy, and institutional innovations.</p><blockquote><em>Learn more about end to end encryption with this 6-minute introduction from the Zama team here: </em><a href="https://6min.zama.ai/?utm_source=article&amp;utm_medium=article&amp;utm_campaign=datasphere_article"><em>6min.zama.ai</em></a></blockquote><p><em>Many thanks to Ilaria Chillotti, Director of Research at Zama, who contributed to this article.</em></p><blockquote>If you’re interested in getting the latest news about homomorphic encryption and what we do at Zama, you can <a href="https://zamafhe.substack.com/"><strong>subscribe to our newsletter</strong></a>.</blockquote><blockquote>We are hiring! Join Zama and help us safeguard privacy by making the internet encrypted end-to-end. All the info here: <a href="https://jobs.zama.ai/?utm_source=data_governance_is_in_desperate_need_of_innovation&amp;utm_medium=zama_blog_post&amp;utm_campaign=medium"><strong>jobs.zama.ai</strong></a></blockquote><blockquote>We’re open source — follow Zama’s CONCRETE library on Github here: <a href="https://github.com/zama-ai/concrete"><strong>github.com/zama-ai</strong></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19dfd66e62d0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zama-ai/data-governance-is-in-desperate-need-of-innovation-19dfd66e62d0">Data governance is in desperate need of innovation</a> was originally published in <a href="https://medium.com/zama-ai">Zama</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Estimating the Security of Homomorphic Encryption Schemes]]></title>
            <link>https://medium.com/zama-ai/estimating-the-security-of-homomorphic-encryption-schemes-cb798f9378f?source=rss----1c82e4c8d84c---4</link>
            <guid isPermaLink="false">https://medium.com/p/cb798f9378f</guid>
            <category><![CDATA[cryptography]]></category>
            <category><![CDATA[lattice]]></category>
            <category><![CDATA[homomorphic-encryption]]></category>
            <category><![CDATA[zama]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Ben Curtis]]></dc:creator>
            <pubDate>Wed, 15 Dec 2021 14:41:52 GMT</pubDate>
            <atom:updated>2022-01-07T15:15:42.908Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog post was co-authored by <a href="https://medium.com/@michael.walter">Michael Walter</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AmfY7Ub_72T3wOdNDIYYXg.png" /></figure><p>The security of any cryptography scheme is paramount. As part of our commitment to this, our team at Zama have been working on improving the Lattice Estimator. The <a href="https://github.com/malb/lattice-estimator">Lattice Estimator</a> (formerly the <a href="https://bitbucket.org/malb/lwe-estimator/src/master/">LWE Estimator</a>) is a tool used throughout industry and academia to estimate the security level of Learning with Errors-based parameter sets. The tool has been used previously in standardization efforts: including the NIST standardization process for post-quantum encryption/signature schemes, as well as the ISO effort to standardize <a href="https://zama.ai/?utm_source=Estimating_the_Security_of_Homomorphic_Encryption_Schemes&amp;utm_medium=zama_blog_post&amp;utm_campaign=medium">homomorphic encryption</a> schemes.</p><p>The goal of our work is to bring the Lattice Estimator in-line with state-of-the-art attacks in the literature, so that users can be confident in the selection of their cryptographic parameters. Moreover, we are making this work public in line with our commitment to open-source projects.</p><p><strong>Learning with Errors</strong></p><p>The Learning with Errors problem challenges an adversary to recover a secret vector <strong>s </strong>from a noisy system of equations <strong>b </strong>=<strong> A*s </strong>+<strong> e</strong>, where <strong>A</strong> is a public integer matrix of size m x n, all the other terms are vectors such that the dimensions match and the arithmetic is modulo some modulus q. For this problem to be well-defined, we assume that n is smaller than m and that <strong>e</strong> is small.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_f3TG0OXezZOCMyx" /></figure><p>With the correct selection of parameters, this problem can provide an assured level of security (such as 128-bits) for a wide range of cryptographic primitives, for example homomorphic encryption schemes, including <a href="https://github.com/zama-ai/concrete">Zama’s Concrete library</a>. This is achieved by estimating the running times of known attacks, and setting the security level to be the running time of the fastest attack (optionally, with some additional security margin).</p><p>There are a bunch of attacks, as we will see below, and it is generally unclear which attack is the most efficient for a given instance. As pointed out in the <a href="https://doi.org/10.1515/jmc-2015-0016">work</a> that initiated the LWE estimator, for each attack there are LWE instances (i.e. values of m, n, q, and size of <strong>e</strong>) for which this attack is the fastest. So unless you have really good intuition for specific LWE parametrizations, estimating the security of an LWE instance requires checking all known attacks. Performing this step manually for every possible instantiation of a scheme (or every new scheme) quickly becomes tedious, especially since many attacks have several parameters that need to be optimized. This is where the estimator comes in: it provides an automated way of quickly estimating the running time of all major attacks against an LWE challenge, just given the parameters of the problem. It thus allows a user to quickly evaluate the security of a specific parametrization of e.g. an encryption scheme based on LWE.</p><p><strong>Attacks</strong></p><p>Let’s now look at a subset of the attacks considered in the Lattice Estimator. In particular, we’ll discuss the class of lattice attacks comprising the uSVP attack, decoding attacks, and dual attacks. We present simplified versions of these attacks for the purposes of this blog post, further details can be found e.g. <a href="https://eprint.iacr.org/2015/046.pdf">here</a>. Before we dive into the attacks, a reminder that lattices are discrete subgroups of <strong><em>R</em>ⁿ</strong>.</p><p><strong>The uSVP Attack</strong></p><p>The uSVP attack constructs a lattice <strong>L</strong> for which the LWE error vector (i.e (<strong>e</strong>,1)) is an unusually short vector in <strong>L</strong>. This lattice has basis matrix <strong>B, </strong>where:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/157/1*An19k_Xmj_RqIVNk6F454A.png" /></figure><p>We can see that this lattice contains the short vector (<strong>e</strong>,1) by considering the argument:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*yabtFEXaa7_Dp7IJWh7Tlw.png" /></figure><p>We can then use known approximation algorithms (i.e. <a href="https://blog.simons.berkeley.edu/2020/04/lattice-blog-reduction-part-i-bkz/">lattice reduction techniques</a>) to recover this secret vector, at a known cost. The shorter the secret vector, i.e. the more unusual, the lower the cost of recovering it. Once the error vector <strong>e </strong>is recovered, we can easily find the LWE secret <strong>s</strong> via Gaussian elimination.</p><p><strong>Decoding Attacks</strong></p><p>Decoding attacks succeed via the construction of Bounded Distance Decoding (BDD) instances. The figure below shows how this looks for LWE. We have a lattice generated by the public LWE matrix <strong>A</strong>, which contains the (private) lattice point (<strong>s</strong>, <strong>As</strong>). This private lattice point is separated from the public point <strong>t = </strong>(<strong>0,b</strong>), by the (private) vector (<strong>s</strong>,<strong>-e</strong>). This is exactly a BDD instance: we know <strong>b </strong>(as it is public), and we want to find the closest lattice point (i.e. (<strong>s</strong>, <strong>As</strong>)) in order to recover the vector (<strong>s</strong>,<strong>-e</strong>). Notice that it is important here that <strong>s </strong>and<strong> e</strong> are short, since otherwise we may find the incorrect lattice vector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k1Mk_C23ZAJgiJK1" /></figure><p>The decoding attack can be improved (for certain parameters) by combining this approach with some searching strategy, which is known as a so-called (primal) hybrid attack. Specifically, we can break up the matrix <strong>A</strong> = [<strong>A</strong>¹ | <strong>A</strong>²] and the secret <strong>s</strong> = (<strong>s</strong>¹ | <strong>s</strong>²), and then write <strong>b</strong> = <strong>A</strong>*<strong>s</strong> + <strong>e</strong> = <strong>A</strong>¹*<strong>s</strong>¹ + <strong>A</strong>²*<strong>s</strong>² + <strong>e</strong>. Assume <strong>s¹</strong> has length 𝛇 and, by some lucky coincidence, we happen to know <strong>s¹</strong>. Then we can “remove” that part of the secret by computing <strong>b’</strong> = <strong>b</strong> — <strong>A</strong>¹*<strong>s</strong>¹ = <strong>A</strong>²*<strong>s</strong>² + <strong>e</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Vy4s8eDbBdv6kCWA" /></figure><p>This instance is easier to solve, since the secret is smaller. But how would we come to know <strong>s¹</strong>? One option is to simply guess it. So we could search through all possible candidates for <strong>s¹</strong> and try to solve the corresponding smaller LWE instance. It’s not immediately clear that reducing the size of the LWE problem is worth the additional effort of searching through all candidates for <strong>s¹</strong>, but we can take advantage of the fact that these new instances are not independent: they all have the same public matrix <strong>A²</strong>, which allows to amortize some heavy precomputation and thus improve the attack. This approach can be improved further, by employing some <a href="https://www.iacr.org/archive/crypto2007/46220150/46220150.pdf">Meet-In-The-Middle techniques</a> to speed up the exhaustive search part.</p><p><strong>Dual Attacks</strong></p><p>The dual attack is a little less direct than the previous two approaches. The main idea is to find some vector <strong>v</strong> such that <strong>v*A</strong> = <strong>0</strong> <em>and</em> <strong>v</strong> is short, i.e. only has small entries. If we are able to find such a vector, we can multiply the challenge vector <strong>b</strong> with it (a.k.a. take the inner product) to obtain <strong>v*b</strong> = <strong>v*A*s</strong> + <strong>v*e</strong> = <strong>v*e</strong>. Since <strong>e</strong> is typically a short vector and we know that <strong>v</strong> is short as well, this inner product should also be small.</p><p>You might be wondering how this is useful since it is not clear at first glance how this helps us solve the challenge of finding <strong>s</strong>. Notice though that this allows us to tell with some confidence if <strong>b</strong> is a properly formed LWE vector (with respect to the given public matrix <strong>A</strong>) or if it is just random junk, since random junk is unlikely to be small (even after multiplication with <strong>v</strong>). As it turns out, this is enough to break the security of encryption schemes based on the LWE problem. (You can also use this distinguishing algorithm to actually find the secret <strong>s</strong> with some more effort, but as stated, this is not actually required.) The hard part of this approach is to find a short vector <strong>v</strong> satisfying the above constraints.</p><p>This is an instance of a lattice problem and we can use our old friend, lattice reduction, to tackle this. The shorter the vector we find the better we can distinguish and thus the better the success probability of the attack, but finding short vectors in a lattice is hard. Optimising this trade-off is something the estimator can do for you.</p><p>As for primal hybrid attacks, we can again break up the problem at hand and use the dual attack to solve only part of it, which will yield dual hybrid attacks. More specifically, we break up the matrix <strong>A</strong> = [<strong>A</strong>¹ | <strong>A</strong>²] and the secret <strong>s</strong> = (<strong>s</strong>¹ | <strong>s</strong>²) again and write <strong>b</strong> = <strong>A</strong>*<strong>s</strong> + <strong>e</strong> = <strong>A</strong>¹*<strong>s</strong>¹ + <strong>A</strong>²<strong>s</strong>² + <strong>e</strong>. It is easier to find a short vector <strong>v</strong> such that <strong>v</strong>*<strong>A</strong>¹ = <strong>0</strong>, because the lattice corresponding to <strong>A</strong>¹ has a smaller dimension and volume compared to <strong>A</strong>. If we now multiply this vector with <strong>b</strong>, we get b’ = <strong>v</strong>*<strong>b</strong> = <strong>v</strong>*<strong>A</strong>²*<strong>s</strong>² + <strong>v</strong>*<strong>e</strong>. Notice that we can also compute <strong>a</strong>’ = <strong>v</strong>*<strong>A</strong>². Accordingly, we can view (<strong>a</strong>’, b’) as a row of a new LWE instance with smaller secret <strong>s</strong>² but larger noise. Using multiple such vectors <strong>v</strong> we can compute more rows of such an instance and hence a new LWE problem. For this new problem, we can use any other suitable attack, for example exhaustive search or Meet-In-The-Middle attacks. Again, we need to optimize over several parameters, for example the point where we split the matrix. With our PR to the Lattice Estimator, it can handle such attacks and optimize over all attack parameters.</p><p><strong>Our Work</strong></p><p>Put simply, what we’ve done is to bring the estimations for several attacks in the Lattice Estimator up to speed so they now represent the state-of-the-art. For this we focused mainly on hybrid attacks, because 1) this is where the estimator had the largest gaps and 2) these are particularly relevant for LWE instances that come up in FHE. Full technical details can be found in the associated <a href="https://github.com/malb/lattice-estimator/pull/8">pull request</a> on the Lattice Estimator repository. The following table summarizes our contributions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zXa0Igfpgjlf-mJ6h1nYuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KndGBm1yKByXLQ89N_4Fxg.png" /></figure><p><strong>Retrieving Security Estimates</strong></p><p>To show why the improvements outlined in Table 1 are important, we present some security estimates where the hybrid-dual and hybrid-decoding approaches are the fastest attacks and thus determine the security level of the LWE instance. Ignoring these attacks would likely result in overestimates of the security level, which is never the side you want to err on.</p><p>We demonstrate the power of the hybrid attacks using example parameter sets from <a href="https://ieeexplore.ieee.org/document/8747481">this work</a>. These parameters have not actually been proposed for use in any scheme, but they are close to what you might use in an FHE scheme and are useful for benchmarking and comparison. In fact, some of these sets are not too far off from what Concrete is using for some parts, with the main difference being that the secret in Concrete is binary and uniform, while in these examples it is ternary and sparse. Using sparse secrets may yield favorable trade-offs between security and performance, and some schemes do use sparse secrets for that reason, but accurate security estimation is paramount here.</p><p>We start with a parameter set where the secret dimension n=1024 and the modulus is q=2²⁵, and the standard deviation of the error distribution is σ=3.2. As part of this process, we have to select a model for estimating the running time of lattice reduction. While the default in the Lattice Estimator is a model from the <a href="https://pq-crystals.org/kyber/data/kyber-specification-round3-20210804.pdf">Kyber submission</a> to the NIST PQC, we use the <a href="https://epubs.siam.org/doi/10.1137/1.9781611974331.ch2">BDGL16</a> estimate, which is more common in the literature (and used in <a href="https://homomorphicencryption.org/">previous efforts for HE standardization</a>). Calling the Lattice Estimator via estimate_lwe() on this parameter set produces an output of the form:</p><pre>dual                : rop: ≈2^145.8, mem: ≈2^80.5, m: 915 ...</pre><pre>dual_hybrid         : rop: ≈2^114.6, mem: ≈2^92.3, m: 637 ...</pre><pre>dual_mitm_hybrid    : rop: ≈2^124.5, mem: ≈2^96.5, m: 637 ...</pre><pre>primal_bdd          : rop: ≈2^129.6, red: ≈2^129.5, ...</pre><pre>primal_usvp         : rop: ≈2^131.9, red: ≈2^131.9, ...</pre><pre><strong>primal_hybrid       : rop: ≈2^110.0, red: ≈2^109.0, ...</strong></pre><p>For a user, the important thing to notice is the rop value, i.e. “ring-operations”. Roughly speaking, this value corresponds to the time taken for the corresponding attack to be successful. We set the security of the parameter set according to the fastest attack, i.e. the attack with the smallest rop value. In this example, the fastest attack is primal_hybrid with a running time of 2¹¹⁰ ring-operations. Therefore, we say that this parameter set has a security level of 110-bits.</p><p>Now assume that for our application the noise grows too much for this parameter set to work, which is a common situation to arise in noisy homomorphic encryption. There are several ways to address this, one of them might be to increase the modulus (while keeping the size of the noise <strong>e</strong> the same). This naturally results in a decrease in security, which you can compensate for by using a larger dimension n. So let us try to set q=2⁸² and n=4096. The hope would be that this might maintain the security level. To check this, we again run the estimator, which gives the following output.</p><pre>dual                : rop: ≈2^175.0, mem: ≈2^95.6, m: ≈2^11.9 ...</pre><pre>dual_hybrid         : rop: ≈2^123.5, mem: ≈2^92.5, m: ≈2^11.1 ...</pre><pre><strong>dual_mitm_hybrid    : rop: ≈2^113.7, mem: ≈2^84.6, m: ≈2^11.0 ...</strong></pre><pre>primal_bdd          : rop: ≈2^168.3, red: ≈2^168.1, ...</pre><pre>primal_usvp         : rop: ≈2^169.0, red: ≈2^169.0, ...</pre><pre>primal_hybrid       : rop: ≈2^114.7, red: ≈2^113.9, ...</pre><p>As we can see from the output, we indeed are able to maintain the level of security. What is interesting is that the most efficient attack actually switched from being the primal hybrid attack, to dual hybrid attack (using Meet-In-The-Middle techniques).</p><p><strong>Summary</strong></p><p>Tools like the Lattice Estimator are vital to ensure that homomorphic encryption schemes are deployed in a secure manner. We plan to continue our contributions to the Lattice Estimator to ensure that the community can have additional confidence in the security of their homomorphic encryption parameter sets.</p><blockquote><em>If you’re interested in getting the latest news about homomorphic encryption and what we do at Zama, you can </em><a href="https://zamafhe.substack.com/"><strong><em>subscribe to our newsletter</em></strong></a><em>.</em></blockquote><blockquote><em>We are hiring! Join Zama and help us safeguard privacy by making the internet encrypted end-to-end. All the info here: </em><a href="https://jobs.zama.ai/?utm_source=Estimating_the_Security_of_Homomorphic_Encryption_Schemes&amp;utm_medium=zama_blog_post&amp;utm_campaign=medium"><strong><em>jobs.zama.ai</em></strong></a></blockquote><blockquote><em>We’re open source — follow Zama’s CONCRETE library on Github here: </em><a href="https://github.com/zama-ai/concrete"><strong><em>github.com/zama-ai</em></strong></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb798f9378f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zama-ai/estimating-the-security-of-homomorphic-encryption-schemes-cb798f9378f">Estimating the Security of Homomorphic Encryption Schemes</a> was originally published in <a href="https://medium.com/zama-ai">Zama</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>