File size: 5,604 Bytes
81de6d2
 
 
 
 
 
 
 
 
 
 
 
 
 
cdaef8a
 
 
 
81de6d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---

language: en
license: apache-2.0
library_name: neuro_compiler
base_model: Qwen/Qwen2.5-Coder-0.5B
tags:
- compiler
- neural-compiler
- hybrid
- x86-64
- safetensors
---

# Neuro Compiler 0.3.0

An experimental neural network that compiles C++ straight to x86_64 binary, this is

the latest iteration. The current focus is on optimizing C++ scenarios that LLVM fails on.



Neural source → AST → SSA → instruction selection is followed by exact lifetime/resource/ABI state logic, learned allocation scoring and a learned instruction encoder. This release is **not a wholly neural compiler** or an end-to-end trainable model.



Version **0.3.0** freezes the accepted eight-operation upstream checkpoints and the new 15E backend. It replaces the old register-allocation **and binary-emission** stages. All released weights are frozen. Earlier releases remain available at `0.1.0-experimental` and `0.2.0-experimental`; use their matching Python packages.



This is a research compiler with known incorrect outputs. Successful serialization is not a correctness guarantee. Sampled execution does not prove equivalence or optimality.



## Install and compile



Download `dist/neuro_compiler-0.3.0-py3-none-any.whl` from this repository's **0.3.0 tag**, then:

```bash

python -m pip install "./neuro_compiler-0.3.0-py3-none-any.whl[evaluation]"

```

Alternatively, download this tagged repository and run `python -m pip install ".[evaluation]"` in its root. The wheel contains code; model weights are downloaded separately by `from_pretrained`.

```python

from neuro_compiler import NeuralCompiler

from neuro_compiler.verification import verify



compiler = NeuralCompiler.from_pretrained(

    "chrisuser/neuro-compiler", revision="0.3.0", device="auto"

)

source = "unsigned f(unsigned a,unsigned b,unsigned c){return ((a+b)*(c-7u));}"

result = compiler.compile(source, return_intermediates=True)

print(result.machine_code.hex())

print(result.diagnostics)

print(verify(source, result.machine_code, samples=32))

```

`compile(source)` returns bytes. `compile_batch(sources, batch_size=16)` returns a list of byte strings; `strict=False` preserves rejected rows as `None`. `return_intermediates=True` returns `CompilationResult` objects with AST, SSA, virtual MIR, physical MIR and diagnostics. A local downloaded repository directory also works as `model_id`.

CPU and CUDA are supported. The first load downloads the pinned Qwen backbone and tokenizer, then caches an exact six-block tensor prefix; upstream weights are not bundled. See [REPRODUCIBILITY.md](REPRODUCIBILITY.md) for memory and precision details.

## Supported scope

- Compact `unsigned f(unsigned a,unsigned b,unsigned c){return EXPR;}` functions.
- One through **eight binary operations**: `+`, `-`, `*`, `^`, `&`, `|`, fully parenthesized expressions, arguments `a`, `b`, `c`, and unsigned literals `1u` through `63u`.
- Unsigned 32-bit arithmetic; at most **105 raw characters** and **96 tokenizer tokens**. Out-of-scope inputs are not supported. Raw character overflow is rejected, with no truncation.
- Output is a raw **x86-64 System V** function body: three uint32 arguments, uint32 result. It is **not Windows x64 ABI**, an ELF or PE executable, or a general C/C++ compiler. The evaluation helper emulates bytes; it never executes them natively.

## Actual qualification results

These are the existing research validation and regression sets, **not a new held-out test**. The previous 0.2.0 release's held-out score does not describe this release.

| Measure | Result |
| --- | ---: |
| Validation serialized / valid / ABI | 400 / 400 each |
| Validation sampled semantic correctness | **397 / 400 (99.25%)** |
| Hardest validation subset | **48 / 50 (96%)** |
| Regression sampled semantic correctness | **200 / 200 (100%)** |
| SafeTensors export parity: AST, SSA, ISEL and final bytes | **600 / 600 each** |

Fresh original source-to-bytes qualification used 32 input triples per program, or **19,200 bounded emulated executions**. Three validation errors remain upstream in instruction selection (row IDs 16023, 16063, 16125). No acceptance criteria were weakened. Export parity reuses qualified frozen backbone features to isolate serialization/runtime changes; it is not a new full-backbone evaluation. A separate installed-wheel CPU test performs fresh source inference, with access to development directories denied.

One original CUDA pass (600 functions, batch 16) measured 7.15 s startup, 9.09 s source-to-bytes inference and 66.0 functions/s; peak allocated tensor memory was 506.9 MiB. Verification is excluded. These are single-run observations, not a robust performance benchmark or a comparison against LLVM.

Evidence and reproducible cases are under [evaluation/](evaluation). See [ARCHITECTURE.md](ARCHITECTURE.md) for what is neural and what is explicit logic.

## Frozen artifacts

- Specialized parameters: **2,765,990**; SafeTensors files: **11,089,998 bytes**.
- Retained frozen Qwen parameters: **225,608,960** (embedding and six blocks; final norm is replaced with Identity to preserve the original intermediate-layer features).
- Original checkpoint relationships, export hashes, precision and immutable Qwen revision are recorded in `manifest.json`.
- `SHA256SUMS` covers the release tree except itself. No optimizer states, training caches or pickle checkpoints are published.
- Apache-2.0 project code and specialized weights; external dependency terms are described in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).