1 00:00:00,000 --> 00:00:06,220 Welcome, this is the attacks on GenAI data and using vector encryption to stop them talk. 2 00:00:06,960 --> 00:00:20,320 I'm Patrick Walsh, this is Bob Wall, we're the co-founders of IronCore Labs, where we help people protect data in their cloud applications by making application layer encryption more easy and practical and usable. 3 00:00:21,220 --> 00:00:27,980 So this talk is going to be about the ecosystems around LLMs, but we'll start by talking about LLMs specifically. 4 00:00:28,700 --> 00:00:32,320 And in particular, some limitations of LLMs, right? 5 00:00:32,320 --> 00:00:42,860 When an LLM is trained, it's trained to predict a plausible completion to a prompt, and that means it can sometimes make stuff up that sounds good but isn't necessarily right. 6 00:00:42,860 --> 00:00:50,700 It's also trained on what, by the time it's released, is typically stale data, because it takes a long time to train it, to test it, to fine-tune it, etc. 7 00:00:51,020 --> 00:01:03,160 And then finally, it hopefully hasn't been trained on your data, and therefore, if you want it to do things that are cool across, you know, your corporate data, your personal data, or something like that, it's not going to work. 8 00:01:03,160 --> 00:01:08,080 And to fill those gaps, there's a thing called RAG, or Retrieval Augmented Generation. 9 00:01:08,560 --> 00:01:14,120 Terrible name, basically means stuff extra stuff into the prompt so the LLM can answer questions better. 10 00:01:14,280 --> 00:01:15,900 And it works a lot like this. 11 00:01:15,900 --> 00:01:20,760 You have a chat app, it doesn't have to be a chat app, it's just like the most common thing you use, right? 12 00:01:20,760 --> 00:01:27,000 A user asks a question, and now instead of passing that question to the LLM, the first thing it does is a search. 13 00:01:27,000 --> 00:01:31,760 And that search is to find relevant documents related to the query. 14 00:01:31,980 --> 00:01:35,920 That all gets jammed together into a prompt, which then goes to the LLM. 15 00:01:35,920 --> 00:01:38,060 That's it, that's RAG in a nutshell, you get it. 16 00:01:38,060 --> 00:01:41,840 Here's a kind of more practical example of what that looks like. 17 00:01:41,840 --> 00:01:58,580 There's a system prompt, there's a history of the previous questions and answers from the chat, and then there's the current, the most recent question, and then stuffed in with that is any documents or web pages or whatever it is that might be related to what the question was. 18 00:01:58,580 --> 00:02:01,160 In this case, it's about, hey, what's that draft 10Q? 19 00:02:01,700 --> 00:02:09,140 It's a private document that's not public, and that's how it all gets in to the LLM so it can answer questions on that private data. 20 00:02:09,280 --> 00:02:15,860 It's fundamental to basically how everyone is using this stuff today, if you're using chat inside an app. 21 00:02:16,300 --> 00:02:22,720 And to make all this work, you need to have some type of more intelligent search than what we typically do. 22 00:02:22,940 --> 00:02:28,700 Call it AI search, call it semantic search or whatever you want to, and there's a bunch of ways to do this. 23 00:02:28,700 --> 00:02:31,880 The most popular right now is an approach called vector search. 24 00:02:31,880 --> 00:02:35,960 It's kind of what everyone is doing, although it's not the only way to do it. 25 00:02:36,140 --> 00:02:54,700 And vector search and actually all of those AI search type techniques are important because they differentiate between different meanings of words, they can understand a sentence in context, they can understand when arm means a division of an organization versus when arm is a body part or even a verb, 26 00:02:54,700 --> 00:02:55,460 right? 27 00:02:55,660 --> 00:03:02,700 And in practice, how these types of vector search works is you start with some input document. 28 00:03:02,900 --> 00:03:04,820 And that input, did we lose it? 29 00:03:04,820 --> 00:03:07,880 And that input document then gets chunked up into pieces. 30 00:03:07,880 --> 00:03:14,600 Sometimes it's by sentence, sometimes it's sets of, call it 30 words, or it can be any strategy and often overlapping. 31 00:03:14,660 --> 00:03:25,540 But each of those pieces gets run through something that's very similar to an LLM, that sucks, that's very similar to an LLM, but is in fact called a text embedding model. 32 00:03:25,540 --> 00:03:31,440 And a text embedding model, unlike an LLM, produces something called a vector embedding. 33 00:03:31,540 --> 00:03:33,120 That's not great. 34 00:03:35,920 --> 00:03:38,520 Produces something called a vector embedding. 35 00:03:38,520 --> 00:03:43,300 And the vector embedding is basically just a long list of very small numbers. 36 00:03:43,680 --> 00:03:47,060 And those small numbers can be hundreds or thousands in length. 37 00:03:47,440 --> 00:03:54,920 And we'll get into what they mean in a minute here, but to give you some intuition on these, we'll take a look at a list, like a vector that's only three long, right? 38 00:03:54,920 --> 00:03:57,960 Because you can graph this in 3D space and you can understand it better. 39 00:03:58,060 --> 00:04:09,840 And if we have a bunch of different vectors, let's say we have A and B and we have C, we can kind of look at this visually and say, oh look, A and B kind of look like they're close together and A and C look like they're far apart. 40 00:04:09,840 --> 00:04:23,920 In fact, if we run a distance comparison operation like this one, Euclidean distance, although there's a bunch of different ones, they all have the same kind of effect, you can see that A and B are 2.2 apart, whereas A and C are 5.6 apart. 41 00:04:24,360 --> 00:04:27,800 And the way this works with search is we take a query, right? 42 00:04:27,800 --> 00:04:30,860 It's a sentence, and we reduce it to, let's say, A. 43 00:04:30,980 --> 00:04:42,020 A is a vector representation of what we queried, and then we search across all our vectors and we say, give me anything that's similar to A, and then hopefully, if it does it right, it returns B but not C. 44 00:04:42,320 --> 00:04:45,680 That's it, that's what vector search is doing, it's the whole shebang. 45 00:04:46,000 --> 00:04:48,640 The vector represents the meaning of the content. 46 00:04:49,180 --> 00:04:58,680 And to make that work, we have this kind of new concept, or at least new to a lot of us, at least to me, although I guess it's been around for quite a while, and that's called a vector database. 47 00:04:59,200 --> 00:05:07,720 And a vector database's purpose is to be able to do these nearest neighbor or approximate nearest neighbor searches across large amounts of data very quickly. 48 00:05:08,700 --> 00:05:11,020 And there are a lot of these companies now that are doing this. 49 00:05:11,020 --> 00:05:19,620 In fact, last year we saw hundreds of millions of VC money go into the startups that are building vector databases, startups like Pinecone and Weaviate and Quadrant. 50 00:05:19,880 --> 00:05:32,120 And despite that, the idea of a vector database is already eroding away to nothing because classic databases like Mongo and Postgres and Oracle are all adding vector capabilities to their existing databases. 51 00:05:32,120 --> 00:05:38,600 So you're getting these type of vector comparison nearest neighbor search capability pretty much everywhere that you have a database now. 52 00:05:39,140 --> 00:05:40,920 Okay, changing tracks for a second. 53 00:05:41,340 --> 00:05:44,260 We started thinking to ourselves, who's using this stuff? 54 00:05:44,680 --> 00:05:53,700 Well, we looked at the top 10 SaaS companies and we thought, how many of them are doing adding LLM capabilities over private data? 55 00:05:53,700 --> 00:05:56,080 Which means that they're almost certainly using RAG. 56 00:05:56,080 --> 00:05:57,500 The answer is 100%. 57 00:05:57,500 --> 00:05:59,680 Then we said, well, what about security companies? 58 00:05:59,680 --> 00:06:04,480 They wouldn't jump on to just using all this new technology that we don't know how to secure yet, would they? 59 00:06:04,480 --> 00:06:06,100 No, 100% of them too. 60 00:06:06,520 --> 00:06:09,620 Also adding LLM capabilities on top of private data. 61 00:06:10,800 --> 00:06:12,780 Think about that for a moment , right? 62 00:06:12,780 --> 00:06:18,720 It means that these AI systems, whatever cloud services and things you're using, they are hoovering up this data. 63 00:06:19,040 --> 00:06:27,020 Probably copies of it are going into the vector databases as vectors and among other places, which I'll talk about ever so briefly later. 64 00:06:27,520 --> 00:06:30,200 So, do these vectors matter? 65 00:06:30,560 --> 00:06:42,080 I was talking to the CEO of one of the vector database companies who's raised tens of million dollars last year and he told me that a vector was like a hash and it was basically meaningless, except for comparison purposes. 66 00:06:42,480 --> 00:06:46,260 So, which my first thought is, well, you clearly don't know how people abuse hashes. 67 00:06:46,260 --> 00:06:49,960 And my second thought is, you're wrong. 68 00:06:50,060 --> 00:06:52,240 So, that isn't how it works at all. 69 00:06:52,240 --> 00:07:02,360 If you look at taking a phrase and you reduce it to an embedding vector, an embedding model into a vector, okay, it looks pretty meaningless to us. 70 00:07:02,360 --> 00:07:08,020 But then again, so does an animated GIF like this cat if you look at it in a text editor, right? 71 00:07:08,020 --> 00:07:15,200 Just because it's meaningless to us to look at, doesn't mean it's meaningless to a computer or in this case, to an AI model. 72 00:07:15,200 --> 00:07:23,920 And so, the way you go back from a vector to the original text or something approximating it is using something called an inversion model. 73 00:07:23,920 --> 00:07:29,580 An inversion model is just a model that's trained on vectors to sentences so that it can make that same prediction. 74 00:07:29,960 --> 00:07:32,260 In this case, it comes close. 75 00:07:32,260 --> 00:07:35,520 It's our income is down instead of our earnings is down, right, in this example. 76 00:07:35,800 --> 00:07:40,240 100% match on meaning, not 100% match on words. 77 00:07:40,500 --> 00:07:43,800 There are some tens of thousands of papers on this at this point. 78 00:07:43,800 --> 00:07:49,380 It's heavily studied in academia, not widely known, I don't think, broadly. 79 00:07:49,940 --> 00:07:58,940 Best paper we've seen for text inversions, and it's not just text that vectors represent, I'll talk about that in a second, recovers 92% of exact words. 80 00:07:58,940 --> 00:08:05,840 That means full names, everything coming right back out exactly as it went in on the text, okay? 81 00:08:05,840 --> 00:08:09,060 The other 8% is basically effectively the same anyway. 82 00:08:09,760 --> 00:08:12,040 So are these attacks hard? 83 00:08:12,660 --> 00:08:15,500 What's the skill level for doing this kind of attack? 84 00:08:16,020 --> 00:08:28,280 The answer is most of these papers have accompanying open source software on GitHub, and so really you just need someone who can run the software, not someone who knows how to build the software, which means it's script kiddy level. 85 00:08:28,640 --> 00:08:31,600 And on that note, we actually ran some of these attacks ourselves. 86 00:08:31,600 --> 00:08:33,580 We posted some blogs you can check out. 87 00:08:33,580 --> 00:08:42,840 We did one on, so I mentioned vectors can represent different things, they can represent images for image search, they can represent faces or voice prints or other things for that. 88 00:08:42,880 --> 00:08:44,680 We did one against facial recognition. 89 00:08:44,680 --> 00:08:51,480 That doesn't use an inversion model, that's a different technique by the way, so it's kind of interesting for that purpose, and we did one on text inversions. 90 00:08:52,040 --> 00:09:00,000 Really good results, like you can really get all the stuff back out or very near approximations of the inputs. 91 00:09:01,140 --> 00:09:04,540 All right, so let's talk about these new vector database companies. 92 00:09:04,920 --> 00:09:07,280 They probably have good security, right? 93 00:09:07,740 --> 00:09:10,000 Actually no, super immature. 94 00:09:10,220 --> 00:09:24,040 They'll fix it over time, it'll be fine, but if you look closely at these as we have, two of them have no authentication required by default, right, making the mistakes of Elasticsearch and MongoDB of years past but not learning. 95 00:09:25,060 --> 00:09:41,280 One of them has services that are meant to be internal services and that, you know, there's no protection or authentication on them, so that if someone goes to access that because the firewall neglected to block a port, direct access back to the data without any authentication. 96 00:09:41,860 --> 00:09:47,740 Two of them claim to have end-to-end encryption when they only have TLS in transport, and more. 97 00:09:47,740 --> 00:09:49,140 I could go on, it doesn't matter. 98 00:09:49,600 --> 00:09:57,440 The point is that these vector database systems, and for that matter the chat apps, either way, are like total treasure troves of information. 99 00:09:57,760 --> 00:10:05,420 And even if you don't use it and invert it, they're at least treasure maps of information because they point back to the data and you can query it. 100 00:10:05,420 --> 00:10:19,100 And if you think about that for a second, imagine that you're in a CTF competition in that corner of this thing, and you know, you get into a machine, cool, but now you have to get the flag, and it's in a database, you have to get into the database, and now you have to reverse the schema and, 101 00:10:19,100 --> 00:10:21,400 you know, figure out a query and find the flag. 102 00:10:21,940 --> 00:10:23,480 It ain't as easy as it sounds, right? 103 00:10:23,480 --> 00:10:28,920 It's a lot of expertise and time to do that versus, you know, give me that data. 104 00:10:29,360 --> 00:10:37,520 It is, like, incredibly far, far easier to attack these systems because you can do it in natural language. 105 00:10:38,920 --> 00:10:42,620 So, what do we think about bringing AI into our infrastructure? 106 00:10:42,620 --> 00:10:46,420 Maybe we should pause for a moment and think a little bit about it. 107 00:10:46,420 --> 00:10:50,520 Or if it's in there, maybe if you're a hacker in the audience, you should think about, holy shit, there's a lot here. 108 00:10:50,520 --> 00:10:52,000 Let me give you some ideas. 109 00:10:53,440 --> 00:10:55,600 Obviously, everyone knows about prompt injections. 110 00:10:55,780 --> 00:11:04,180 Maybe you haven't thought so much about the fact that you can put a prompt injection in the documents being searched, and they get pulled into the prompt, and you can poison the prompt that way. 111 00:11:05,540 --> 00:11:06,920 Logs are everywhere. 112 00:11:06,920 --> 00:11:11,160 If you're putting private data into the things that go to the LLMs and the LLMs log it, that's a problem. 113 00:11:11,160 --> 00:11:16,100 But also, the prompt firewalls, if you're using those, are logging that stuff, too. 114 00:11:16,100 --> 00:11:17,820 So, the data's kind of exploding. 115 00:11:18,100 --> 00:11:19,920 And don't even get me started on agents. 116 00:11:20,320 --> 00:11:22,460 Talk to me after if you want to hear about my thoughts on that. 117 00:11:22,460 --> 00:11:28,040 But if you're generating code to run to query a database, you're beyond hope. 118 00:11:29,160 --> 00:11:30,840 Today, though, we're not going to talk about any of that. 119 00:11:30,840 --> 00:11:34,760 We're going to talk specifically about this vector stuff and how to protect it. 120 00:11:34,900 --> 00:11:37,540 So, basically, today, the way to protect that is to encrypt it. 121 00:11:37,760 --> 00:11:40,960 And there's two approaches to this, at least in academia, that you could do. 122 00:11:40,960 --> 00:11:44,300 One is fully homomorphic encryption, and the other is partially homomorphic. 123 00:11:44,300 --> 00:11:50,100 So, fully homomorphic encryption, there's actually quite a few papers on this, and they're fairly interesting. 124 00:11:50,100 --> 00:11:51,500 There's a lot of different approaches. 125 00:11:51,500 --> 00:11:54,780 Some of them require sending all the vectors to the server. 126 00:11:54,780 --> 00:11:56,380 Some require some other stuff. 127 00:11:56,480 --> 00:11:58,560 They typically suffer from being slow. 128 00:11:58,640 --> 00:12:06,120 And you would have to build your own vector database and be another logo on that wall and compete with all the other vector databases on every other thing. 129 00:12:06,500 --> 00:12:09,380 The other option is partially homomorphic encryption. 130 00:12:09,380 --> 00:12:16,760 And the idea here is that something that's partially homomorphic is able to do some operations, but not arbitrary operations. 131 00:12:16,760 --> 00:12:24,000 And in this case, we're talking about optimizing for that nearest neighbor search type of operation. 132 00:12:24,000 --> 00:12:29,860 So, in this example, partially homomorphic, specific to nearest neighbor searches. 133 00:12:30,160 --> 00:12:35,790 And to talk more about this paper and the work that we've done around it, I'm going to turn it over to Bob. 134 00:12:39,810 --> 00:12:40,810 All right. 135 00:12:41,370 --> 00:12:46,990 We found this paper about a way to encrypt vectors. 136 00:12:47,090 --> 00:12:52,370 And you can see the title, Approximate Distance Comparison Preserving Symmetric Encryption. 137 00:12:52,370 --> 00:12:53,910 So, that's a mouthful. 138 00:12:54,390 --> 00:13:07,750 But this algorithm is a type of property-preserving encryption, which means it's kind of like order-preserving encryption or maybe deterministic encryption, if you've heard of those. 139 00:13:07,750 --> 00:13:15,310 The property that this algorithm is preserving, though, is distance comparison instead of equality or order. 140 00:13:15,310 --> 00:13:29,090 And so, if you can preserve the ability to compare the distance between two vectors after they've been encrypted, that means your vector database continues to work on the encrypted vectors just as well as it did on the original vectors. 141 00:13:29,090 --> 00:13:35,950 So, like deterministic and order-preserving encryption, there's a trade-off. 142 00:13:35,950 --> 00:13:42,210 The more secure you make it, the less well the property is preserved. 143 00:13:42,210 --> 00:13:45,570 And so, the less well queries might work on the data. 144 00:13:45,570 --> 00:13:58,750 So, you have a decision to make about whether you want a lot of security and you can tolerate maybe a little less accuracy on queries, or you want a lot of accuracy on the queries and maybe you'll have a little bit less protection of the data. 145 00:13:59,210 --> 00:14:10,310 But the system works by, if you've got a system that's ingesting data and it's making these vectors , putting them into a vector database, it's easy to add this encryption. 146 00:14:10,630 --> 00:14:28,630 You just, in the system that's already there, after you've taken the data and run it through the embedding model and generated the vector embedding, you run it through this algorithm and encrypt it, it's still a vector, it looks similar enough to the original vector that the vector database is going to take it and be happy with it. 147 00:14:29,290 --> 00:14:34,350 So, you use a secret key, you encrypt the vector, you throw it in the vector database. 148 00:14:34,350 --> 00:14:38,690 So, very simple change to the system to be able to do that. 149 00:14:38,690 --> 00:14:48,850 Now, most of these vector database systems support storing metadata along with the vectors, and that metadata might have some sensitive data in it too. 150 00:14:48,850 --> 00:14:51,470 So, you might want to consider encrypting that. 151 00:14:51,470 --> 00:14:52,490 That's a whole different thing. 152 00:14:52,490 --> 00:14:55,290 We're just going to focus on the vectors for right now. 153 00:14:55,610 --> 00:15:01,130 So, once you've got all of these vectors encrypted, you've loaded them into your vector database. 154 00:15:01,130 --> 00:15:04,530 When it's time to do a query, it's also pretty simple. 155 00:15:04,630 --> 00:15:10,090 Again, the normal process would be to take the query, run it through the embedding model, get a vector. 156 00:15:10,270 --> 00:15:16,390 So, then you just encrypt that vector with the same key and the same algorithm, and then you do your normal search. 157 00:15:16,390 --> 00:15:33,470 And because the algorithm, the encryption, preserves distance comparison, that means that when you give that encrypted query to the vector database, it's going to return the encrypted vectors that are closest to the encrypted query, and those are going to correspond to the decrypted vectors, 158 00:15:33,470 --> 00:15:36,970 the original vectors, that are closest to the original query. 159 00:15:36,970 --> 00:15:40,830 So, you get the same results out, pretty much. 160 00:15:41,750 --> 00:15:51,710 And once you get them out, you can maybe decrypt the vectors if you need to, or maybe you've got some metadata that lets you look up the associated data in a database or something else. 161 00:15:52,610 --> 00:15:58,170 So, without the key, an attacker can't really understand the queries. 162 00:15:58,170 --> 00:16:03,430 They are enough different that they can't look at that and kind of know what the query was. 163 00:16:03,430 --> 00:16:11,390 They can't invert the data that's in the database, even if they hacked it, exfiltrated all the data, they can't easily invert it. 164 00:16:11,990 --> 00:16:14,750 The results are still fairly accurate. 165 00:16:14,750 --> 00:16:18,950 Again, that's a trade-off between the security and the accuracy of their searches. 166 00:16:19,530 --> 00:16:26,130 The whole thing is, it introduces a negligible penalty in terms of performance. 167 00:16:26,430 --> 00:16:33,070 The encryption process is fast, so you can add this in and not add a lot of time to your process. 168 00:16:34,150 --> 00:16:37,650 So, I'm going to talk a little bit more about this encryption function. 169 00:16:38,050 --> 00:16:55,750 So, it's a function that maps inputs to outputs, and it does it such that for any distance function, the margin of error that you get when you compare two encrypted vectors will be within some factor, we'll call that beta, the approximation factor of the original distance. 170 00:16:55,750 --> 00:17:07,370 And so, if you can build a function that preserves that for any pair of vectors that you give as an input, then you have distance comparison preserving encryption functions. 171 00:17:07,370 --> 00:17:18,390 So, in real systems, we kind of talked about this, the comparison function is used for nearest neighbor and approximate nearest neighbor searches, which is what all these vector databases are doing. 172 00:17:18,390 --> 00:17:28,170 So, you know, if we can build, and we can, we've built this function that preserves distance comparison, so we can use it to encrypt these vectors. 173 00:17:28,530 --> 00:17:32,250 So, the paper introduced this scale and perturb algorithm. 174 00:17:32,670 --> 00:17:38,670 And I won't go into a lot of details about how it works, but I will give you a few key points about it. 175 00:17:39,590 --> 00:17:48,670 So, there's a scale factor, when you, when you set up the algorithm, you randomly choose this scale factor, and you choose a random key. 176 00:17:49,130 --> 00:17:50,230 And so, 177 00:17:53,640 --> 00:18:08,560 there's also when you go to encrypt an individual vector, you generate an initialization vector, an IV value, just the same as you might if you're doing symmetric encryption on data with, you know, a normal symmetric algorithm. 178 00:18:08,840 --> 00:18:17,280 And you perturb each element of the vector using that key in that initialization vector randomly. 179 00:18:17,700 --> 00:18:21,680 So, every element in the vector is going to get wiggled around a little bit. 180 00:18:21,680 --> 00:18:27,360 And that amount that it gets wiggled around depends on that value beta, that approximation value. 181 00:18:27,360 --> 00:18:33,060 And that's how it limits the change in the distance that you can get. 182 00:18:34,420 --> 00:18:40,000 So, the paper had this idea of perturbing the vectors as well. 183 00:18:40,000 --> 00:18:42,260 And they basically had this idea of shuffling. 184 00:18:42,260 --> 00:18:47,520 If you had all of the vectors, you would shuffle the order of them before you encrypted them. 185 00:18:47,640 --> 00:18:54,260 And we wanted an online algorithm so that you could, you know, you just encrypted the vectors as you saw them. 186 00:18:54,260 --> 00:18:57,440 So, we didn't find that shuffling to be beneficial. 187 00:18:57,440 --> 00:19:03,320 But we did add a shuffle where we took the elements of the vector and shuffled them up. 188 00:19:03,320 --> 00:19:05,300 So, we randomly changed the order. 189 00:19:05,300 --> 00:19:08,200 And it's a deterministic shuffling based on the key. 190 00:19:08,300 --> 00:19:12,380 So, when you get done, all of the elements in the vector have been scaled. 191 00:19:12,840 --> 00:19:15,980 And then they get shifted around, which makes it even harder. 192 00:19:15,980 --> 00:19:29,360 Even if you knew what the algorithm, what the embedding model was, all of the elements of the vector are in different places, which makes it a lot harder to look at it and try to even guess how it corresponds to the original vectors. 193 00:19:31,560 --> 00:19:36,740 So, to give a little bit of a more intuition about this, you can think about these vectors. 194 00:19:36,740 --> 00:19:40,540 I mean, a vector is a line from the origin to some point. 195 00:19:40,540 --> 00:19:44,720 And the point is defined by the elements in the vector, right? 196 00:19:44,720 --> 00:19:46,580 Those are the coordinates of that point. 197 00:19:46,580 --> 00:19:55,580 And so, the beta basically defines a sphere in n-dimensional space around that point. 198 00:19:55,720 --> 00:20:02,240 And so, as we perturb the elements of the vector, the resulting point is somewhere within that sphere. 199 00:20:02,240 --> 00:20:07,020 And the size of that sphere is governed by that beta value, the approximation factor. 200 00:20:07,020 --> 00:20:18,900 So, you can see that if you bound the amount that you can move the point around, and you've bound the amount that you've moved another point around, the distance between those is bounded too. 201 00:20:18,900 --> 00:20:22,700 So, that's how it manages to preserve the distance comparison. 202 00:20:23,720 --> 00:20:31,180 So, in addition, we talked about, we also scaled the vectors up so that they're, you know, they get moved around a little bit, they get scaled. 203 00:20:31,180 --> 00:20:34,100 So, if you just look at them, and then the elements get shuffled. 204 00:20:34,100 --> 00:20:41,540 So, it's very difficult to correlate an encrypted vector and the original vector that was encrypted. 205 00:20:42,920 --> 00:20:50,500 Again, because we've preserved that distance comparison, they're still relatively close together with each other. 206 00:20:51,240 --> 00:21:02,100 Here's an example, we kind of turned off the shuffle part of it, so it wouldn't be quite as difficult to see, but you can see, you know, we scaled it up, and then we perturb everything. 207 00:21:02,100 --> 00:21:12,280 So, sometimes, depending on how much we perturb stuff, signs on elements might change, you know, they bounce around a little bit, but they're still in this vector. 208 00:21:12,680 --> 00:21:16,800 So, we've implemented this algorithm. 209 00:21:16,800 --> 00:21:21,120 We've got an open source library we call IronCoreAlloy that's out there on GitHub. 210 00:21:21,720 --> 00:21:24,060 It's under the AGPL license. 211 00:21:24,320 --> 00:21:28,780 So, if you can use GPL software, you can go grab it and use it. 212 00:21:28,780 --> 00:21:33,780 If you can't use GPL software, you can talk to us about a different arrangement. 213 00:21:35,640 --> 00:21:41,640 Along with the library, we've got some sample code that shows how you can use it with a number of different vector databases. 214 00:21:41,740 --> 00:21:43,940 And as I said earlier, it's easy. 215 00:21:44,100 --> 00:21:46,600 So, the examples aren't super complicated. 216 00:21:46,600 --> 00:21:51,320 It's pretty easy to drop this into some code that's going to put data in one of these vector databases. 217 00:21:51,880 --> 00:21:56,980 The library is written in Rust, but we've exposed it in Java, Kotlin, and Python. 218 00:21:56,980 --> 00:21:59,700 We've got some more language support on the way. 219 00:22:00,900 --> 00:22:13,900 Along with the examples, we've got some results of using this on some output of different LLMs, open source LLMs. 220 00:22:13,900 --> 00:22:23,120 And you can see for an approximation factor of one and a half, which is a pretty modest one, we don't impact the search performance. 221 00:22:23,120 --> 00:22:27,660 We measured precision and recall loss, which are pretty common measures of search accuracy. 222 00:22:27,660 --> 00:22:30,640 It didn't really impact the search accuracy much at all. 223 00:22:30,640 --> 00:22:32,980 So, you know, it works. 224 00:22:35,800 --> 00:22:41,620 So now, once we've encrypted these vectors, suppose we want to run an attack on them. 225 00:22:41,620 --> 00:22:45,140 We're going to run one of the inversion models that Patrick was talking about. 226 00:22:46,080 --> 00:22:51,720 So, we know exactly, somehow we know exactly what the embedding model was that was used. 227 00:22:51,720 --> 00:22:59,420 It was an open source one, so we don't have to... we train this up once, and it's going to work on every embedding that was generated by that embedding model. 228 00:22:59,640 --> 00:23:02,220 But we're going to try to run it on the encrypted vectors. 229 00:23:02,220 --> 00:23:15,880 It turns out, because we've done the perturbation, and we shifted around all of the elements, it's mostly gibberish that we get out. 230 00:23:15,960 --> 00:23:20,620 So, you really can't tell much about them. 231 00:23:21,760 --> 00:23:39,160 Even if somebody knows the plain text, and they have a black box access to the model, and they're going to submit vectors, get encrypted vectors out for a particular key, and they're going to train their own inversion model, the randomization makes that so that it's very difficult, 232 00:23:39,160 --> 00:23:41,820 and you get a lot less valuable results. 233 00:23:41,820 --> 00:23:43,760 You might get a little bit of the meaning. 234 00:23:43,760 --> 00:23:45,700 You're not going to get exact words. 235 00:23:47,540 --> 00:23:55,500 And if you... and again, it depends on what value you use for that approximation model. 236 00:23:56,020 --> 00:24:01,040 If you knew the plain text, and you knew the ciphertext, can you extract the key? 237 00:24:01,040 --> 00:24:02,020 No. 238 00:24:02,140 --> 00:24:09,460 It's based on a probabilistic random function that's essentially like a 256-bit keyed hash. 239 00:24:09,460 --> 00:24:17,120 And I don't know about you, but I don't want to spend my next two billion weekends trying to brute force attack a 256-bit keyed hash. 240 00:24:17,360 --> 00:24:21,700 So, I'm going to turn it over to Patrick, and he'll summarize for you. 241 00:24:25,060 --> 00:24:42,960 Okay, so the takeaways that we hope you have here, as we just did a real brief fast run through on what this is and how it works, is first and foremost, you should walk away realizing that RAG produces a lot of copies of data. 242 00:24:42,960 --> 00:24:56,600 So, if people are using AI and LLMs in their applications, and somehow that they're operating over data that model wasn't trained on, probably they're doing this and probably lots of copies of that data are being made. 243 00:24:56,600 --> 00:24:58,180 It's sprinkled everywhere. 244 00:24:58,180 --> 00:25:02,220 And vector databases are like a key part of that. 245 00:25:02,380 --> 00:25:12,220 Second thing is that vectors and vector databases can be inverted back to their original input or something very closely approximating it, right? 246 00:25:12,880 --> 00:25:18,000 High fidelity and low effort attack, and oftentimes an attacker won't even need to do that. 247 00:25:18,000 --> 00:25:20,900 If they have access to the chat app, they can bypass that even. 248 00:25:20,900 --> 00:25:26,540 But never mind, if they have access to the vector database, that's as good as having access to the chat app, right? 249 00:25:26,940 --> 00:25:30,940 And then the third takeaway that we want you to walk away with is this. 250 00:25:30,940 --> 00:25:39,780 It isn't that hard in this case, because there's a built open source library to implement a solution to this problem in your software. 251 00:25:39,780 --> 00:25:45,040 So, if you want to, feel free, check out the results, go try it online. 252 00:25:45,900 --> 00:25:50,880 The results you get in a vector search are really close to the original. 253 00:25:50,880 --> 00:25:53,780 Like, it looks the same to me pretty much across the board. 254 00:25:53,780 --> 00:25:56,040 The benchmarks show a few percent differences. 255 00:25:56,040 --> 00:25:58,000 There's almost no performance penalty. 256 00:25:58,060 --> 00:26:04,920 From a latency perspective, there's almost no reason not to encrypt your vectors if they contain sensitive data in them. 257 00:26:05,580 --> 00:26:06,620 And that's it. 258 00:26:06,720 --> 00:26:07,880 Thanks for your time today. 259 00:26:07,880 --> 00:26:13,720 We're going to be out there, probably just outside the Creator Stage area, if people want to chat with us or have any questions. 260 00:26:13,840 --> 00:26:14,720 Thanks for your time.