PRA-MEN 498M · neural decompiler for Windows and MS-DOS

Pramen (Czech for source, spring) turns the assembly of a single function back into C. It targets the toolchains of the Windows / DOS world rather than Linux/GCC.

This is the larger model (498 M parameters). A smaller, faster model with the same interface is radix16/pramen-223m – see Which one? below.

variant target
msvc-x64-Od / msvc-x64-O2 / msvc-x64-O1 Windows x64, MSVC, no optimization / /O2 / /O1
msvc-x86-Od / msvc-x86-O2 / msvc-x86-O1 Windows x86 (32-bit cdecl), MSVC
dos16-small-od / dos16-small-ox MS-DOS 16-bit real mode, small model, Open Watcom, no optimization / -ox
dos16-large-ox / dos16-large-os MS-DOS 16-bit real mode, large model (far calls), Open Watcom -ox / -os
dos32-od / dos32-ox (new) MS-DOS 32-bit protected mode (DOS/4GW, flat), Open Watcom wcc386, register calling (-5r)
dos16-msc-small-od / -small-ox / -large-ox (new) MS-DOS 16-bit, Microsoft C 5.1
dos16-dmc-small-o / dos16-dmc-large-o (new) MS-DOS 16-bit, Digital Mars C

It is a 498 M parameter decoder-only transformer (GPT-2 style) trained from scratch – no natural language, just assembly and C, with its own 16 384-token tokenizer (the same as the 223M model).

The output is a proposal. It usually compiles and often has the right structure, but names are invented (they are not in the binary), types are guessed and the logic has to be checked.

What's new in 1.3

  • Larger model: 24 layers × 1 280 instead of 16 × 1 024, trained on more data (3.0 B assembly → C tokens).
  • Seven new DOS variants: 32-bit DOS/4GW code from Open Watcom (most DOS games of the 90s), Microsoft C 5.1 and Digital Mars for 16-bit DOS.
  • Declarations (--context), --candidates 8, int8 and the web UI work as in 1.2. With declarations, 39 % of held-out functions recompile to exactly the input assembly (223M: 35 %).

Versions

Each release is a git tag of this repository; hf download radix16/pramen-498m --revision v1.3 always gives exactly that release, without --revision you get the newest. The version number is shared by the whole Pramen family (pramen-223m is at 1.2).

version date changes HumanEval-C, best of 8 held-out exact match
v1.3 2026-11-18 first 498M release, 7 new DOS variants 57.3 % 29.4 %

Which one?

pramen-498m (this) pramen-223m
HumanEval-C, best of 8 (avg. of 5 variants) 57.3 % 53.6 %
HumanEval-C, greedy 45.5 % 41.4 %
variants 17 (incl. DOS 32-bit, MS C, Digital Mars) 10
download (fp32 / int8) 2.0 GB / 0.6 GB 0.9 GB / 0.3 GB
CPU speed about 2× slower faster

Use the 498M model when you have a GPU, need the DOS 32-bit / MS C / Digital Mars variants, or want the best output; the 223M model on a laptop CPU.

Results

HumanEval-C from LLM4Binary/decompile-eval (CC0), recompiled with the same toolchains as the training data – 205 tasks (196–203 per variant). A task counts as solved when the decompiled C compiles (as C17 with the standard headers) and passes the original tests (re-executability). Max 600 new tokens.

variant 223M greedy 498M greedy 223M --candidates 8 498M --candidates 8
msvc-x64-Od 57.1 % 60.6 % 72.9 % 75.9 %
msvc-x64-O2 29.2 % 33.7 % 39.1 % 44.1 %
msvc-x86-Od 56.7 % 55.2 % 70.0 % 70.4 %
dos16-small-od 41.8 % 50.5 % 55.1 % 58.2 %
dos16-large-ox 22.3 % 27.4 % 31.0 % 38.1 %
average 41.4 % 45.5 % 53.6 % 57.3 %

New variants, HumanEval-C greedy: dos32-od 51.5 %, dos32-ox 30.9 %, dos16-dmc-small-o 29.8 %, dos16-dmc-large-o 32.1 % (196–204 tasks each). Microsoft C 5.1 cannot compile the C99 test code, so the dos16-msc-* variants are only measured on the held-out functions below.

MBPP-C from the same dataset (first 400 tasks, 338–357 usable per variant), greedy, same rules:

variant 223M 498M
msvc-x64-Od 57.3 % 57.9 %
msvc-x64-O2 30.1 % 30.9 %
msvc-x86-Od 56.6 % 55.5 %
dos16-small-od 44.0 % 50.7 %
dos16-large-ox 27.5 % 29.3 %
average 43.1 % 44.9 %

Held-out ExeBench functions (never used in training, compiled with their real dependencies), greedy: how often the output recompiles to exactly the input assembly, and how often it compiles at all.

exact match compiles
223M, 10 original variants (1 431 pairs), no declarations 26.3 % 46.5 %
498M, 10 original variants (1 431 pairs), no declarations 29.4 % 50.2 %
223M, 10 original variants, with the function's declarations 34.7 % 63.7 %
498M, 10 original variants, with the function's declarations 39.1 % 68.2 %
498M, 7 new DOS variants (1 898 pairs), no declarations 39.4 % 65.6 %

Per new variant (exact / compiles): dos32-od 38 / 63 %, dos32-ox 35 / 57 %, dos16-msc-small-od 51 / 88 %, dos16-msc-small-ox 54 / 85 %, dos16-msc-large-ox 46 / 85 %, dos16-dmc-small-o 41 / 71 %, dos16-dmc-large-o 47 / 76 %.

examples.json contains 12 classic functions × 6 variants with this model's outputs and test results (56 / 72 pass; the 223M model: 52 / 72) – they are also shown in the web UI.

Quick start

pip install huggingface_hub
hf download radix16/pramen-498m --local-dir pramen     # or: git clone https://huggingface.co/radix16/pramen-498m
cd pramen
pip install -r requirements.txt                   # torch, tokenizers, safetensors

# command line (model is found in the current folder)
python -m pramen example-count_words-msvc-x64-Od.asm --variant msvc-x64-Od

# with declarations: a function over a struct
python -m pramen example-order_total-msvc-x64-Od.asm --variant msvc-x64-Od --context example-order_total.h

# web UI with examples → http://127.0.0.1:8780
python -m pramen.web

GPU: a few seconds per function. On CPU it is about twice as slow as the 223M model; --quantize int8 uses the ready-made int8/ copy (0.6 GB).

python -m pramen func.asm --variant dos32-ox --candidates 8       # pick the best of 8 by recompiling
python -m pramen func.asm --variant msvc-x86-Od --quantize int8   # CPU, smaller and faster (uses int8/)

Compilers for --candidates

--candidates recompiles every candidate with the compiler of the variant, so it needs that compiler:

variants compiler where it is looked for
msvc-* Visual Studio 2022 / Build Tools vcvars64.bat, or DECOMP_VCVARS
dos16-* (Watcom), dos32-* Open Watcom V2 C:\WATCOM, or DECOMP_WATCOM
dos16-dmc-* Digital Mars C 8.57 + DOS 16-bit libraries (free download) tools\dmc\dm\bin\dmc.exe, or DECOMP_DMC
dos16-msc-* Microsoft C 5.1 from microsoft/MS-DOS (MIT, v4.0/src/TOOLS) run under MS-DOS Player tools\msc, tools\msdos-player\…, or DECOMP_MSC, DECOMP_MSDOS_PLAYER

Without a compiler the model still works; only --candidates is unavailable for that variant.

Getting the assembly

  • MSVC: dumpbin /disasm:nobytes program.obj – copy the block of one function.
  • Open Watcom, Microsoft C, Digital Mars (OMF .obj): wdis -a program.obj.
  • Ghidra: copy instructions from the Listing window. Turn off Markup Stack Variable References (Edit → Tool Options → Listing Fields → Operands Field).

pramen.normalize converts all of these into the exact form used in training.

Declarations (--context)

As in 1.2: struct / union / enum definitions, typedefs, extern globals and prototypes of called functions that the function uses. The Ghidra script pramen/ghidra/PramenContext.py exports them.

Prompt format

<|asm|>{variant}
{normalized assembly}
<|c|>
{declarations, optional – C lines, then a newline}
{C code}<|endoftext|>

Training

  • Data: assembly → C pairs from ExeBench functions, each compiled with MSVC 19.36, Open Watcom V2 (16 and 32 bit), Microsoft C 5.1 and Digital Mars 8.57, deduplicated (exact + near): 8.5 M pairs for the original variants plus 1.7 M pairs for the new DOS variants.
  • Additional C/C++ source code, mixed in so the model learns C syntax and idioms, from permissively licensed GitHub repositories (codeparrot/github-code-clean), The Stack, and several open-source projects (cJSON, fmt, nlohmann/json, and the GPL-2.0 source releases of Doom and Quake I–III).
  • Declarations and own verified outputs as in the 223M model 1.2.
  • Final mix: new DOS variants 30 %, original variants 55 %, declarations 15 %, so the model does not forget the original variants while learning the new ones.
  • Architecture: 24 layers, 1 280 hidden, 20 heads, MLP 5 120, context 4 096, learned positions, tied embeddings.

Limitations

  • one function at a time, up to ~3 500 input tokens (roughly 400–600 lines of assembly)
  • without declarations, globals and structs are only visible as addresses and offsets
  • variable and function names are invented
  • trained only on code produced by the compilers above; others (Borland / Turbo C, GCC/MinGW, …) are out of distribution
  • the C source of Doom is in the training data, so do not use Doom to evaluate it

License and data

Model weights and code: Apache-2.0. The training functions keep the licenses of their original GitHub repositories (as collected by ExeBench); the additional source code includes GPL-2.0 code (Doom, Quake). Use the outputs accordingly – decompiled code of third-party software is still subject to its original license.


Česky

Pramen 498M je větší model neuronového dekompilátoru Pramen: z assembleru jedné funkce napíše C. Proti menšímu pramen-223m je přesnější (HumanEval-C s výběrem z 8 kandidátů 57,3 % proti 53,6 %) a navíc umí 32bitový DOS (Open Watcom, DOS/4GW – většina DOS her 90. let), Microsoft C 5.1 a Digital Mars. Ovládání je stejné: pip install -r requirements.txt, pak python -m pramen.web nebo python -m pramen soubor.asm --variant dos32-ox.

Downloads last month
-
Safetensors
Model size
0.5B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including radix16/pramen-498m