A QLoRA fine-tune of Qwen/Qwen2.5-7B-Instruct for classical cipher computation and detection in three languages.
What it does
Given a cipher task in natural language, the model outputs a structured JSON object containing the cryptographic result and a step-by-step reasoning trace.
Supported ciphers: Caesar · Vigenere · Transposition (columnar) Supported languages: English · Slovak · Ukrainian Supported tasks:
compute — encrypt or decrypt a given text using a known cipher and key
detect — identify the cipher type and key from ciphertext alone, then decrypt
Example
Input:
TASK: COMPUTE
Mode: ENCRYPT
Language: en
Cipher: Vigenere
Key: SECRET
INPUT_TEXT:
ATTACK AT DAWN
This release is V1 — the best performing checkpoint across four training runs.
Three follow-up experiments (V2–V4) attempted to improve on specific weaknesses
but all degraded overall performance. The results are documented below.
V2 — focused fine-tune ❌
Goal: improve Transposition (32% → 50%+) and Ukrainian (48% → 60%+) Changes: Transposition 40%, UK 40%, detect 50% in dataset; resumed from V1; lr=5e-5, 3 epochs
Result: Valid JSON collapsed from 96% to 63.7%. Catastrophic forgetting — the model
lost structured output at lr=5e-5, which was too small to restore but large enough to overwrite.
V3 — recovery attempt ❌
Goal: restore Valid JSON while keeping improved Transposition Changes: lr=1e-4, 2 epochs, dataset with Vigenere 35% and 15% JSON-reinforce short examples; resumed from V2
Result: Valid JSON only partially recovered (68.7%). Transposition reached its best result
across all runs (48.0%, +15.7% over V1), but the JSON format degradation from V2 proved
irreversible through fine-tuning alone.
V4 — fresh start on V3 dataset ❌
Goal: combine V1 training strategy (from scratch, lr=2e-4) with V3 dataset Changes: from scratch, lr=2e-4, 3 epochs, V3 dataset
Result: Valid JSON stayed at 68.3% despite training from scratch. The V3 dataset's
distribution (JSON-reinforce 15%, skewed weights) was suboptimal for lr=2e-4 — the model
overfitted to Transposition at the expense of Caesar and Vigenere.
Summary
Metric
V1 ✅
V2
V3
V4
Valid JSON
96.0%
63.7%
68.7%
68.3%
Algo correct
54.3%
45.3%
53.7%
46.3%
Transposition
32.3%
25.5%
48.0%
43.0%
Vigenere
70.7%
45.5%
53.0%
46.0%
Key finding: once Valid JSON degrades, it cannot be recovered through further fine-tuning
without returning to the original V1 conditions (from scratch + V1 dataset).
Transposition accuracy is genuinely improved by extended grid-trace reasoning in the dataset,
but this benefit comes at a cost to other ciphers when the dataset distribution is skewed.