A DASHing answer for healthcare information privateness – IBM Developer


In 2021, our staff gained third place within the second monitor of the iDASH workshop problem on healthcare information privateness. Our answer categorised 2000 viruses in lower than 1 second with greater than 99% accuracy through the use of the IBM homomorphic encryption HElayers library.

On this weblog, we describe the iDASH competitors, our answer, and what makes it so efficient. As a motivating situation, consider a hospital that, after a lot analysis, has collected a lot of virus DNA sequences which might be labeled as one in all 4 doable strains. The hospital desires to offer native clinics with a service that classifies the DNA sequences taken from their sufferers. Nonetheless, the hospital doesn’t wish to disclose the classification algorithm to the clinics for apparent enterprise causes.

A easy answer would encompass a shopper/server system wherein the native clinics function the shopper, and the hospital is the server. In such an answer, the shopper would ship the DNA sequence to the server. The server would classify the sequence and ship the label again to the shopper. The issue is that each the shopper and the server on this relationship wish to keep away from disclosing affected person data, together with the DNA sequences of the viruses that sufferers have contracted as a result of doing so would require them to adjust to in depth and exhausting laws.

Particularly, we wish the server to have the ability to classify a virus with out understanding what its DNA sequence is. Till just lately, this appeared unimaginable. Right now, this may be carried out through the use of homomorphic encryption (HE) know-how. This encryption know-how is the main focus of the iDASH competitors.

What’s the iDASH competitors?

iDASH is an annual workshop on information privateness in healthcare. As a part of the workshop, the organizers arrange a three-tiered safe genome evaluation competitors that’s open for competing groups from all over the world. Annually the problem is completely different, and groups have three months to plan and implement an answer for the problem.

What was the iDASH problem this yr?

This yr, the second monitor of the competitors challenged contributors to categorise virus DNA sequences as one in all 4 strains. Every competing staff obtained a coaching set consisting of 8,000 DNA sequences with their pressure labels (2,000 from every pressure). The DNA sequences had been supplied as a FASTA file (roughly 30,000 DNA letters for every virus). Every staff educated their very own mannequin utilizing the coaching set.

The options had been evaluated utilizing a brand new set of two,000 DNA sequences to be categorised, which had been unknown forward of the competitors’s deadline. The DNA sequences had been encoded and encrypted utilizing the shopper’s key, with every staff offering software program that simulated the shopper. The DNA sequences had been then categorised (whereas nonetheless encrypted) by one other software program that every staff supplied to simulate the server. The output of this classification was additionally encrypted with the shopper’s keys, and, subsequently, couldn’t be learn by the server. Ultimately, the encrypted classification was decrypted by the software program simulating the shopper to disclose the output.

The foundations of the competitors included the next objects.

  • The server should not study something concerning the DNA sequences that it classifies.
  • The shopper should not study something besides the label that’s categorised by the server (for instance, it can’t be given the mannequin). Particularly, this additionally implies that the shopper should not carry out any sort of characteristic choice as a result of the chosen options reveal one thing concerning the server’s mannequin.
  • The shopper can use only one CPU with 1 GB RAM.
  • The server can use 4 CPUs with 4 GB RAM.

What’s Homomorphic encryption?

Homomorphic encryption (HE) is a brand new encryption know-how that permits encrypted numbers to be added collectively or multiplied. With these two primitive operations, any algorithm may be computed on encrypted numbers, together with the classification of an encrypted DNA sequence.

HE is thought for being notoriously sluggish and reminiscence consuming. That is primarily as a result of it solely helps addition and multiplication operations, which can be utilized to guage any polynomial over encrypted ciphertexts. This computation mannequin is completely different from conventional algorithms that may take a look at the values of variables and make selections based mostly on their values. Theoretically, each algorithm may be expressed as a polynomial. For instance, areas the place the algorithm takes a department in its movement based mostly on a situation C is changed by computing each branches and multiplying the output of 1 department by C and the output of the opposite by (1-C), after which calculating their sum. Right here, we assume that C is both 0 or 1, wherein case one department is multiplied by 1 (that’s, taken as is), and the opposite department is multiplied by 0 (that’s, is nullified). The worth of C determines which department can be taken. This concept extends to instances the place C takes on different values as properly. However, the scale of the polynomial might develop exponentially with the variety of branches. Thus, crucial factor is to revamp the algorithm in order that it has as few branches as doable. An identical effectivity downside arises when we have to evaluate values.

To enhance the working time, HE schemes use the underlying arithmetic to realize a technical benefit that permits packing many values (often a number of thousand) into one ciphertext. A ciphertext then holds not only one message, however an array of messages, the place additions or multiplications are executed in a SIMD (Single Instruction A number of Information) method. This considerably boosts the working time. Nonetheless, packing introduces its personal problem (extra on this later). That stated, this enchancment doesn’t handle the inherent downside of not having the ability to department, as mentioned within the earlier paragraph.

What does our mannequin do?

In a nutshell, in our strategy we encoded DNA sequences as k-mer units. We used the coaching set to discover a consultant for every pressure. For the classification, we computed a similarity rating with every consultant set, after which selected the one with the best rating.

We used the notion of k-mers, that are sequences of okay letters that seem consecutively in a DNA sequence. For instance, for okay=7 there are 47 = 8192 doable 7-mers as a result of every DNA letter has one in all 4 choices. Given a DNA sequence, we encoded it because the set of all k-mers showing in its DNA sequence. A consultant set for a pressure is a set of k-mers which have excessive correlation with the coaching DNA sequences belonging to the pressure. Computing these representatives was carried out offline as a part of the coaching course of.

To categorise a DNA sequence, the shopper computes its k-mer set, encrypts this set, and sends it to the server. The server computes similarity scores that signify how a lot the given DNA sequence is much like every of the pressure representatives. We used a normal similarity rating that measures similarity between units: 1 which means that it’s the identical set, and 0 which means that they don’t have anything in frequent. As said beforehand, as a result of the DNA sequence that must be categorised is encrypted, the ensuing similarity scores are additionally encrypted. As a technical final step, we normalized the similarity scores by dividing every of them by their common.

The encrypted normalized similarity scores had been then returned to the shopper, which decrypted them as outlined within the targets of the competitors.

Challenges and options

Throughout our work on the iDASH competitors, we encountered a number of difficult conditions that we addressed utilizing a wide range of approaches.

Making our mannequin HE-friendly

As talked about beforehand, decreasing the variety of branches that an algorithm makes in HE is crucial. In our case, the naïve algorithm branches when it computes the intersection of two k-mer units (as a part of the computation of the similarity rating). To keep away from all of those branches, we encoded (earlier than encryption) every k-mer set as a 4k-long binary vector. We created a world public map that assigned an index i to every 6-mer. The i-th coordinate within the vector was set to 1 or 0 relying on whether or not the i-th k-mer seems within the set. This encoding is HE-friendly.

Nontrivial encoding

To reap the benefits of the SIMD characteristic of HE, we used a nontrivial encoding wherein a single ciphertext contained 4 k-mers of every of the 2000 DNA sequences to be categorised (the same old encoding would pack all k-mers of a DNA sequence in a single ciphertext). This nontrivial encoding helped us scale back the working time and the reminiscence requirement. The encoding was carried out utilizing the IBM HElayers library, which simply helps such (and related nontrivial) encodings over HE schemes.


The competitors’s reminiscence limitation was so tight that it didn’t enable us to concurrently hold the entire encrypted DNA sequences in reminiscence. To fulfill these limitations, we selected a “pipeline” structure wherein a ciphertext of the enter was learn, processed, and discarded earlier than studying the following ciphertext of the enter.

No division

As talked about beforehand, HE schemes help solely additions and multiplications. They don’t help divisions (or computing the inverse 1/x). To compute and normalize the similarity scores, our algorithm wanted to compute two inverses. We used a normal low-degree polynomial approximation to the inverse operate.

What had been our outcomes?

The outcomes of our system had been:

  • Consumer encryption: 10 seconds utilizing 280 MB of RAM and 1 CPU
  • Classification on the server: 0.6 seconds utilizing 400 MB of RAM and 1 CPU
  • Decryption on the shopper: 1 second

Word that though the competitors allowed the server to make use of 4 CPUs, our answer was so quick on 1 CPU that we didn’t must parallelize it.


The world of HE is evolving and bettering. Classification duties that took days to finish 10 years in the past and took hours then minutes to compute a number of years in the past, now take a second. It is a results of developments within the encryption schemes, within the algorithms, and in {hardware}. Our outcomes present that privateness preserving classification may be carried out in a shopper/server mannequin in actual time.

We imagine HE will change into a standard methodology for offering privacy-preserving options. Our HElayers library makes HE accessible and straightforward to make use of by noncryptographers.

You may obtain HElayers. Our code can be revealed quickly as a part of the demos that include HElayers.


Please enter your comment!
Please enter your name here