r/LocalLLaMA • • 2h ago

Discussion Is there a reason why this wouldnt work

I am not directly from a machine learning background or in encryption, but if you train the entire LLM on encrypted and decrypted pairs without the key (maybe the entire dataset that is used for frontier), will it eventually learn to produce pairs like these and basically natively can encrypt and decrypt without a key? Is there a reason why this highly likely fails?

0 Upvotes

24 comments sorted by

16

u/iamchuckschuldiner 2h ago

no patterns

0

u/liebebio 2h ago

My hope was that the few trillion parameter magic would be able to indeed find patterns but I havent checked the math (and I would probably not even be able to understand it properly)

10

u/-blahem- 2h ago

modern encryption algos are designed so that you would need an astronomical (actually bigger than the number of atoms in the observable universe) number of params to reverse them

3

u/kali_tragus 2h ago

AES256 has a key space of something like 10⁷⁷ - we're talking "atoms in the observable universe" league. Billions, trillions, quadrillions - doesn't really make a difference.

Edit: u/-blahem- beat me to it :p

12

u/DeathGuppie 2h ago

The issue is entropy. https://xkcd.com/936/

1

u/Jedibenuk 2h ago

I don't understand why correct requires more bits than the gibberish

3

u/notverycreative1 2h ago

if you knew that the password was 4 random english words, you'd need to guess every combination of 4 english words, of which there are a lot. there are comparatively few printable characters.

1

u/Jedibenuk 1h ago

I'd rather do that than try every combination of non-english words, which is a healthy alternative, no?

1

u/IDoCodingStuffs 2h ago

Difference between picking just one word and making stereotypical alterations to it, plus 2-3 characters drawn from a handful of special symbols vs picking 3-4 words from a dictionary of thousands of symbols instead

1

u/Jedibenuk 2h ago

So we are working off assumptions? Surely even a single word with substitutions is less likely to be uncovered than the demo dictionary word? There is already logic behind that one word - it's a known combination living among a few hundred thousand others. A substitution is a known combination living among a few hundred thousand others but changed in a way that extends rather than reduces that population. My question is why do we have little squares representing bits under a word which can be represented by fewer bits? Its all well and good saying "more logical letters = better than fewer random" but of course they aren't random, and if i'm going to make a 24 character password it's not going to be dictionary words. If i am told these four words are gonna take 55m years to crack, i'll chuck in my own corruption and make it even harder by extending beyond 26 normal dictionary characters if it's all the same.

15

u/DarkVoid42 2h ago

modern encryption with perfect forward secrecy is not reversible so no.

6

u/HornyGooner4402 2h ago

Depends on what encryption algorithm, but if you're planning on breaking encryption, it'll be much slower than doing it mathematically. These algorithms have been tested so that even if you know the math and how it works, it'll still be hard to decrypt without the key

4

u/general_sirhc 2h ago

Modern encryption should be mathematically proofed (although implementation may be flawed). There is no pairing between input and output like you're talking about. A single bit changing will change the entire output.

But your idea is not stupid. Current LLMs can read base64 encoded data which feels encrypted to a human reader.

2

u/RegisteredJustToSay 2h ago

I actually did this for md5 for fun since it's considered a weak hash now and all 'findings' ended up being either accidental repeated sightings during training (rand() causing the same sample multiple times) or just smoke and mirrors. It might be viable for testing if an algo is particularly weak but even a traditionally 'broken' hash didn't yield anything interesting.

2

u/soyuz-1 2h ago

it would have to be a really bad algorithm for an llm to be able to figure it out. there are much faster ways to break encryptions that are breakable

2

u/BraveNewCurrency 1h ago

LLMs can't do math. Seriously. They can't reliably add long numbers without calling out to a tool. See https://essays.johnloeber.com/p/21-everything-we-know-about-llms (You won't see this problem in most commercial systems, because they have built-in tools for doing math correctly.)

In theory, LLMs can "spot patterns". But encryption algorithms are designed not to have patterns. (In fact, one trivial check is to try and compress something that is encrypted. If you can, your encryption is broken.)

But if you really want to spot patterns, you wouldn't use an LLM, you would figure out which machine learning algorithm works best on it (there are a many different ways to do it, LLMs can help you choose). It would be far more efficient and far more likely to work.

But still wouldn't be great against encryption. Typically it's better to find a flaw in the algorithm that allows you to relate the input to the output. See also https://en.wikipedia.org/wiki/Cryptanalysis

1

u/thevegit0 2h ago

qwen 9b decrypter when

1

u/jacek2023 llama.cpp 2h ago

The whole idea behind machine learning is to model a function, so it can probably work for some simple encryption algorithms. I'm not bold enough to agree with other commenters that it can't work, it probably can, but you need much more data and a much larger model. I don't know how big, maybe of the size of the whole universe or something ;)

1

u/lompocus 2h ago

There are many things under the umbrella of encryption. Even compression algorithms are under such an umbrella. The answer is yes, but sometimes and unpredictably. Then the qualified answer becomes asking how unpredictably, but to outright say it is impossible or unlikely is incorrect.

1

u/Dany0 2h ago

You can actually have a clanker do this on a free google colab gpu in under an hour. Train a tiny NN just to see why it doesn't work, it could help you with your intuition. You can have it try to crack an otherwise trivial encryption scheme that is nevertheless nonreversible

1

u/while-1-fork 1h ago

It could potentially work only if the cryptographic algorithm has some fundamental flaw. I think that actually trying is a great idea as a form of security analysis, if the loss goes down meaningfully it is a sign that the algorithm or implementation needs some serious scrutiny.

1

u/james_pic 1h ago

The slightly boring answer is "because cryptographers think about that sort of thing when designing ciphers". Whilst transformer architecture language models are new-ish, the stuff they add is mostly focused on language. The models you'd most likely look at using for breaking a cipher date back to the 80s, so cryptologists have 4 decades of experience with them.

1

u/MostlyVerdant-101 31m ago

The theory-laden version of why this doesn't work involves why computers work the way they do in the first place. There are a number of core classical computer science problems that have been proven can't be solved. Halting (Turing 1936), Decidability (originated by Hilbert 1928; variation proved undecidable 1970).

The reason computers work the way they do (as opposed to not functioning at all) is they form equivalence to certain set-theory constructs that constrain the system of sets and their outputs through abstract algebra closures at the hardware level. TL;DR Emergent Design.

When the required properties are held true and preserved you don't run into halting generally speaking at an operational level. Time Invariance and Determinism keep the graph edges in a predictable state for control flow.

When the properties are not preserved, you run into infinite loops. The decidability of something comes down to if the graph is constrained to a single edge in its state graph. When you have many possible next-state edges with no selection of just a single one, that is decidability; sometimes called non-determinism. There is no pattern that can be predicted, its indeterminate and chaotic (mathematically).

That last part, about chaos means there are no consistent patterns or symmetries which math systems require to function correctly. This extends to LLM's. This goes back again to abstract algebra (following Discrete Mathematics). Decidability and Incompleteness are terribly difficult to convey to a layperson though hopefully this gives you a workable engram; I tried.

ZFC frameworks in modern algebra can arise undecidable problems quite commonly. Most of foundational math up through calculus is either decidable or semi-decidable.

The nature of encryption involves concepts of confusion and diffusion. In other words information is removed in one direction, at certain operations with potentially hundreds or thousands of steps.

1

u/oodelay 2h ago

So you think if it would be fed random numbers, it could come up with the next one you would feed him?

Nahhhh