Attention-Augmented LSTMs for Automatic Homophonic Ciphertext Decipherment
This paper demonstrates that an attention-augmented LSTM model, trained solely on aligned ciphertext-plaintext pairs without external linguistic resources, can achieve near-perfect automatic decipherment of historically motivated homophonic substitution ciphers by learning shared code pools across varying languages, time periods, and noise levels.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
The Big Idea: Cracking a Secret Code with a "Super-Reader"
Imagine you are trying to read a secret diary from the 1700s. But there's a catch: the writer didn't just swap the letter "A" for the number "1." Instead, they had a huge bag of numbers (a "pool") and could pick any number from that bag to represent an "A." Sometimes they used "1," sometimes "42," and sometimes "999."
This is called a Homophonic Cipher. It's a clever trick designed to confuse code-breakers because the usual trick of counting how often a letter appears (frequency analysis) doesn't work. If "A" can be 1, 42, or 999, you can't tell which one is "A" just by looking at the numbers.
This paper asks a simple question: Can a modern computer program (specifically an AI called an LSTM with "attention") learn to crack these codes automatically, even without a human telling it the rules?
The Setup: A Shared "Bag of Tricks"
The researchers didn't just test one secret code. They created a scenario that mimics real history:
- The Shared Pool: Imagine a giant library of all possible secret numbers (the "key space").
- The Individual Keys: Different writers (or different letters) only use a subset of that library. One writer might use numbers 1–100 for "A," while another uses 50–150.
- The Rule: Crucially, within any single document, if the number "42" appears, it always means the same letter (e.g., "A"). It never changes to mean "B" in the same document.
The researchers trained their AI on thousands of these fake secret messages generated from historical English and Swedish texts (from 1500 to 1899). They gave the AI the secret code and the real message, but no dictionaries, no grammar rules, and no human hints. The AI had to figure out the pattern on its own.
The "Attention" Superpower
The AI they used is an LSTM (a type of neural network good at reading sequences) with a special add-on called Attention.
- The Analogy: Think of reading a long, confusing sentence where a word is missing. You might look back at the beginning of the sentence or forward to the end to guess what the missing word is.
- The AI's Job: The "Attention" mechanism lets the AI look at the whole secret message at once. If it sees a weird number, it can look at the surrounding numbers to figure out, "Ah, in this specific context, this number must be an 'E' because it's surrounded by numbers that usually make 'THE'."
The Results: Almost Perfect
The researchers tested the AI under very difficult conditions:
- Short Messages: Only 50 characters long (very little context).
- Old Languages: Texts from 500 years ago with old spelling.
- Messy Data: Simulated "typos" (like a human transcribing a handwritten note and accidentally writing the wrong number).
- Variable Lengths: Some codes were 3 digits, others were 4 digits.
The Outcome:
The AI was incredibly successful.
- Accuracy: It got the decryption right almost 100% of the time for clean messages.
- Noise: Even when the messages had "typos" or mixed code lengths, it still got it right over 99% of the time.
- Time Travel: It worked just as well on 1500s text as it did on 1800s text. It didn't need to be retrained for different centuries.
The "Magic Trick": Knowing When It Doesn't Know
One of the most interesting findings was what happened when the researchers gave the AI a secret message that did not use the same "bag of numbers" (the shared pool) it was trained on.
- The Result: The AI failed immediately and predictably. It didn't guess randomly; it just couldn't solve it.
- Why this matters: This proves the AI didn't just memorize the specific messages it studied. It actually learned the structure of the shared code pool.
- The Analogy: It's like a person who learns to recognize a specific brand of car engine. If you show them that engine, they can fix it. If you show them a completely different brand, they say, "I don't know this engine," rather than trying to force a wrench into the wrong place. This makes the AI a useful tool for historians to check: "Does this new, mysterious letter use the same secret code as the ones we already know?"
The "Glitch" in the System
When the AI did make a mistake, it wasn't usually because it mixed up letters (like thinking "A" was "B").
- The Real Issue: The mistakes usually happened because the AI got confused by the "typos" (transcription errors). It would correctly identify the secret code but get confused about where the typo was.
- The Takeaway: The underlying logic of the code was still intact; the AI just stumbled over the messy handwriting simulation.
Summary
This paper shows that a specific type of AI can learn to crack complex, historical secret codes without needing a human to teach it the rules of English or Swedish.
- It works on short, long, old, and messy texts.
- It learns the "shared rules" of the code so well that it can tell you if a new message follows those same rules.
- It acts as a powerful assistant for historians, helping them verify if a mysterious document belongs to a known group of secret letters, even if the handwriting is messy or the text is very short.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.