programador-powershell commited on
Commit
b9750e8
·
verified ·
1 Parent(s): 9563f73

Publish VBL-32M-Utility Native x86_64 v0.1.0

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ bin/linux-x86_64-v3/vbl32m filter=lfs diff=lfs merge=lfs -text
ARCHITECTURE.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "release": "VBL-32M-Utility",
3
+ "status": "EXPERIMENTAL_32M_UTILITY_NOT_KR100_PROMOTED",
4
+ "active_neural_architecture": [
5
+ "VBL_RC prelude -> shared recurrent core -> coda",
6
+ "GRT V16_NORM_MEAN",
7
+ "fixed certified recurrence R2",
8
+ "state-conditioned token-causal top-k elastic routing",
9
+ "73 experts x 320->256->320",
10
+ "router shares expert down.weight[0]; zero extra router parameters",
11
+ "copy/write gate sigmoid(4 + gate_logits)",
12
+ "tied embedding/output projection"
13
+ ],
14
+ "approved_runtime_policy": [
15
+ "native Rust x86_64",
16
+ "AVX2/FMA optimized dot products",
17
+ "all FP32 model weights resident in RAM",
18
+ "no mmap",
19
+ "no SSD streaming",
20
+ "no quantization",
21
+ "verified utility routing before raw neural fallback",
22
+ "abstain on unsupported utility requests",
23
+ "latent fixed-point distance trace instrumentation",
24
+ "route/halting trace reports fixed R2 execution"
25
+ ],
26
+ "approved_but_not_claimed_active": [
27
+ "adaptive STOP/CONTINUE: not activated because no certified trained gate exists",
28
+ "LTP: training-only candidate, not baked into this checkpoint",
29
+ "RHTM: trace concept only; no trained persistent memory in this checkpoint",
30
+ "Predictive Compute Prefetch/streaming: disabled because this release is full-RAM by requirement",
31
+ "K0/K1/K2 residency: not assigned; this release does not invent residency labels"
32
+ ],
33
+ "official_32m_c1": {
34
+ "passed": 583,
35
+ "total": 853,
36
+ "kr100": false
37
+ }
38
+ }
CARGO_BUILD_RELEASE.log ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+  Compiling proc-macro2 v1.0.107
2
+  Compiling unicode-ident v1.0.24
3
+  Compiling quote v1.0.47
4
+  Compiling serde_core v1.0.229
5
+  Compiling libc v0.2.189
6
+  Compiling syn v3.0.5
7
+  Compiling cfg-if v1.0.4
8
+  Compiling syn v2.0.119
9
+  Compiling memchr v2.8.3
10
+  Compiling serde v1.0.229
11
+  Compiling crossbeam-utils v0.8.23
12
+  Compiling serde_derive v1.0.229
13
+  Compiling zerocopy v0.8.57
14
+  Compiling crossbeam-epoch v0.9.21
15
+  Compiling strsim v0.11.1
16
+  Compiling getrandom v0.3.4
17
+  Compiling ident_case v1.0.1
18
+  Compiling fnv v1.0.7
19
+  Compiling darling_core v0.20.11
20
+  Compiling crossbeam-deque v0.8.8
21
+  Compiling darling_macro v0.20.11
22
+  Compiling rayon-core v1.13.0
23
+  Compiling rustversion v1.0.23
24
+  Compiling zmij v1.0.23
25
+  Compiling darling v0.20.11
26
+  Compiling aho-corasick v1.1.5
27
+  Compiling itoa v1.0.18
28
+  Compiling either v1.18.0
29
+  Compiling getrandom v0.4.3
30
+  Compiling once_cell v1.21.4
31
+  Compiling regex-syntax v0.8.11
32
+  Compiling version_check v0.9.5
33
+  Compiling rustix v1.1.4
34
+  Compiling serde_json v1.0.151
35
+  Compiling ahash v0.8.12
36
+  Compiling ppv-lite86 v0.2.21
37
+  Compiling regex-automata v0.4.18
38
+  Compiling derive_builder_core v0.20.2
39
+  Compiling rand_core v0.9.5
40
+  Compiling minimal-lexical v0.2.1
41
+  Compiling esaxx-rs v0.1.10
42
+  Compiling bit-vec v0.8.0
43
+  Compiling thiserror v2.0.20
44
+  Compiling bitflags v2.13.2
45
+  Compiling paste v1.0.15
46
+  Compiling linux-raw-sys v0.12.1
47
+  Compiling bit-set v0.8.0
48
+  Compiling nom v7.1.3
49
+  Compiling rand_chacha v0.9.0
50
+  Compiling castaway v0.2.4
51
+  Compiling derive_builder_macro v0.20.2
52
+  Compiling rayon v1.12.0
53
+  Compiling itertools v0.14.0
54
+  Compiling monostate-impl v0.1.18
55
+  Compiling thiserror-impl v2.0.20
56
+  Compiling unicode-segmentation v1.13.3
57
+  Compiling base64 v0.13.1
58
+  Compiling pastey v0.2.3
59
+  Compiling equivalent v1.0.2
60
+  Compiling macro_rules_attribute-proc_macro v0.2.3
61
+  Compiling foldhash v0.2.0
62
+  Compiling smallvec v1.16.0
63
+  Compiling static_assertions v1.1.0
64
+  Compiling allocator-api2 v0.2.21
65
+  Compiling fastrand v2.5.0
66
+  Compiling ryu v1.0.23
67
+  Compiling anyhow v1.0.104
68
+  Compiling hashbrown v0.16.1
69
+  Compiling compact_str v0.9.1
70
+  Compiling tempfile v3.27.0
71
+  Compiling unicode-normalization-alignments v0.1.12
72
+  Compiling macro_rules_attribute v0.2.3
73
+  Compiling spm_precompiled v0.1.4
74
+  Compiling monostate v0.1.18
75
+  Compiling rayon-cond v0.4.0
76
+  Compiling derive_builder v0.20.2
77
+  Compiling rand v0.9.5
78
+  Compiling fancy-regex v0.17.0
79
+  Compiling regex v1.13.1
80
+  Compiling dary_heap v0.3.9
81
+  Compiling log v0.4.34
82
+  Compiling unicode_categories v0.1.1
83
+  Compiling daachorse v3.0.3
84
+  Compiling tokenizers v0.23.2
85
+  Compiling safetensors v0.8.0
86
+  Compiling vbl32m v0.1.0 (/content/vbl32m_native_release/VBL-32M-Utility/native)
87
+ warning: fields `format`, `base_parameters`, and `growth_parameters` are never read
88
+ --> src/main.rs:25:5
89
+ |
90
+ 24 | struct NativeConfig {
91
+ | ------------ fields in this struct
92
+ 25 | format: String,
93
+ | ^^^^^^
94
+ 26 | parameters: usize,
95
+ 27 | base_parameters: usize,
96
+ | ^^^^^^^^^^^^^^^
97
+ 28 | growth_parameters: usize,
98
+ | ^^^^^^^^^^^^^^^^^
99
+ |
100
+ = note: `NativeConfig` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis
101
+ = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
102
+
103
+ warning: `vbl32m` (bin "vbl32m") generated 1 warning
104
+  Finished `release` profile [optimized] target(s) in 2m 12s
CARGO_CHECK.log ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+  Updating crates.io index
2
+  Locking 93 packages to latest compatible versions
3
+  Downloading crates ...
4
+  Downloaded bit-set v0.8.0
5
+  Downloaded bit-vec v0.8.0
6
+  Downloaded fancy-regex v0.17.0
7
+  Compiling proc-macro2 v1.0.107
8
+  Compiling unicode-ident v1.0.24
9
+  Compiling quote v1.0.47
10
+  Compiling serde_core v1.0.229
11
+  Compiling libc v0.2.189
12
+  Compiling syn v3.0.5
13
+  Checking cfg-if v1.0.4
14
+  Compiling syn v2.0.119
15
+  Checking memchr v2.8.3
16
+  Compiling crossbeam-utils v0.8.23
17
+  Compiling serde v1.0.229
18
+  Compiling serde_derive v1.0.229
19
+  Compiling strsim v0.11.1
20
+  Compiling fnv v1.0.7
21
+  Compiling crossbeam-epoch v0.9.21
22
+  Compiling getrandom v0.3.4
23
+  Compiling ident_case v1.0.1
24
+  Compiling zerocopy v0.8.57
25
+  Compiling darling_core v0.20.11
26
+  Compiling crossbeam-deque v0.8.8
27
+  Compiling darling_macro v0.20.11
28
+  Compiling rayon-core v1.13.0
29
+  Compiling zmij v1.0.23
30
+  Compiling rustversion v1.0.23
31
+  Compiling darling v0.20.11
32
+  Checking aho-corasick v1.1.5
33
+  Checking either v1.18.0
34
+  Checking regex-syntax v0.8.11
35
+  Compiling serde_json v1.0.151
36
+  Checking itoa v1.0.18
37
+  Compiling version_check v0.9.5
38
+  Checking once_cell v1.21.4
39
+  Compiling rustix v1.1.4
40
+  Compiling getrandom v0.4.3
41
+  Compiling ahash v0.8.12
42
+  Checking ppv-lite86 v0.2.21
43
+  Checking regex-automata v0.4.18
44
+  Compiling derive_builder_core v0.20.2
45
+  Checking rand_core v0.9.5
46
+  Compiling paste v1.0.15
47
+  Compiling thiserror v2.0.20
48
+  Checking bit-vec v0.8.0
49
+  Checking bitflags v2.13.2
50
+  Compiling esaxx-rs v0.1.10
51
+  Checking minimal-lexical v0.2.1
52
+  Checking linux-raw-sys v0.12.1
53
+  Checking nom v7.1.3
54
+  Checking bit-set v0.8.0
55
+  Checking rand_chacha v0.9.0
56
+  Checking castaway v0.2.4
57
+  Compiling derive_builder_macro v0.20.2
58
+  Checking rayon v1.12.0
59
+  Checking itertools v0.14.0
60
+  Compiling monostate-impl v0.1.18
61
+  Compiling thiserror-impl v2.0.20
62
+  Checking foldhash v0.2.0
63
+  Checking fastrand v2.5.0
64
+  Checking base64 v0.13.1
65
+  Compiling anyhow v1.0.104
66
+  Compiling macro_rules_attribute-proc_macro v0.2.3
67
+  Checking allocator-api2 v0.2.21
68
+  Checking ryu v1.0.23
69
+  Checking equivalent v1.0.2
70
+  Checking unicode-segmentation v1.13.3
71
+  Checking static_assertions v1.1.0
72
+  Compiling pastey v0.2.3
73
+  Checking smallvec v1.16.0
74
+  Checking macro_rules_attribute v0.2.3
75
+  Checking spm_precompiled v0.1.4
76
+  Checking unicode-normalization-alignments v0.1.12
77
+  Checking compact_str v0.9.1
78
+  Checking hashbrown v0.16.1
79
+  Checking tempfile v3.27.0
80
+  Checking monostate v0.1.18
81
+  Checking rayon-cond v0.4.0
82
+  Checking derive_builder v0.20.2
83
+  Checking rand v0.9.5
84
+  Checking fancy-regex v0.17.0
85
+  Checking regex v1.13.1
86
+  Checking dary_heap v0.3.9
87
+  Checking daachorse v3.0.3
88
+  Checking unicode_categories v0.1.1
89
+  Checking log v0.4.34
90
+  Checking safetensors v0.8.0
91
+  Checking tokenizers v0.23.2
92
+  Checking vbl32m v0.1.0 (/content/vbl32m_native_release/VBL-32M-Utility/native)
93
+ warning: fields `format`, `base_parameters`, and `growth_parameters` are never read
94
+ --> src/main.rs:25:5
95
+ |
96
+ 24 | struct NativeConfig {
97
+ | ------------ fields in this struct
98
+ 25 | format: String,
99
+ | ^^^^^^
100
+ 26 | parameters: usize,
101
+ 27 | base_parameters: usize,
102
+ | ^^^^^^^^^^^^^^^
103
+ 28 | growth_parameters: usize,
104
+ | ^^^^^^^^^^^^^^^^^
105
+ |
106
+ = note: `NativeConfig` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis
107
+ = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
108
+
109
+ warning: `vbl32m` (bin "vbl32m") generated 1 warning
110
+  Finished `dev` profile [unoptimized + debuginfo] target(s) in 41.10s
MANIFEST.json ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format": "VBL_32M_UTILITY_NATIVE_X86_RELEASE_V1",
3
+ "version": "VBL_32M_UTILITY_NATIVE_X86_HF_V2",
4
+ "parameters": 31974240,
5
+ "dtype": "FP32",
6
+ "weight_bytes": 127896960,
7
+ "weights_sha256": "aa08c34407a32488fe42f112be0d353f65ef8703dbc281ce11711f882bf9bf27",
8
+ "tokenizer_sha256": "b32e7a10b7a4766e3aae3be9e2ab11c14c7b0637d528df2ffc06151248e1db30",
9
+ "base_m0_sha256": "148b363527ba77ef77780db7ca00cf37d72e2fcf2ea480910839e31b71cc68c3",
10
+ "source_v85_checkpoint": "/content/drive/MyDrive/VBL/results/vbl_m0_32m_v8_5_path_independent/edae457e5ca263a13ce4/artifact/vbl_model_state_32m.pt",
11
+ "source_v85_checkpoint_sha256": "5630360510655334d02bf58c1c8b5e8f82faabc1342cca257d1ec2cabe7d569b",
12
+ "selected_alpha": 0.75,
13
+ "official_c1": {
14
+ "passed": 583,
15
+ "total": 853,
16
+ "kr100": false
17
+ },
18
+ "native": {
19
+ "language": "Rust",
20
+ "target": "x86_64-v3",
21
+ "required_features": [
22
+ "AVX2",
23
+ "FMA"
24
+ ],
25
+ "resident_policy": "FULL_RAM_HEAP_NO_MMAP_NO_STREAMING",
26
+ "linux_binary": "bin/linux-x86_64-v3/vbl32m",
27
+ "windows_build": "native/build-windows-x86_64.ps1",
28
+ "parity": {
29
+ "probe_ids": [
30
+ 4919,
31
+ 31,
32
+ 3188,
33
+ 328,
34
+ 372,
35
+ 392,
36
+ 372,
37
+ 36,
38
+ 204,
39
+ 2775,
40
+ 362,
41
+ 31
42
+ ],
43
+ "max_abs_last_logit": 2.384185791015625e-06,
44
+ "mean_abs_last_logit": 4.4087744299758924e-07,
45
+ "top1_reference": 204,
46
+ "top1_native": 204,
47
+ "pass": true
48
+ }
49
+ },
50
+ "training_performed": false,
51
+ "canonical_32m": false,
52
+ "release_role": "UTILITY_EXPERIMENTAL_32M"
53
+ }
README.md ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - vbl
4
+ - recurrent
5
+ - x86-64
6
+ - avx2
7
+ - rust
8
+ - cpu
9
+ - full-ram
10
+ - research
11
+ library_name: custom
12
+ ---
13
+
14
+ # VBL-32M-Utility Native
15
+
16
+ **31,974,240-parameter VBL utility/research release with a native Rust x86_64 runtime.**
17
+
18
+ ## Native execution
19
+
20
+ The primary runtime is **not Python/PyTorch**.
21
+
22
+ - Rust x86_64
23
+ - AVX2 + FMA optimized CPU dot products
24
+ - FP32 weights
25
+ - all model weights loaded into process RAM at startup
26
+ - **no mmap**
27
+ - **no SSD/model streaming**
28
+ - no quantization
29
+ - no GPU required for runtime
30
+
31
+ FP32 neural parameter payload: **121.97 MiB**.
32
+
33
+ ## Neural architecture
34
+
35
+ Active checkpoint architecture:
36
+
37
+ `input -> embedding -> prelude -> [V16_NORM_MEAN + state-conditioned elastic bank + shared recurrent core] x R2 -> coda -> tied output`
38
+
39
+ - base VBL-RC M0: 20,013,920 parameters
40
+ - connected elastic capacity: 11,960,320 parameters
41
+ - total: 31,974,240
42
+ - 73 experts
43
+ - expert width: 320 -> 256 -> 320
44
+ - top-k: 3
45
+ - router: token-causal, shares expert `down.weight[0]`, zero additional router parameters
46
+ - selected experimental alpha: 0.75
47
+
48
+ ## Verification status
49
+
50
+ This repository is intentionally named **Utility**, not Verified-32M.
51
+
52
+ The 32M candidate's official frozen C1 result was:
53
+
54
+ **583 / 853**
55
+
56
+ Therefore it is **NOT KR100 promoted**. The canonical M0 lineage remains preserved in the 32M base weights.
57
+
58
+ ## Utility mode
59
+
60
+ The native executable loads the complete 32M model into RAM and first routes deterministic tasks
61
+ through executable verifiers. Unsupported utility requests abstain instead of fabricating a result.
62
+
63
+ Examples:
64
+
65
+ ```bash
66
+ ./vbl32m --model-dir . "What is 34 + -13?"
67
+ ./vbl32m --model-dir . "Is 772 even or odd?"
68
+ ./vbl32m --model-dir . "Complete the sequence: 32, 33, 34, 35,"
69
+ ```
70
+
71
+ Raw experimental neural generation:
72
+
73
+ ```bash
74
+ ./vbl32m --model-dir . --raw "User: What is 2 + 2? Assistant:"
75
+ ```
76
+
77
+ Trace recurrent state convergence:
78
+
79
+ ```bash
80
+ ./vbl32m --model-dir . --raw --trace "User: Hello Assistant:"
81
+ ```
82
+
83
+ ## Windows x86_64
84
+
85
+ The repository includes `native/build-windows-x86_64.ps1`.
86
+
87
+ On an x86_64 Windows machine with Rust installed:
88
+
89
+ ```powershell
90
+ cd native
91
+ .uild-windows-x86_64.ps1
92
+ ```
93
+
94
+ This produces `native arget
95
+
96
+ ## VBL architecture policy
97
+
98
+ See `ARCHITECTURE.json`.
99
+
100
+ Features that were approved as experimental directions but were not trained/certified in this exact
101
+ checkpoint are explicitly marked inactive instead of being falsely presented as learned behavior.
102
+ Full-RAM residency intentionally disables predictive SSD streaming/prefetch.
103
+
104
+ ## Files
105
+
106
+ - `model.safetensors` — complete 32M FP32 state
107
+ - `tokenizer.json` — VBL-BPE-24K
108
+ - `native_config.json` — native runtime configuration and parity proof
109
+ - `native/` — Rust source
110
+ - `bin/linux-x86_64-v3/vbl32m` — compiled Linux x86_64 AVX2/FMA binary
111
+ - `ARCHITECTURE.json` — active/inactive VBL architecture contract
112
+ - `MANIFEST.json` / `SHA256SUMS` — provenance
RUST_INSTALL.log ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ info: downloading installer
2
+ warn: it looks like you have an existing rustup settings file at:
3
+ warn: /root/.rustup/settings.toml
4
+ info: profile set to minimal
5
+ info: default host tuple is x86_64-unknown-linux-gnu
6
+ warn: Updating existing toolchain, profile choice will be ignored
7
+ info: syncing channel updates for stable-x86_64-unknown-linux-gnu
8
+ info: default toolchain set to stable-x86_64-unknown-linux-gnu
9
+
10
+ stable-x86_64-unknown-linux-gnu unchanged - rustc 1.98.1 (48a229cea 2026-09-01)
11
+
12
+
13
+ Rust is installed now. Great!
14
+
15
+ To get started you may need to restart your current shell.
16
+ This would reload your PATH environment variable to include
17
+ Cargo's bin directory ($HOME/.cargo/bin).
18
+
19
+ To configure your current shell, you need to source the
20
+ corresponding env file under $HOME/.cargo.
21
+
22
+ Consider running the right command for your shell (note the leading DOT):
23
+ . "$HOME/.cargo/env" # For sh/ash/dash/pdksh/bash
24
+ cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
25
+ CC_x86_64-unknown-linux-gnu = None
26
+ cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
27
+ CC_x86_64_unknown_linux_gnu = None
28
+ cargo:rerun-if-env-changed=HOST_CC
29
+ HOST_CC = None
30
+ cargo:rerun-if-env-changed=CC
31
+ CC = None
32
+ cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
33
+ cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
34
+ CRATE_CC_NO_DEFAULTS = None
35
+ cargo:rerun-if-env-changed=CFLAGS
36
+ CFLAGS = None
37
+ cargo:rerun-if-env-changed=HOST_CFLAGS
38
+ HOST_CFLAGS = None
39
+ cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
40
+ CFLAGS_x86_64_unknown_linux_gnu = None
41
+ cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
42
+ CFLAGS_x86_64-unknown-linux-gnu = None
43
+ rustc 1.98.1 (48a229cea 2026-09-01)
44
+ cargo 1.98.1 (797e8a9bc 2026-08-05)
SHA256SUMS ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 28c770a61afc8cc4066bfd856c41f6ecdfd03b522736b79f54bdff6f36ad7317 ARCHITECTURE.json
2
+ d00490a82132cfc56c21d8780619c9c5dbf39b15eb6f42bda1736f0a29482076 CARGO_BUILD_RELEASE.log
3
+ 6ced8bbe8624935152264fd7bc676e0dcdfde0c20078e221f2eee3a079207f0d CARGO_CHECK.log
4
+ 4b8b12d0e52af640388f6df1d93b920a665b84880b7e6335fc0072d3cfe87772 MANIFEST.json
5
+ fb0319921416548097b42d72b98d54000b27a735b0b9246c35204242f239cb27 README.md
6
+ 2127f17c34fa8c2aaf34f0aab48ba9021fec04cce193f4c293baf6340014e0d6 RUST_INSTALL.log
7
+ 81cf8501b3d0d571b9bab39df5c351958ec04ebddff2afe690b4c0823b92b4ca bin/linux-x86_64-v3/vbl32m
8
+ aa08c34407a32488fe42f112be0d353f65ef8703dbc281ce11711f882bf9bf27 model.safetensors
9
+ aa1befe0b0f2e07af1b6327e79fb585c2bf330dff1331c56f07308853b853556 native/Cargo.lock
10
+ 39482e8172d0ba051b14b17d817e34a008826839164195fad29730050df67e24 native/Cargo.toml
11
+ 679c802c67dea2ff0e84cec86ea53114e657cbf0b2df01a8b21512861f8aed5a native/build-linux-x86_64.sh
12
+ 33cf6e9dd273b04bb368c1d9ec26b76d64bc59b958f66a919830400cda7c423b native/build-windows-x86_64.ps1
13
+ 6878196bcd9ba224205dc76b981453e4e8406d2cfaf9cf93f33b01b0c3f29dd1 native/src/main.rs
14
+ b16889c917c14ed064ae9ac1a5bd3cda2610c18cbbcc0bb8219448a26ec98ae5 native_config.json
15
+ b32e7a10b7a4766e3aae3be9e2ab11c14c7b0637d528df2ffc06151248e1db30 tokenizer.json
bin/linux-x86_64-v3/vbl32m ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81cf8501b3d0d571b9bab39df5c351958ec04ebddff2afe690b4c0823b92b4ca
3
+ size 3780760
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aa08c34407a32488fe42f112be0d353f65ef8703dbc281ce11711f882bf9bf27
3
+ size 127923524
native/Cargo.lock ADDED
@@ -0,0 +1,840 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "ahash"
7
+ version = "0.8.12"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
10
+ dependencies = [
11
+ "cfg-if",
12
+ "getrandom 0.3.4",
13
+ "once_cell",
14
+ "serde",
15
+ "version_check",
16
+ "zerocopy",
17
+ ]
18
+
19
+ [[package]]
20
+ name = "aho-corasick"
21
+ version = "1.1.5"
22
+ source = "registry+https://github.com/rust-lang/crates.io-index"
23
+ checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
24
+ dependencies = [
25
+ "memchr",
26
+ ]
27
+
28
+ [[package]]
29
+ name = "allocator-api2"
30
+ version = "0.2.21"
31
+ source = "registry+https://github.com/rust-lang/crates.io-index"
32
+ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
33
+
34
+ [[package]]
35
+ name = "anyhow"
36
+ version = "1.0.104"
37
+ source = "registry+https://github.com/rust-lang/crates.io-index"
38
+ checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
39
+
40
+ [[package]]
41
+ name = "base64"
42
+ version = "0.13.1"
43
+ source = "registry+https://github.com/rust-lang/crates.io-index"
44
+ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
45
+
46
+ [[package]]
47
+ name = "bit-set"
48
+ version = "0.8.0"
49
+ source = "registry+https://github.com/rust-lang/crates.io-index"
50
+ checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
51
+ dependencies = [
52
+ "bit-vec",
53
+ ]
54
+
55
+ [[package]]
56
+ name = "bit-vec"
57
+ version = "0.8.0"
58
+ source = "registry+https://github.com/rust-lang/crates.io-index"
59
+ checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
60
+
61
+ [[package]]
62
+ name = "bitflags"
63
+ version = "2.13.2"
64
+ source = "registry+https://github.com/rust-lang/crates.io-index"
65
+ checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
66
+
67
+ [[package]]
68
+ name = "castaway"
69
+ version = "0.2.4"
70
+ source = "registry+https://github.com/rust-lang/crates.io-index"
71
+ checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a"
72
+ dependencies = [
73
+ "rustversion",
74
+ ]
75
+
76
+ [[package]]
77
+ name = "cfg-if"
78
+ version = "1.0.4"
79
+ source = "registry+https://github.com/rust-lang/crates.io-index"
80
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
81
+
82
+ [[package]]
83
+ name = "compact_str"
84
+ version = "0.9.1"
85
+ source = "registry+https://github.com/rust-lang/crates.io-index"
86
+ checksum = "9dfdd1c2274d9aa354115b09dc9a901d6c5576818cdf70d14cae2bdb47df00ab"
87
+ dependencies = [
88
+ "castaway",
89
+ "cfg-if",
90
+ "itoa",
91
+ "rustversion",
92
+ "ryu",
93
+ "serde",
94
+ "static_assertions",
95
+ ]
96
+
97
+ [[package]]
98
+ name = "crossbeam-deque"
99
+ version = "0.8.8"
100
+ source = "registry+https://github.com/rust-lang/crates.io-index"
101
+ checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a"
102
+ dependencies = [
103
+ "crossbeam-epoch",
104
+ "crossbeam-utils",
105
+ ]
106
+
107
+ [[package]]
108
+ name = "crossbeam-epoch"
109
+ version = "0.9.21"
110
+ source = "registry+https://github.com/rust-lang/crates.io-index"
111
+ checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"
112
+ dependencies = [
113
+ "crossbeam-utils",
114
+ ]
115
+
116
+ [[package]]
117
+ name = "crossbeam-utils"
118
+ version = "0.8.23"
119
+ source = "registry+https://github.com/rust-lang/crates.io-index"
120
+ checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
121
+
122
+ [[package]]
123
+ name = "daachorse"
124
+ version = "3.0.3"
125
+ source = "registry+https://github.com/rust-lang/crates.io-index"
126
+ checksum = "5614204febbc33cc07a2806aa6440b904ac012b68eecc37f4493ea4a76455a3d"
127
+
128
+ [[package]]
129
+ name = "darling"
130
+ version = "0.20.11"
131
+ source = "registry+https://github.com/rust-lang/crates.io-index"
132
+ checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"
133
+ dependencies = [
134
+ "darling_core",
135
+ "darling_macro",
136
+ ]
137
+
138
+ [[package]]
139
+ name = "darling_core"
140
+ version = "0.20.11"
141
+ source = "registry+https://github.com/rust-lang/crates.io-index"
142
+ checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e"
143
+ dependencies = [
144
+ "fnv",
145
+ "ident_case",
146
+ "proc-macro2",
147
+ "quote",
148
+ "strsim",
149
+ "syn 2.0.119",
150
+ ]
151
+
152
+ [[package]]
153
+ name = "darling_macro"
154
+ version = "0.20.11"
155
+ source = "registry+https://github.com/rust-lang/crates.io-index"
156
+ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
157
+ dependencies = [
158
+ "darling_core",
159
+ "quote",
160
+ "syn 2.0.119",
161
+ ]
162
+
163
+ [[package]]
164
+ name = "dary_heap"
165
+ version = "0.3.9"
166
+ source = "registry+https://github.com/rust-lang/crates.io-index"
167
+ checksum = "8b1e3a325bc115f096c8b77bbf027a7c2592230e70be2d985be950d3d5e60ebe"
168
+ dependencies = [
169
+ "serde",
170
+ ]
171
+
172
+ [[package]]
173
+ name = "derive_builder"
174
+ version = "0.20.2"
175
+ source = "registry+https://github.com/rust-lang/crates.io-index"
176
+ checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947"
177
+ dependencies = [
178
+ "derive_builder_macro",
179
+ ]
180
+
181
+ [[package]]
182
+ name = "derive_builder_core"
183
+ version = "0.20.2"
184
+ source = "registry+https://github.com/rust-lang/crates.io-index"
185
+ checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8"
186
+ dependencies = [
187
+ "darling",
188
+ "proc-macro2",
189
+ "quote",
190
+ "syn 2.0.119",
191
+ ]
192
+
193
+ [[package]]
194
+ name = "derive_builder_macro"
195
+ version = "0.20.2"
196
+ source = "registry+https://github.com/rust-lang/crates.io-index"
197
+ checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c"
198
+ dependencies = [
199
+ "derive_builder_core",
200
+ "syn 2.0.119",
201
+ ]
202
+
203
+ [[package]]
204
+ name = "either"
205
+ version = "1.18.0"
206
+ source = "registry+https://github.com/rust-lang/crates.io-index"
207
+ checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34"
208
+
209
+ [[package]]
210
+ name = "equivalent"
211
+ version = "1.0.2"
212
+ source = "registry+https://github.com/rust-lang/crates.io-index"
213
+ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
214
+
215
+ [[package]]
216
+ name = "errno"
217
+ version = "0.3.14"
218
+ source = "registry+https://github.com/rust-lang/crates.io-index"
219
+ checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
220
+ dependencies = [
221
+ "libc",
222
+ "windows-sys",
223
+ ]
224
+
225
+ [[package]]
226
+ name = "esaxx-rs"
227
+ version = "0.1.10"
228
+ source = "registry+https://github.com/rust-lang/crates.io-index"
229
+ checksum = "d817e038c30374a4bcb22f94d0a8a0e216958d4c3dcde369b1439fec4bdda6e6"
230
+
231
+ [[package]]
232
+ name = "fancy-regex"
233
+ version = "0.17.0"
234
+ source = "registry+https://github.com/rust-lang/crates.io-index"
235
+ checksum = "72cf461f865c862bb7dc573f643dd6a2b6842f7c30b07882b56bd148cc2761b8"
236
+ dependencies = [
237
+ "bit-set",
238
+ "regex-automata",
239
+ "regex-syntax",
240
+ ]
241
+
242
+ [[package]]
243
+ name = "fastrand"
244
+ version = "2.5.0"
245
+ source = "registry+https://github.com/rust-lang/crates.io-index"
246
+ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
247
+
248
+ [[package]]
249
+ name = "fnv"
250
+ version = "1.0.7"
251
+ source = "registry+https://github.com/rust-lang/crates.io-index"
252
+ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
253
+
254
+ [[package]]
255
+ name = "foldhash"
256
+ version = "0.2.0"
257
+ source = "registry+https://github.com/rust-lang/crates.io-index"
258
+ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
259
+
260
+ [[package]]
261
+ name = "getrandom"
262
+ version = "0.3.4"
263
+ source = "registry+https://github.com/rust-lang/crates.io-index"
264
+ checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
265
+ dependencies = [
266
+ "cfg-if",
267
+ "libc",
268
+ "r-efi 5.3.0",
269
+ "wasip2",
270
+ ]
271
+
272
+ [[package]]
273
+ name = "getrandom"
274
+ version = "0.4.3"
275
+ source = "registry+https://github.com/rust-lang/crates.io-index"
276
+ checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
277
+ dependencies = [
278
+ "cfg-if",
279
+ "libc",
280
+ "r-efi 6.0.0",
281
+ ]
282
+
283
+ [[package]]
284
+ name = "hashbrown"
285
+ version = "0.16.1"
286
+ source = "registry+https://github.com/rust-lang/crates.io-index"
287
+ checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
288
+ dependencies = [
289
+ "allocator-api2",
290
+ "equivalent",
291
+ "foldhash",
292
+ "serde",
293
+ "serde_core",
294
+ ]
295
+
296
+ [[package]]
297
+ name = "ident_case"
298
+ version = "1.0.1"
299
+ source = "registry+https://github.com/rust-lang/crates.io-index"
300
+ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
301
+
302
+ [[package]]
303
+ name = "itertools"
304
+ version = "0.14.0"
305
+ source = "registry+https://github.com/rust-lang/crates.io-index"
306
+ checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
307
+ dependencies = [
308
+ "either",
309
+ ]
310
+
311
+ [[package]]
312
+ name = "itoa"
313
+ version = "1.0.18"
314
+ source = "registry+https://github.com/rust-lang/crates.io-index"
315
+ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
316
+
317
+ [[package]]
318
+ name = "libc"
319
+ version = "0.2.189"
320
+ source = "registry+https://github.com/rust-lang/crates.io-index"
321
+ checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
322
+
323
+ [[package]]
324
+ name = "linux-raw-sys"
325
+ version = "0.12.1"
326
+ source = "registry+https://github.com/rust-lang/crates.io-index"
327
+ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
328
+
329
+ [[package]]
330
+ name = "log"
331
+ version = "0.4.34"
332
+ source = "registry+https://github.com/rust-lang/crates.io-index"
333
+ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
334
+
335
+ [[package]]
336
+ name = "macro_rules_attribute"
337
+ version = "0.2.3"
338
+ source = "registry+https://github.com/rust-lang/crates.io-index"
339
+ checksum = "b3ae8f6d608c795738406608304d30a2dfbdc8e58e44f7ba43236da5208ded3c"
340
+ dependencies = [
341
+ "macro_rules_attribute-proc_macro",
342
+ "pastey",
343
+ ]
344
+
345
+ [[package]]
346
+ name = "macro_rules_attribute-proc_macro"
347
+ version = "0.2.3"
348
+ source = "registry+https://github.com/rust-lang/crates.io-index"
349
+ checksum = "fc04a4c58212d57930a24bf47d3fa87485264a3a054e9c10e042eb373573ad3c"
350
+
351
+ [[package]]
352
+ name = "memchr"
353
+ version = "2.8.3"
354
+ source = "registry+https://github.com/rust-lang/crates.io-index"
355
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
356
+
357
+ [[package]]
358
+ name = "minimal-lexical"
359
+ version = "0.2.1"
360
+ source = "registry+https://github.com/rust-lang/crates.io-index"
361
+ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
362
+
363
+ [[package]]
364
+ name = "monostate"
365
+ version = "0.1.18"
366
+ source = "registry+https://github.com/rust-lang/crates.io-index"
367
+ checksum = "3341a273f6c9d5bef1908f17b7267bbab0e95c9bf69a0d4dcf8e9e1b2c76ef67"
368
+ dependencies = [
369
+ "monostate-impl",
370
+ "serde",
371
+ "serde_core",
372
+ ]
373
+
374
+ [[package]]
375
+ name = "monostate-impl"
376
+ version = "0.1.18"
377
+ source = "registry+https://github.com/rust-lang/crates.io-index"
378
+ checksum = "e4db6d5580af57bf992f59068d4ea26fd518574ff48d7639b255a36f9de6e7e9"
379
+ dependencies = [
380
+ "proc-macro2",
381
+ "quote",
382
+ "syn 2.0.119",
383
+ ]
384
+
385
+ [[package]]
386
+ name = "nom"
387
+ version = "7.1.3"
388
+ source = "registry+https://github.com/rust-lang/crates.io-index"
389
+ checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
390
+ dependencies = [
391
+ "memchr",
392
+ "minimal-lexical",
393
+ ]
394
+
395
+ [[package]]
396
+ name = "once_cell"
397
+ version = "1.21.4"
398
+ source = "registry+https://github.com/rust-lang/crates.io-index"
399
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
400
+
401
+ [[package]]
402
+ name = "paste"
403
+ version = "1.0.15"
404
+ source = "registry+https://github.com/rust-lang/crates.io-index"
405
+ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
406
+
407
+ [[package]]
408
+ name = "pastey"
409
+ version = "0.2.3"
410
+ source = "registry+https://github.com/rust-lang/crates.io-index"
411
+ checksum = "2ee67f1008b1ba2321834326597b8e186293b049a023cdef258527550b9935b4"
412
+
413
+ [[package]]
414
+ name = "ppv-lite86"
415
+ version = "0.2.21"
416
+ source = "registry+https://github.com/rust-lang/crates.io-index"
417
+ checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
418
+ dependencies = [
419
+ "zerocopy",
420
+ ]
421
+
422
+ [[package]]
423
+ name = "proc-macro2"
424
+ version = "1.0.107"
425
+ source = "registry+https://github.com/rust-lang/crates.io-index"
426
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
427
+ dependencies = [
428
+ "unicode-ident",
429
+ ]
430
+
431
+ [[package]]
432
+ name = "quote"
433
+ version = "1.0.47"
434
+ source = "registry+https://github.com/rust-lang/crates.io-index"
435
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
436
+ dependencies = [
437
+ "proc-macro2",
438
+ ]
439
+
440
+ [[package]]
441
+ name = "r-efi"
442
+ version = "5.3.0"
443
+ source = "registry+https://github.com/rust-lang/crates.io-index"
444
+ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
445
+
446
+ [[package]]
447
+ name = "r-efi"
448
+ version = "6.0.0"
449
+ source = "registry+https://github.com/rust-lang/crates.io-index"
450
+ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
451
+
452
+ [[package]]
453
+ name = "rand"
454
+ version = "0.9.5"
455
+ source = "registry+https://github.com/rust-lang/crates.io-index"
456
+ checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41"
457
+ dependencies = [
458
+ "rand_chacha",
459
+ "rand_core",
460
+ ]
461
+
462
+ [[package]]
463
+ name = "rand_chacha"
464
+ version = "0.9.0"
465
+ source = "registry+https://github.com/rust-lang/crates.io-index"
466
+ checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
467
+ dependencies = [
468
+ "ppv-lite86",
469
+ "rand_core",
470
+ ]
471
+
472
+ [[package]]
473
+ name = "rand_core"
474
+ version = "0.9.5"
475
+ source = "registry+https://github.com/rust-lang/crates.io-index"
476
+ checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
477
+ dependencies = [
478
+ "getrandom 0.3.4",
479
+ ]
480
+
481
+ [[package]]
482
+ name = "rayon"
483
+ version = "1.12.0"
484
+ source = "registry+https://github.com/rust-lang/crates.io-index"
485
+ checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
486
+ dependencies = [
487
+ "either",
488
+ "rayon-core",
489
+ ]
490
+
491
+ [[package]]
492
+ name = "rayon-cond"
493
+ version = "0.4.0"
494
+ source = "registry+https://github.com/rust-lang/crates.io-index"
495
+ checksum = "2964d0cf57a3e7a06e8183d14a8b527195c706b7983549cd5462d5aa3747438f"
496
+ dependencies = [
497
+ "either",
498
+ "itertools",
499
+ "rayon",
500
+ ]
501
+
502
+ [[package]]
503
+ name = "rayon-core"
504
+ version = "1.13.0"
505
+ source = "registry+https://github.com/rust-lang/crates.io-index"
506
+ checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
507
+ dependencies = [
508
+ "crossbeam-deque",
509
+ "crossbeam-utils",
510
+ ]
511
+
512
+ [[package]]
513
+ name = "regex"
514
+ version = "1.13.1"
515
+ source = "registry+https://github.com/rust-lang/crates.io-index"
516
+ checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
517
+ dependencies = [
518
+ "aho-corasick",
519
+ "memchr",
520
+ "regex-automata",
521
+ "regex-syntax",
522
+ ]
523
+
524
+ [[package]]
525
+ name = "regex-automata"
526
+ version = "0.4.18"
527
+ source = "registry+https://github.com/rust-lang/crates.io-index"
528
+ checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
529
+ dependencies = [
530
+ "aho-corasick",
531
+ "memchr",
532
+ "regex-syntax",
533
+ ]
534
+
535
+ [[package]]
536
+ name = "regex-syntax"
537
+ version = "0.8.11"
538
+ source = "registry+https://github.com/rust-lang/crates.io-index"
539
+ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
540
+
541
+ [[package]]
542
+ name = "rustix"
543
+ version = "1.1.4"
544
+ source = "registry+https://github.com/rust-lang/crates.io-index"
545
+ checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
546
+ dependencies = [
547
+ "bitflags",
548
+ "errno",
549
+ "libc",
550
+ "linux-raw-sys",
551
+ "windows-sys",
552
+ ]
553
+
554
+ [[package]]
555
+ name = "rustversion"
556
+ version = "1.0.23"
557
+ source = "registry+https://github.com/rust-lang/crates.io-index"
558
+ checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
559
+
560
+ [[package]]
561
+ name = "ryu"
562
+ version = "1.0.23"
563
+ source = "registry+https://github.com/rust-lang/crates.io-index"
564
+ checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
565
+
566
+ [[package]]
567
+ name = "safetensors"
568
+ version = "0.8.0"
569
+ source = "registry+https://github.com/rust-lang/crates.io-index"
570
+ checksum = "79b079b829cb27a1c3c374341345ed2e8b2c0c839034522cee576c140bd7f846"
571
+ dependencies = [
572
+ "hashbrown",
573
+ "libc",
574
+ "serde",
575
+ "serde_json",
576
+ "tempfile",
577
+ ]
578
+
579
+ [[package]]
580
+ name = "serde"
581
+ version = "1.0.229"
582
+ source = "registry+https://github.com/rust-lang/crates.io-index"
583
+ checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
584
+ dependencies = [
585
+ "serde_core",
586
+ "serde_derive",
587
+ ]
588
+
589
+ [[package]]
590
+ name = "serde_core"
591
+ version = "1.0.229"
592
+ source = "registry+https://github.com/rust-lang/crates.io-index"
593
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
594
+ dependencies = [
595
+ "serde_derive",
596
+ ]
597
+
598
+ [[package]]
599
+ name = "serde_derive"
600
+ version = "1.0.229"
601
+ source = "registry+https://github.com/rust-lang/crates.io-index"
602
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
603
+ dependencies = [
604
+ "proc-macro2",
605
+ "quote",
606
+ "syn 3.0.5",
607
+ ]
608
+
609
+ [[package]]
610
+ name = "serde_json"
611
+ version = "1.0.151"
612
+ source = "registry+https://github.com/rust-lang/crates.io-index"
613
+ checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
614
+ dependencies = [
615
+ "itoa",
616
+ "memchr",
617
+ "serde",
618
+ "serde_core",
619
+ "zmij",
620
+ ]
621
+
622
+ [[package]]
623
+ name = "smallvec"
624
+ version = "1.16.0"
625
+ source = "registry+https://github.com/rust-lang/crates.io-index"
626
+ checksum = "b9be42f50aa861c555654aa3a37f52f4b1074bacf4e48fe0ef7fa584e80f1f0f"
627
+
628
+ [[package]]
629
+ name = "spm_precompiled"
630
+ version = "0.1.4"
631
+ source = "registry+https://github.com/rust-lang/crates.io-index"
632
+ checksum = "5851699c4033c63636f7ea4cf7b7c1f1bf06d0cc03cfb42e711de5a5c46cf326"
633
+ dependencies = [
634
+ "base64",
635
+ "nom",
636
+ "serde",
637
+ "unicode-segmentation",
638
+ ]
639
+
640
+ [[package]]
641
+ name = "static_assertions"
642
+ version = "1.1.0"
643
+ source = "registry+https://github.com/rust-lang/crates.io-index"
644
+ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
645
+
646
+ [[package]]
647
+ name = "strsim"
648
+ version = "0.11.1"
649
+ source = "registry+https://github.com/rust-lang/crates.io-index"
650
+ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
651
+
652
+ [[package]]
653
+ name = "syn"
654
+ version = "2.0.119"
655
+ source = "registry+https://github.com/rust-lang/crates.io-index"
656
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
657
+ dependencies = [
658
+ "proc-macro2",
659
+ "quote",
660
+ "unicode-ident",
661
+ ]
662
+
663
+ [[package]]
664
+ name = "syn"
665
+ version = "3.0.5"
666
+ source = "registry+https://github.com/rust-lang/crates.io-index"
667
+ checksum = "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9"
668
+ dependencies = [
669
+ "proc-macro2",
670
+ "quote",
671
+ "unicode-ident",
672
+ ]
673
+
674
+ [[package]]
675
+ name = "tempfile"
676
+ version = "3.27.0"
677
+ source = "registry+https://github.com/rust-lang/crates.io-index"
678
+ checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
679
+ dependencies = [
680
+ "fastrand",
681
+ "getrandom 0.4.3",
682
+ "once_cell",
683
+ "rustix",
684
+ "windows-sys",
685
+ ]
686
+
687
+ [[package]]
688
+ name = "thiserror"
689
+ version = "2.0.20"
690
+ source = "registry+https://github.com/rust-lang/crates.io-index"
691
+ checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"
692
+ dependencies = [
693
+ "thiserror-impl",
694
+ ]
695
+
696
+ [[package]]
697
+ name = "thiserror-impl"
698
+ version = "2.0.20"
699
+ source = "registry+https://github.com/rust-lang/crates.io-index"
700
+ checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
701
+ dependencies = [
702
+ "proc-macro2",
703
+ "quote",
704
+ "syn 3.0.5",
705
+ ]
706
+
707
+ [[package]]
708
+ name = "tokenizers"
709
+ version = "0.23.2"
710
+ source = "registry+https://github.com/rust-lang/crates.io-index"
711
+ checksum = "7afbf6e88718afcc138bad01d6ccc3051dbbc3b2ce9793d8b8a3aeb610969cfc"
712
+ dependencies = [
713
+ "ahash",
714
+ "compact_str",
715
+ "daachorse",
716
+ "dary_heap",
717
+ "derive_builder",
718
+ "esaxx-rs",
719
+ "fancy-regex",
720
+ "getrandom 0.3.4",
721
+ "itertools",
722
+ "log",
723
+ "macro_rules_attribute",
724
+ "monostate",
725
+ "paste",
726
+ "rand",
727
+ "rayon",
728
+ "rayon-cond",
729
+ "regex",
730
+ "regex-syntax",
731
+ "serde",
732
+ "serde_json",
733
+ "spm_precompiled",
734
+ "thiserror",
735
+ "unicode-normalization-alignments",
736
+ "unicode-segmentation",
737
+ "unicode_categories",
738
+ ]
739
+
740
+ [[package]]
741
+ name = "unicode-ident"
742
+ version = "1.0.24"
743
+ source = "registry+https://github.com/rust-lang/crates.io-index"
744
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
745
+
746
+ [[package]]
747
+ name = "unicode-normalization-alignments"
748
+ version = "0.1.12"
749
+ source = "registry+https://github.com/rust-lang/crates.io-index"
750
+ checksum = "43f613e4fa046e69818dd287fdc4bc78175ff20331479dab6e1b0f98d57062de"
751
+ dependencies = [
752
+ "smallvec",
753
+ ]
754
+
755
+ [[package]]
756
+ name = "unicode-segmentation"
757
+ version = "1.13.3"
758
+ source = "registry+https://github.com/rust-lang/crates.io-index"
759
+ checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
760
+
761
+ [[package]]
762
+ name = "unicode_categories"
763
+ version = "0.1.1"
764
+ source = "registry+https://github.com/rust-lang/crates.io-index"
765
+ checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e"
766
+
767
+ [[package]]
768
+ name = "vbl32m"
769
+ version = "0.1.0"
770
+ dependencies = [
771
+ "anyhow",
772
+ "rayon",
773
+ "regex",
774
+ "safetensors",
775
+ "serde",
776
+ "serde_json",
777
+ "tokenizers",
778
+ ]
779
+
780
+ [[package]]
781
+ name = "version_check"
782
+ version = "0.9.5"
783
+ source = "registry+https://github.com/rust-lang/crates.io-index"
784
+ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
785
+
786
+ [[package]]
787
+ name = "wasip2"
788
+ version = "1.0.4+wasi-0.2.12"
789
+ source = "registry+https://github.com/rust-lang/crates.io-index"
790
+ checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487"
791
+ dependencies = [
792
+ "wit-bindgen",
793
+ ]
794
+
795
+ [[package]]
796
+ name = "windows-link"
797
+ version = "0.2.1"
798
+ source = "registry+https://github.com/rust-lang/crates.io-index"
799
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
800
+
801
+ [[package]]
802
+ name = "windows-sys"
803
+ version = "0.61.2"
804
+ source = "registry+https://github.com/rust-lang/crates.io-index"
805
+ checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
806
+ dependencies = [
807
+ "windows-link",
808
+ ]
809
+
810
+ [[package]]
811
+ name = "wit-bindgen"
812
+ version = "0.57.1"
813
+ source = "registry+https://github.com/rust-lang/crates.io-index"
814
+ checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
815
+
816
+ [[package]]
817
+ name = "zerocopy"
818
+ version = "0.8.57"
819
+ source = "registry+https://github.com/rust-lang/crates.io-index"
820
+ checksum = "d35102a9f36d089ccae9e4c6802bc118be4487b80aaffc0ab4e0cf5ce92d2873"
821
+ dependencies = [
822
+ "zerocopy-derive",
823
+ ]
824
+
825
+ [[package]]
826
+ name = "zerocopy-derive"
827
+ version = "0.8.57"
828
+ source = "registry+https://github.com/rust-lang/crates.io-index"
829
+ checksum = "146c01f5ab44258da43cf276c74a2763db2ff3969c9c652c3f2de07041d0b2bc"
830
+ dependencies = [
831
+ "proc-macro2",
832
+ "quote",
833
+ "syn 2.0.119",
834
+ ]
835
+
836
+ [[package]]
837
+ name = "zmij"
838
+ version = "1.0.23"
839
+ source = "registry+https://github.com/rust-lang/crates.io-index"
840
+ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
native/Cargo.toml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [package]
2
+ name = "vbl32m"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+ description = "Native x86_64 full-RAM runtime for VBL-32M-Utility"
6
+
7
+ [dependencies]
8
+ anyhow = "1.0"
9
+ rayon = "1.11"
10
+ regex = "1.11"
11
+ serde = { version = "1.0", features = ["derive"] }
12
+ serde_json = "1.0"
13
+ safetensors = "=0.8.0"
14
+ tokenizers = { version = "=0.23.2", default-features = false, features = ["fancy-regex"] }
15
+
16
+ [profile.release]
17
+ opt-level = 3
18
+ lto = "thin"
19
+ codegen-units = 1
20
+ panic = "abort"
21
+ strip = true
native/build-linux-x86_64.sh ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ export RUSTFLAGS="-C target-cpu=x86-64-v3 -C target-feature=+avx2,+fma"
4
+ cargo check
5
+ cargo build --release
6
+ echo "Built: target/release/vbl32m"
native/build-windows-x86_64.ps1 ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ $ErrorActionPreference = "Stop"
2
+ $env:RUSTFLAGS = "-C target-cpu=x86-64-v3 -C target-feature=+avx2,+fma"
3
+ cargo check
4
+ cargo build --release
5
+ Write-Host "Built: target\release\vbl32m.exe"
native/src/main.rs ADDED
@@ -0,0 +1,1006 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ use anyhow::{anyhow, bail, Context, Result};
2
+ use rayon::prelude::*;
3
+ use regex::Regex;
4
+ use safetensors::tensor::{Dtype, SafeTensors};
5
+ use serde::Deserialize;
6
+ use std::collections::HashMap;
7
+ use std::fs;
8
+ use std::io::Write;
9
+ use std::path::{Path, PathBuf};
10
+
11
+ const DIM: usize = 320;
12
+ const HEADS: usize = 5;
13
+ const KV_HEADS: usize = 1;
14
+ const HEAD_DIM: usize = 64;
15
+ const FFN: usize = 1024;
16
+ const MOD_RANK: usize = 40;
17
+ const RECURRENCE: usize = 2;
18
+ const EXPERTS: usize = 73;
19
+ const EXPERT_RANK: usize = 256;
20
+ const TOPK: usize = 3;
21
+ const VOCAB: usize = 24000;
22
+
23
+ #[derive(Debug, Clone, Deserialize)]
24
+ struct NativeConfig {
25
+ format: String,
26
+ parameters: usize,
27
+ base_parameters: usize,
28
+ growth_parameters: usize,
29
+ context_length: usize,
30
+ rope_theta: f32,
31
+ rms_epsilon: f32,
32
+ selected_alpha: f32,
33
+ rope_mode: String,
34
+ resident_policy: String,
35
+ c1_passed: usize,
36
+ c1_total: usize,
37
+ }
38
+
39
+ #[derive(Clone)]
40
+ struct Tensor {
41
+ shape: Vec<usize>,
42
+ data: Vec<f32>,
43
+ }
44
+
45
+ struct TensorStore {
46
+ tensors: HashMap<String, Tensor>,
47
+ bytes: usize,
48
+ }
49
+
50
+ impl TensorStore {
51
+ fn load_full_ram(path: &Path) -> Result<Self> {
52
+ // Deliberately NOT mmaped: read the entire safetensors file into process RAM,
53
+ // materialize every f32 tensor into owned Vec<f32>, then drop the file bytes.
54
+ let raw = fs::read(path).with_context(|| format!("read {}", path.display()))?;
55
+ let st = SafeTensors::deserialize(&raw)?;
56
+
57
+ let mut tensors = HashMap::new();
58
+ let mut total = 0usize;
59
+
60
+ for (name, view) in st.iter() {
61
+ if view.dtype() != Dtype::F32 {
62
+ bail!("tensor {name} is {:?}, native runtime requires F32", view.dtype());
63
+ }
64
+
65
+ let bytes = view.data();
66
+ if bytes.len() % 4 != 0 {
67
+ bail!("tensor {name} byte length is not divisible by 4");
68
+ }
69
+
70
+ let mut data = Vec::<f32>::with_capacity(bytes.len() / 4);
71
+ for c in bytes.chunks_exact(4) {
72
+ data.push(f32::from_le_bytes([c[0], c[1], c[2], c[3]]));
73
+ }
74
+
75
+ total += data.len() * 4;
76
+ tensors.insert(
77
+ name.to_string(),
78
+ Tensor {
79
+ shape: view.shape().to_vec(),
80
+ data,
81
+ },
82
+ );
83
+ }
84
+
85
+ drop(st);
86
+ drop(raw);
87
+
88
+ Ok(Self {
89
+ tensors,
90
+ bytes: total,
91
+ })
92
+ }
93
+
94
+ fn get(&self, name: &str) -> Result<&Tensor> {
95
+ self.tensors
96
+ .get(name)
97
+ .ok_or_else(|| anyhow!("missing tensor {name}"))
98
+ }
99
+
100
+ fn scalar(&self, name: &str) -> Result<f32> {
101
+ let t = self.get(name)?;
102
+ if t.data.len() != 1 {
103
+ bail!("{name} is not scalar");
104
+ }
105
+ Ok(t.data[0])
106
+ }
107
+ }
108
+
109
+ #[derive(Clone)]
110
+ struct Matrix {
111
+ rows: usize,
112
+ cols: usize,
113
+ data: Vec<f32>,
114
+ }
115
+
116
+ impl Matrix {
117
+ fn zeros(rows: usize, cols: usize) -> Self {
118
+ Self {
119
+ rows,
120
+ cols,
121
+ data: vec![0.0; rows * cols],
122
+ }
123
+ }
124
+
125
+ fn row(&self, r: usize) -> &[f32] {
126
+ &self.data[r * self.cols..(r + 1) * self.cols]
127
+ }
128
+
129
+ fn row_mut(&mut self, r: usize) -> &mut [f32] {
130
+ &mut self.data[r * self.cols..(r + 1) * self.cols]
131
+ }
132
+
133
+ fn add(&self, rhs: &Matrix) -> Result<Matrix> {
134
+ if self.rows != rhs.rows || self.cols != rhs.cols {
135
+ bail!("matrix add shape mismatch");
136
+ }
137
+ let mut out = self.clone();
138
+ out.data
139
+ .par_iter_mut()
140
+ .zip(rhs.data.par_iter())
141
+ .for_each(|(a, b)| *a += *b);
142
+ Ok(out)
143
+ }
144
+ }
145
+
146
+ #[inline]
147
+ fn dot_scalar(a: &[f32], b: &[f32]) -> f32 {
148
+ a.iter().zip(b.iter()).map(|(x, y)| x * y).sum()
149
+ }
150
+
151
+ #[cfg(target_arch = "x86_64")]
152
+ #[target_feature(enable = "avx2,fma")]
153
+ unsafe fn dot_avx2(a: &[f32], b: &[f32]) -> f32 {
154
+ use std::arch::x86_64::*;
155
+ let mut acc = _mm256_setzero_ps();
156
+ let mut i = 0usize;
157
+
158
+ while i + 8 <= a.len() {
159
+ let va = _mm256_loadu_ps(a.as_ptr().add(i));
160
+ let vb = _mm256_loadu_ps(b.as_ptr().add(i));
161
+ acc = _mm256_fmadd_ps(va, vb, acc);
162
+ i += 8;
163
+ }
164
+
165
+ let mut tmp = [0f32; 8];
166
+ _mm256_storeu_ps(tmp.as_mut_ptr(), acc);
167
+ let mut sum: f32 = tmp.iter().sum();
168
+
169
+ while i < a.len() {
170
+ sum += *a.get_unchecked(i) * *b.get_unchecked(i);
171
+ i += 1;
172
+ }
173
+ sum
174
+ }
175
+
176
+ #[inline]
177
+ fn dot(a: &[f32], b: &[f32]) -> f32 {
178
+ #[cfg(target_arch = "x86_64")]
179
+ {
180
+ if std::arch::is_x86_feature_detected!("avx2")
181
+ && std::arch::is_x86_feature_detected!("fma")
182
+ {
183
+ return unsafe { dot_avx2(a, b) };
184
+ }
185
+ }
186
+ dot_scalar(a, b)
187
+ }
188
+
189
+ fn linear(x: &Matrix, w: &Tensor) -> Result<Matrix> {
190
+ if w.shape.len() != 2 {
191
+ bail!("linear weight is not rank-2: {:?}", w.shape);
192
+ }
193
+ let out_dim = w.shape[0];
194
+ let in_dim = w.shape[1];
195
+
196
+ if x.cols != in_dim {
197
+ bail!(
198
+ "linear input {} != weight in_dim {} shape={:?}",
199
+ x.cols,
200
+ in_dim,
201
+ w.shape
202
+ );
203
+ }
204
+
205
+ let mut out = Matrix::zeros(x.rows, out_dim);
206
+ out.data
207
+ .par_chunks_mut(out_dim)
208
+ .enumerate()
209
+ .for_each(|(r, row_out)| {
210
+ let xr = x.row(r);
211
+ for o in 0..out_dim {
212
+ let wr = &w.data[o * in_dim..(o + 1) * in_dim];
213
+ row_out[o] = dot(xr, wr);
214
+ }
215
+ });
216
+
217
+ Ok(out)
218
+ }
219
+
220
+ fn rms_norm(x: &Matrix, weight: &Tensor, eps: f32) -> Result<Matrix> {
221
+ if weight.shape != vec![x.cols] {
222
+ bail!("RMSNorm weight shape mismatch {:?} vs {}", weight.shape, x.cols);
223
+ }
224
+
225
+ let mut out = Matrix::zeros(x.rows, x.cols);
226
+ out.data
227
+ .par_chunks_mut(x.cols)
228
+ .enumerate()
229
+ .for_each(|(r, row_out)| {
230
+ let row = x.row(r);
231
+ let mean_sq = row.iter().map(|v| v * v).sum::<f32>() / x.cols as f32;
232
+ let inv = 1.0 / (mean_sq + eps).sqrt();
233
+ for d in 0..x.cols {
234
+ row_out[d] = row[d] * inv * weight.data[d];
235
+ }
236
+ });
237
+ Ok(out)
238
+ }
239
+
240
+ #[inline]
241
+ fn silu(x: f32) -> f32 {
242
+ x / (1.0 + (-x).exp())
243
+ }
244
+
245
+ fn apply_rope(
246
+ x: &mut Matrix,
247
+ heads: usize,
248
+ head_dim: usize,
249
+ theta: f32,
250
+ mode: &str,
251
+ ) -> Result<()> {
252
+ if x.cols != heads * head_dim || head_dim % 2 != 0 {
253
+ bail!("invalid RoPE shape rows={} cols={}", x.rows, x.cols);
254
+ }
255
+
256
+ for pos in 0..x.rows {
257
+ for h in 0..heads {
258
+ let off = h * head_dim;
259
+ let row = x.row_mut(pos);
260
+
261
+ match mode {
262
+ "interleaved" => {
263
+ for i in 0..head_dim / 2 {
264
+ let a = off + 2 * i;
265
+ let b = a + 1;
266
+ let inv = 1.0 / theta.powf((2 * i) as f32 / head_dim as f32);
267
+ let angle = pos as f32 * inv;
268
+ let c = angle.cos();
269
+ let s = angle.sin();
270
+ let x0 = row[a];
271
+ let x1 = row[b];
272
+ row[a] = x0 * c - x1 * s;
273
+ row[b] = x0 * s + x1 * c;
274
+ }
275
+ }
276
+ "half" => {
277
+ let half = head_dim / 2;
278
+ let original = row[off..off + head_dim].to_vec();
279
+ for i in 0..half {
280
+ let inv = 1.0 / theta.powf((2 * i) as f32 / head_dim as f32);
281
+ let angle = pos as f32 * inv;
282
+ let c = angle.cos();
283
+ let s = angle.sin();
284
+
285
+ let a = original[i];
286
+ let b = original[i + half];
287
+
288
+ row[off + i] = a * c - b * s;
289
+ row[off + i + half] = b * c + a * s;
290
+ }
291
+ }
292
+ other => bail!("unknown rope_mode {other}"),
293
+ }
294
+ }
295
+ }
296
+ Ok(())
297
+ }
298
+
299
+ fn softmax_in_place(v: &mut [f32]) {
300
+ let m = v.iter().copied().fold(f32::NEG_INFINITY, f32::max);
301
+ let mut s = 0.0f32;
302
+ for x in v.iter_mut() {
303
+ *x = (*x - m).exp();
304
+ s += *x;
305
+ }
306
+ if s > 0.0 {
307
+ for x in v.iter_mut() {
308
+ *x /= s;
309
+ }
310
+ }
311
+ }
312
+
313
+ struct VblModel {
314
+ w: TensorStore,
315
+ cfg: NativeConfig,
316
+ }
317
+
318
+ impl VblModel {
319
+ fn load(root: &Path) -> Result<Self> {
320
+ let cfg: NativeConfig = serde_json::from_slice(
321
+ &fs::read(root.join("native_config.json"))?
322
+ )?;
323
+ if cfg.parameters != 31_974_240 {
324
+ bail!("native_config parameter count mismatch");
325
+ }
326
+ if cfg.resident_policy != "FULL_RAM_HEAP_NO_MMAP_NO_STREAMING" {
327
+ bail!("release is not configured for full RAM residency");
328
+ }
329
+
330
+ let w = TensorStore::load_full_ram(&root.join("model.safetensors"))?;
331
+
332
+ let scalar_alpha = w.scalar("modulation.elastic_bank.alpha")?;
333
+ if (scalar_alpha - cfg.selected_alpha).abs() > 1e-7 {
334
+ bail!(
335
+ "alpha mismatch state={} config={}",
336
+ scalar_alpha,
337
+ cfg.selected_alpha
338
+ );
339
+ }
340
+
341
+ Ok(Self { w, cfg })
342
+ }
343
+
344
+ fn embedding(&self, ids: &[u32]) -> Result<Matrix> {
345
+ let emb = self.w.get("embedding.weight")?;
346
+ if emb.shape != vec![VOCAB, DIM] {
347
+ bail!("embedding shape mismatch {:?}", emb.shape);
348
+ }
349
+ let mut x = Matrix::zeros(ids.len(), DIM);
350
+ for (r, &id) in ids.iter().enumerate() {
351
+ let i = id as usize;
352
+ if i >= VOCAB {
353
+ bail!("token id out of vocabulary: {i}");
354
+ }
355
+ x.row_mut(r)
356
+ .copy_from_slice(&emb.data[i * DIM..(i + 1) * DIM]);
357
+ }
358
+ Ok(x)
359
+ }
360
+
361
+ fn attention(&self, x: &Matrix, prefix: &str) -> Result<Matrix> {
362
+ let mut q = linear(x, self.w.get(&format!("{prefix}.attn.q_proj.weight"))?)?;
363
+ let mut k = linear(x, self.w.get(&format!("{prefix}.attn.k_proj.weight"))?)?;
364
+ let v = linear(x, self.w.get(&format!("{prefix}.attn.v_proj.weight"))?)?;
365
+
366
+ apply_rope(
367
+ &mut q,
368
+ HEADS,
369
+ HEAD_DIM,
370
+ self.cfg.rope_theta,
371
+ &self.cfg.rope_mode,
372
+ )?;
373
+ apply_rope(
374
+ &mut k,
375
+ KV_HEADS,
376
+ HEAD_DIM,
377
+ self.cfg.rope_theta,
378
+ &self.cfg.rope_mode,
379
+ )?;
380
+
381
+ let t = x.rows;
382
+ let mut ctx = Matrix::zeros(t, DIM);
383
+ let scale = 1.0 / (HEAD_DIM as f32).sqrt();
384
+
385
+ for i in 0..t {
386
+ for h in 0..HEADS {
387
+ let qoff = h * HEAD_DIM;
388
+ let qr = &q.row(i)[qoff..qoff + HEAD_DIM];
389
+
390
+ let mut scores = vec![0.0f32; i + 1];
391
+ for j in 0..=i {
392
+ let kr = &k.row(j)[0..HEAD_DIM];
393
+ scores[j] = dot(qr, kr) * scale;
394
+ }
395
+ softmax_in_place(&mut scores);
396
+
397
+ for d in 0..HEAD_DIM {
398
+ let mut acc = 0.0f32;
399
+ for j in 0..=i {
400
+ acc += scores[j] * v.row(j)[d];
401
+ }
402
+ ctx.row_mut(i)[qoff + d] = acc;
403
+ }
404
+ }
405
+ }
406
+
407
+ linear(&ctx, self.w.get(&format!("{prefix}.attn.o_proj.weight"))?)
408
+ }
409
+
410
+ fn mlp(&self, x: &Matrix, prefix: &str) -> Result<Matrix> {
411
+ let gate = linear(x, self.w.get(&format!("{prefix}.mlp.gate_proj.weight"))?)?;
412
+ let up = linear(x, self.w.get(&format!("{prefix}.mlp.up_proj.weight"))?)?;
413
+ if gate.rows != up.rows || gate.cols != FFN || up.cols != FFN {
414
+ bail!("SwiGLU shape mismatch");
415
+ }
416
+
417
+ let mut fused = Matrix::zeros(x.rows, FFN);
418
+ fused
419
+ .data
420
+ .par_iter_mut()
421
+ .enumerate()
422
+ .for_each(|(i, o)| *o = silu(gate.data[i]) * up.data[i]);
423
+
424
+ linear(
425
+ &fused,
426
+ self.w.get(&format!("{prefix}.mlp.down_proj.weight"))?,
427
+ )
428
+ }
429
+
430
+ fn block(&self, x: &Matrix, prefix: &str) -> Result<Matrix> {
431
+ let n1 = rms_norm(
432
+ x,
433
+ self.w.get(&format!("{prefix}.attn_norm.weight"))?,
434
+ self.cfg.rms_epsilon,
435
+ )?;
436
+ let a = self.attention(&n1, prefix)?;
437
+ let r1 = x.add(&a)?;
438
+
439
+ let n2 = rms_norm(
440
+ &r1,
441
+ self.w.get(&format!("{prefix}.mlp_norm.weight"))?,
442
+ self.cfg.rms_epsilon,
443
+ )?;
444
+ let m = self.mlp(&n2, prefix)?;
445
+ r1.add(&m)
446
+ }
447
+
448
+ fn modulation(
449
+ &self,
450
+ anchor: &Matrix,
451
+ previous: &Matrix,
452
+ recurrence: usize,
453
+ ) -> Result<(Matrix, Matrix, Matrix)> {
454
+ let na = rms_norm(
455
+ anchor,
456
+ self.w.get("modulation.norm.weight")?,
457
+ self.cfg.rms_epsilon,
458
+ )?;
459
+ let np = rms_norm(
460
+ previous,
461
+ self.w.get("modulation.norm.weight")?,
462
+ self.cfg.rms_epsilon,
463
+ )?;
464
+
465
+ let mut normalized = Matrix::zeros(anchor.rows, DIM);
466
+ normalized
467
+ .data
468
+ .par_iter_mut()
469
+ .enumerate()
470
+ .for_each(|(i, o)| *o = 0.5 * (na.data[i] + np.data[i]));
471
+
472
+ let mut z = linear(&normalized, self.w.get("modulation.down.weight")?)?;
473
+ let re = self.w.get("modulation.recurrence_embeddings")?;
474
+ if re.shape.len() != 2 || re.shape[1] != MOD_RANK || recurrence >= re.shape[0] {
475
+ bail!("recurrence embedding shape mismatch {:?}", re.shape);
476
+ }
477
+
478
+ for r in 0..z.rows {
479
+ for d in 0..MOD_RANK {
480
+ let current = z.row(r)[d];
481
+ let value = silu(current + re.data[recurrence * MOD_RANK + d]);
482
+ z.row_mut(r)[d] = value;
483
+ }
484
+ }
485
+
486
+ let pair = linear(&z, self.w.get("modulation.up.weight")?)?;
487
+ if pair.cols != DIM * 2 {
488
+ bail!("modulation.up output must be 640");
489
+ }
490
+
491
+ let mut gate = Matrix::zeros(pair.rows, DIM);
492
+ let mut update = Matrix::zeros(pair.rows, DIM);
493
+ for r in 0..pair.rows {
494
+ gate.row_mut(r).copy_from_slice(&pair.row(r)[0..DIM]);
495
+ update
496
+ .row_mut(r)
497
+ .copy_from_slice(&pair.row(r)[DIM..DIM * 2]);
498
+ }
499
+
500
+ Ok((normalized, gate, update))
501
+ }
502
+
503
+ fn elastic(&self, source: &Matrix) -> Result<Matrix> {
504
+ let alpha = self.cfg.selected_alpha;
505
+ if alpha == 0.0 {
506
+ return Ok(Matrix::zeros(source.rows, DIM));
507
+ }
508
+
509
+ let mut out = Matrix::zeros(source.rows, DIM);
510
+
511
+ // Router uses existing first row of each expert.down; it adds zero parameters.
512
+ let mut router_norms = Vec::<Vec<f32>>::with_capacity(EXPERTS);
513
+ for e in 0..EXPERTS {
514
+ let down = self
515
+ .w
516
+ .get(&format!("modulation.elastic_bank.experts.{e}.down.weight"))?;
517
+ if down.shape != vec![EXPERT_RANK, DIM] {
518
+ bail!("expert {e} down shape mismatch {:?}", down.shape);
519
+ }
520
+ let row = &down.data[0..DIM];
521
+ let n = row.iter().map(|v| v * v).sum::<f32>().sqrt().max(1e-12);
522
+ router_norms.push(row.iter().map(|v| *v / n).collect());
523
+ }
524
+
525
+ for t in 0..source.rows {
526
+ let h = source.row(t);
527
+ let hn = h.iter().map(|v| v * v).sum::<f32>().sqrt().max(1e-12);
528
+ let hnorm: Vec<f32> = h.iter().map(|v| *v / hn).collect();
529
+
530
+ let mut scored: Vec<(f32, usize)> = (0..EXPERTS)
531
+ .map(|e| (4.0 * dot(&hnorm, &router_norms[e]), e))
532
+ .collect();
533
+ scored.sort_by(|a, b| b.0.total_cmp(&a.0));
534
+ let chosen = &scored[..TOPK];
535
+
536
+ let mut weights: Vec<f32> = chosen.iter().map(|x| x.0).collect();
537
+ softmax_in_place(&mut weights);
538
+
539
+ let xin = Matrix {
540
+ rows: 1,
541
+ cols: DIM,
542
+ data: h.to_vec(),
543
+ };
544
+
545
+ for (slot, &(_, e)) in chosen.iter().enumerate() {
546
+ let down = linear(
547
+ &xin,
548
+ self.w
549
+ .get(&format!("modulation.elastic_bank.experts.{e}.down.weight"))?,
550
+ )?;
551
+ let mut act = down;
552
+ for v in act.data.iter_mut() {
553
+ *v = silu(*v);
554
+ }
555
+ let up = linear(
556
+ &act,
557
+ self.w
558
+ .get(&format!("modulation.elastic_bank.experts.{e}.up.weight"))?,
559
+ )?;
560
+ for d in 0..DIM {
561
+ out.row_mut(t)[d] += alpha * weights[slot] * up.data[d];
562
+ }
563
+ }
564
+ }
565
+
566
+ Ok(out)
567
+ }
568
+
569
+ fn hidden(&self, ids: &[u32], trace: bool) -> Result<Matrix> {
570
+ if ids.is_empty() {
571
+ bail!("empty token sequence");
572
+ }
573
+ if ids.len() > self.cfg.context_length {
574
+ bail!(
575
+ "context {} exceeds {}",
576
+ ids.len(),
577
+ self.cfg.context_length
578
+ );
579
+ }
580
+
581
+ let x = self.embedding(ids)?;
582
+ let anchor = self.block(&x, "prelude")?;
583
+
584
+ let latent_seed = self.w.get("modulation.latent_seed")?;
585
+ if latent_seed.shape != vec![DIM] {
586
+ bail!("latent_seed shape mismatch");
587
+ }
588
+
589
+ let mut state = anchor.clone();
590
+ for r in 0..state.rows {
591
+ for d in 0..DIM {
592
+ state.row_mut(r)[d] += latent_seed.data[d];
593
+ }
594
+ }
595
+
596
+ for recurrence in 0..RECURRENCE {
597
+ let previous = state.clone();
598
+ let (normalized, gate_logits, update) =
599
+ self.modulation(&anchor, &previous, recurrence)?;
600
+ let elastic = self.elastic(&normalized)?;
601
+
602
+ let mut candidate = previous.add(&update)?.add(&elastic)?;
603
+ for block in 0..8 {
604
+ candidate = self.block(&candidate, &format!("core.{block}"))?;
605
+ }
606
+
607
+ let mut next = Matrix::zeros(previous.rows, DIM);
608
+ for i in 0..next.data.len() {
609
+ let g = 1.0 / (1.0 + (-(4.0 + gate_logits.data[i])).exp());
610
+ next.data[i] = g * previous.data[i] + (1.0 - g) * candidate.data[i];
611
+ }
612
+
613
+ if trace {
614
+ let delta = next
615
+ .data
616
+ .iter()
617
+ .zip(previous.data.iter())
618
+ .map(|(a, b)| {
619
+ let d = a - b;
620
+ d * d
621
+ })
622
+ .sum::<f32>()
623
+ .sqrt()
624
+ / (next.data.len() as f32).sqrt();
625
+ eprintln!(
626
+ "TRACE recurrence={} latent_fixed_point_distance={:.8}",
627
+ recurrence + 1,
628
+ delta
629
+ );
630
+ }
631
+
632
+ state = next;
633
+ }
634
+
635
+ let state = self.block(&state, "coda")?;
636
+ rms_norm(
637
+ &state,
638
+ self.w.get("final_norm.weight")?,
639
+ self.cfg.rms_epsilon,
640
+ )
641
+ }
642
+
643
+ fn last_logits(&self, ids: &[u32], trace: bool) -> Result<Vec<f32>> {
644
+ let hidden = self.hidden(ids, trace)?;
645
+ let last = Matrix {
646
+ rows: 1,
647
+ cols: DIM,
648
+ data: hidden.row(hidden.rows - 1).to_vec(),
649
+ };
650
+ let logits = linear(&last, self.w.get("embedding.weight")?)?;
651
+ Ok(logits.data)
652
+ }
653
+
654
+ fn generate(
655
+ &self,
656
+ tokenizer: &tokenizers::Tokenizer,
657
+ prompt: &str,
658
+ max_new: usize,
659
+ trace: bool,
660
+ ) -> Result<String> {
661
+ let enc = tokenizer
662
+ .encode(prompt, false)
663
+ .map_err(|e| anyhow!("tokenizer encode: {e}"))?;
664
+ let mut ids: Vec<u32> = enc.get_ids().to_vec();
665
+ let mut generated = Vec::<u32>::new();
666
+
667
+ for _ in 0..max_new {
668
+ if ids.len() > self.cfg.context_length {
669
+ ids = ids[ids.len() - self.cfg.context_length..].to_vec();
670
+ }
671
+ let logits = self.last_logits(&ids, trace)?;
672
+ let next = logits
673
+ .iter()
674
+ .enumerate()
675
+ .max_by(|a, b| a.1.total_cmp(b.1))
676
+ .map(|(i, _)| i as u32)
677
+ .ok_or_else(|| anyhow!("empty logits"))?;
678
+ ids.push(next);
679
+ generated.push(next);
680
+ }
681
+
682
+ tokenizer
683
+ .decode(&generated, false)
684
+ .map_err(|e| anyhow!("tokenizer decode: {e}"))
685
+ }
686
+ }
687
+
688
+ // -------------------------------------------------------------------------------------------------
689
+ // Verified Utility profile
690
+ // -------------------------------------------------------------------------------------------------
691
+
692
+ fn extract_numbers(text: &str) -> Vec<f64> {
693
+ let re = Regex::new(r"[-+]?\d+(?:\.\d+)?").unwrap();
694
+ re.find_iter(text)
695
+ .filter_map(|m| m.as_str().parse::<f64>().ok())
696
+ .collect()
697
+ }
698
+
699
+ fn fmt_num(x: f64) -> String {
700
+ if (x.round() - x).abs() < 1e-12 {
701
+ format!("{}", x.round() as i64)
702
+ } else {
703
+ format!("{x}")
704
+ }
705
+ }
706
+
707
+ fn utility_answer(prompt: &str) -> Option<(String, &'static str)> {
708
+ let low = prompt.trim().to_lowercase();
709
+
710
+ if let Some(pos) = low.find("output only this word:") {
711
+ let original = prompt.trim();
712
+ let cut = "output only this word:".len();
713
+ let suffix = original.get(pos + cut..)?.trim();
714
+ if !suffix.is_empty() && suffix.len() <= 256 {
715
+ return Some((suffix.to_string(), "literal_copy"));
716
+ }
717
+ }
718
+
719
+ let parity = Regex::new(r"(?i)is\s+([-+]?\d+)\s+even\s+or\s+odd").unwrap();
720
+ if let Some(c) = parity.captures(prompt) {
721
+ let n: i64 = c.get(1)?.as_str().parse().ok()?;
722
+ let label = if n % 2 == 0 { "even" } else { "odd" };
723
+ return Some((
724
+ label.to_string(),
725
+ "integer_modulo_2",
726
+ ));
727
+ }
728
+
729
+ if low.contains("complete the sequence") || low.contains("continue the sequence") {
730
+ let nums = extract_numbers(prompt);
731
+ if nums.len() >= 3 {
732
+ let ds: Vec<f64> = nums.windows(2).map(|w| w[1] - w[0]).collect();
733
+ if ds.iter().all(|d| (*d - ds[0]).abs() < 1e-12) {
734
+ return Some((fmt_num(nums[nums.len() - 1] + ds[0]), "arithmetic_sequence"));
735
+ }
736
+ if nums[..nums.len() - 1].iter().all(|x| x.abs() > 1e-12) {
737
+ let rs: Vec<f64> = nums.windows(2).map(|w| w[1] / w[0]).collect();
738
+ if rs.iter().all(|r| (*r - rs[0]).abs() < 1e-12) {
739
+ return Some((fmt_num(nums[nums.len() - 1] * rs[0]), "geometric_sequence"));
740
+ }
741
+ }
742
+ }
743
+ }
744
+
745
+ let pct = Regex::new(
746
+ r"(?i)what is\s+([-+]?\d+(?:\.\d+)?)\s*(?:percent|%)\s+of\s+([-+]?\d+(?:\.\d+)?)"
747
+ ).unwrap();
748
+ if let Some(c) = pct.captures(prompt) {
749
+ let p: f64 = c.get(1)?.as_str().parse().ok()?;
750
+ let x: f64 = c.get(2)?.as_str().parse().ok()?;
751
+ return Some((fmt_num(p * x / 100.0), "percentage_formula"));
752
+ }
753
+
754
+ let ar = Regex::new(
755
+ r"(?i)(?:what is|calculate|compute|give the result only:)?\s*([-+]?\d+(?:\.\d+)?)\s*(\+|-|\*|/|%)\s*([-+]?\d+(?:\.\d+)?)"
756
+ ).unwrap();
757
+ if let Some(c) = ar.captures(prompt) {
758
+ let a: f64 = c.get(1)?.as_str().parse().ok()?;
759
+ let op = c.get(2)?.as_str();
760
+ let b: f64 = c.get(3)?.as_str().parse().ok()?;
761
+ let v = match op {
762
+ "+" => a + b,
763
+ "-" => a - b,
764
+ "*" => a * b,
765
+ "/" if b != 0.0 => a / b,
766
+ "%" if b != 0.0 => a % b,
767
+ _ => return None,
768
+ };
769
+ if v.is_finite() {
770
+ return Some((fmt_num(v), "safe_arithmetic"));
771
+ }
772
+ }
773
+
774
+ if low.contains("python") && low.contains("function") {
775
+ let name_re = Regex::new(r"(?i)function\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*\(").unwrap();
776
+ let name = name_re
777
+ .captures(prompt)
778
+ .and_then(|c| c.get(1).map(|m| m.as_str().to_string()));
779
+
780
+ if low.contains("sum") || low.contains("add") {
781
+ let n = name.unwrap_or_else(|| "add".into());
782
+ return Some((format!("def {n}(a, b):\n return a + b"), "python_template_add"));
783
+ }
784
+ if low.contains("product") || low.contains("multiply") || low.contains("mul") {
785
+ let n = name.unwrap_or_else(|| "multiply".into());
786
+ return Some((format!("def {n}(a, b):\n return a * b"), "python_template_mul"));
787
+ }
788
+ if low.contains("even") {
789
+ let n = name.unwrap_or_else(|| "is_even".into());
790
+ return Some((format!("def {n}(n):\n return n % 2 == 0"), "python_template_even"));
791
+ }
792
+ }
793
+
794
+ if low.contains("what does cpu stand for") {
795
+ return Some(("Central Processing Unit.".into(), "fixed_verified_fact"));
796
+ }
797
+ if low.contains("what does ram stand for") {
798
+ return Some(("Random Access Memory.".into(), "fixed_verified_fact"));
799
+ }
800
+ if low.contains("what does http stand for") {
801
+ return Some(("Hypertext Transfer Protocol.".into(), "fixed_verified_fact"));
802
+ }
803
+ if low.contains("what is ram") || low.contains("explain what ram") {
804
+ return Some((
805
+ "RAM is fast temporary memory used to hold data and programs currently in use.".into(),
806
+ "fixed_verified_fact",
807
+ ));
808
+ }
809
+
810
+ None
811
+ }
812
+
813
+ fn find_root(explicit: Option<PathBuf>) -> Result<PathBuf> {
814
+ if let Some(p) = explicit {
815
+ return Ok(p);
816
+ }
817
+ if let Ok(p) = std::env::var("VBL_MODEL_DIR") {
818
+ return Ok(PathBuf::from(p));
819
+ }
820
+
821
+ let exe = std::env::current_exe()?;
822
+ let mut p = exe.parent().unwrap_or(Path::new(".")).to_path_buf();
823
+ for _ in 0..5 {
824
+ if p.join("model.safetensors").is_file() && p.join("native_config.json").is_file() {
825
+ return Ok(p);
826
+ }
827
+ if !p.pop() {
828
+ break;
829
+ }
830
+ }
831
+
832
+ let cwd = std::env::current_dir()?;
833
+ if cwd.join("model.safetensors").is_file() {
834
+ return Ok(cwd);
835
+ }
836
+
837
+ bail!("cannot locate model root; use --model-dir PATH")
838
+ }
839
+
840
+ fn print_help() {
841
+ println!("VBL-32M-Utility Native x86_64");
842
+ println!("Usage:");
843
+ println!(" vbl32m [--model-dir PATH] [--raw] [--trace] [--max-new N] PROMPT");
844
+ println!(" vbl32m --memory-report [--model-dir PATH]");
845
+ println!(" vbl32m --probe-ids 1,2,3 --dump-last-logits FILE");
846
+ println!(" vbl32m --self-test");
847
+ }
848
+
849
+ fn main() -> Result<()> {
850
+ let args: Vec<String> = std::env::args().skip(1).collect();
851
+
852
+ if args.iter().any(|x| x == "--help" || x == "-h") {
853
+ print_help();
854
+ return Ok(());
855
+ }
856
+
857
+ if args.iter().any(|x| x == "--self-test") {
858
+ let cases = [
859
+ ("What is 34 + -13?", "21"),
860
+ ("What is -7 - 23?", "-30"),
861
+ ("What is 4 * 0?", "0"),
862
+ ("Is 772 even or odd?", "even"),
863
+ ("Complete the sequence: 32, 33, 34, 35,", "36"),
864
+ ("What is 50 percent of 200?", "100"),
865
+ ("Output only this word: hrjwdkd", "hrjwdkd"),
866
+ ];
867
+ for (p, e) in cases {
868
+ let (a, _) = utility_answer(p).ok_or_else(|| anyhow!("no utility answer for {p}"))?;
869
+ if a != e {
870
+ bail!("self-test failed prompt={p:?} expected={e:?} got={a:?}");
871
+ }
872
+ }
873
+ println!("PASS native utility self-test");
874
+ return Ok(());
875
+ }
876
+
877
+ let mut root: Option<PathBuf> = None;
878
+ let mut raw_mode = false;
879
+ let mut trace = false;
880
+ let mut memory_report = false;
881
+ let mut probe_ids: Option<Vec<u32>> = None;
882
+ let mut dump_logits: Option<PathBuf> = None;
883
+ let mut max_new = 64usize;
884
+ let mut prompt_parts = Vec::<String>::new();
885
+
886
+ let mut i = 0usize;
887
+ while i < args.len() {
888
+ match args[i].as_str() {
889
+ "--model-dir" => {
890
+ i += 1;
891
+ root = Some(PathBuf::from(args.get(i).ok_or_else(|| anyhow!("missing --model-dir value"))?));
892
+ }
893
+ "--raw" => raw_mode = true,
894
+ "--trace" => trace = true,
895
+ "--memory-report" => memory_report = true,
896
+ "--max-new" => {
897
+ i += 1;
898
+ max_new = args
899
+ .get(i)
900
+ .ok_or_else(|| anyhow!("missing --max-new value"))?
901
+ .parse()?;
902
+ }
903
+ "--probe-ids" => {
904
+ i += 1;
905
+ let raw = args.get(i).ok_or_else(|| anyhow!("missing --probe-ids value"))?;
906
+ let ids = raw
907
+ .split(',')
908
+ .filter(|x| !x.trim().is_empty())
909
+ .map(|x| x.trim().parse::<u32>())
910
+ .collect::<std::result::Result<Vec<_>, _>>()?;
911
+ probe_ids = Some(ids);
912
+ }
913
+ "--dump-last-logits" => {
914
+ i += 1;
915
+ dump_logits = Some(PathBuf::from(
916
+ args.get(i).ok_or_else(|| anyhow!("missing dump path"))?
917
+ ));
918
+ }
919
+ x if x.starts_with("--") => bail!("unknown argument {x}"),
920
+ _ => prompt_parts.push(args[i].clone()),
921
+ }
922
+ i += 1;
923
+ }
924
+
925
+ let root = find_root(root)?;
926
+ eprintln!("VBL model root: {}", root.display());
927
+ eprintln!("Loading ALL model tensors into RAM (no mmap / no streaming)...");
928
+ let model = VblModel::load(&root)?;
929
+
930
+ let mib = model.w.bytes as f64 / 1024.0 / 1024.0;
931
+ eprintln!(
932
+ "PASS full-RAM residency: tensors={} weights={:.2} MiB params={} C1={}/{}",
933
+ model.w.tensors.len(),
934
+ mib,
935
+ model.cfg.parameters,
936
+ model.cfg.c1_passed,
937
+ model.cfg.c1_total
938
+ );
939
+
940
+ if memory_report {
941
+ println!(
942
+ "{{\"resident_policy\":\"{}\",\"weight_bytes\":{},\"weight_mib\":{:.6},\"tensors\":{},\"parameters\":{}}}",
943
+ model.cfg.resident_policy,
944
+ model.w.bytes,
945
+ mib,
946
+ model.w.tensors.len(),
947
+ model.cfg.parameters
948
+ );
949
+ return Ok(());
950
+ }
951
+
952
+ if let Some(ids) = probe_ids {
953
+ let logits = model.last_logits(&ids, trace)?;
954
+ let top1 = logits
955
+ .iter()
956
+ .enumerate()
957
+ .max_by(|a, b| a.1.total_cmp(b.1))
958
+ .map(|(i, _)| i)
959
+ .unwrap();
960
+
961
+ if let Some(path) = dump_logits {
962
+ let mut f = fs::File::create(path)?;
963
+ for v in logits.iter() {
964
+ f.write_all(&v.to_le_bytes())?;
965
+ }
966
+ }
967
+ println!("TOP1={top1}");
968
+ return Ok(());
969
+ }
970
+
971
+ let prompt = prompt_parts.join(" ");
972
+ if prompt.trim().is_empty() {
973
+ print_help();
974
+ bail!("prompt required");
975
+ }
976
+
977
+ // Entire neural model is already resident in RAM at this point.
978
+ if !raw_mode {
979
+ if let Some((answer, verifier)) = utility_answer(&prompt) {
980
+ println!("{answer}");
981
+ if trace {
982
+ eprintln!(
983
+ "TRACE utility_verified=true verifier={} neural_model_resident=true recurrent_depth=2",
984
+ verifier
985
+ );
986
+ }
987
+ return Ok(());
988
+ }
989
+
990
+ println!("UNSUPPORTED_BY_VERIFIED_UTILITY_PROFILE");
991
+ if trace {
992
+ eprintln!(
993
+ "TRACE utility_verified=false action=ABSTAIN raw_32m_available=true C1={}/{}",
994
+ model.cfg.c1_passed,
995
+ model.cfg.c1_total
996
+ );
997
+ }
998
+ return Ok(());
999
+ }
1000
+
1001
+ let tokenizer = tokenizers::Tokenizer::from_file(root.join("tokenizer.json"))
1002
+ .map_err(|e| anyhow!("load tokenizer: {e}"))?;
1003
+ let text = model.generate(&tokenizer, &prompt, max_new, trace)?;
1004
+ println!("{text}");
1005
+ Ok(())
1006
+ }
native_config.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format": "VBL_32M_NATIVE_X86_V1",
3
+ "parameters": 31974240,
4
+ "base_parameters": 20013920,
5
+ "growth_parameters": 11960320,
6
+ "context_length": 2048,
7
+ "rope_theta": 10000.0,
8
+ "rms_epsilon": 1e-05,
9
+ "selected_alpha": 0.75,
10
+ "rope_mode": "half",
11
+ "resident_policy": "FULL_RAM_HEAP_NO_MMAP_NO_STREAMING",
12
+ "dtype": "FP32",
13
+ "c1_passed": 583,
14
+ "c1_total": 853,
15
+ "kr100_promoted": false,
16
+ "weights_sha256": "aa08c34407a32488fe42f112be0d353f65ef8703dbc281ce11711f882bf9bf27",
17
+ "native_parity": {
18
+ "probe_ids": [
19
+ 4919,
20
+ 31,
21
+ 3188,
22
+ 328,
23
+ 372,
24
+ 392,
25
+ 372,
26
+ 36,
27
+ 204,
28
+ 2775,
29
+ 362,
30
+ 31
31
+ ],
32
+ "max_abs_last_logit": 2.384185791015625e-06,
33
+ "mean_abs_last_logit": 4.4087744299758924e-07,
34
+ "top1_reference": 204,
35
+ "top1_native": 204,
36
+ "pass": true
37
+ }
38
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff