ToTo-40417 commited on
Commit
80300e5
·
verified ·
1 Parent(s): 1a42360

Publish EXLLM-0.005B-Instruct

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
+ weights/model.q12 filter=lfs diff=lfs merge=lfs -text
CITATION.cff ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cff-version: 1.2.0
2
+ title: "EXLLM-0.005B-Instruct"
3
+ message: "If you use this model, please cite this release."
4
+ type: software
5
+ authors:
6
+ - name: "ToTo"
7
+ version: "1.0.0"
8
+ date-released: "2026-09-25"
9
+ license: "Apache-2.0"
10
+ repository-code: "https://github.com/ToTo-40417/exllm"
11
+ url: "https://huggingface.co/ToTo-40417/EXLLM"
DATA_PROVENANCE.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Data and Weight Provenance
2
+
3
+ ## Model lineage
4
+
5
+ EXLLM-0.005B-Instruct is a project-original model with 0.005377824B unique trainable parameters.
6
+
7
+ 1. The EXLLM project originates from random initialization.
8
+ 2. The current 0.005B release was expanded from an earlier in-project EXLLM checkpoint by transplanting dimension-compatible parameters.
9
+ 3. Additional staged training used only project-generated Japanese instruction/response data.
10
+ 4. Corrective datasets were added in response to regression failures.
11
+ 5. The final fp32 checkpoint was exported to EXLLM8 and EXQ12 deployment formats.
12
+
13
+ No external pretrained checkpoint was used. The model is not a distillation or quantization of a third-party LLM.
14
+
15
+ ## Training data
16
+
17
+ The project contains 0.086408M JSONL records across its published staged files. This number is the sum of file records, not a deduplicated training-example count. The files include overlapping base, validation, robustness, recovery, balance, consistency, and final corrective stages.
18
+
19
+ The data covers:
20
+
21
+ - short Japanese greetings and UI interaction;
22
+ - EXLLM and developer identity responses;
23
+ - short definitions of common terms;
24
+ - offline and current-information limitations;
25
+ - unknown-input fallback behavior;
26
+ - mixed Unicode and UTF-8 byte fallback;
27
+ - deterministic calculator routing;
28
+ - regression cases discovered during development.
29
+
30
+ No external public text dataset was imported into the published project corpus.
31
+
32
+ ## Published checkpoint metadata
33
+
34
+ | Field | Value |
35
+ |---|---|
36
+ | Parameters | 0.005377824B |
37
+ | Global step | 1,810 |
38
+ | Initialization | Earlier zero-based EXLLM project checkpoint transplantation |
39
+ | Final corrective source | `EXLLM-v1.1-5m-release2.pt` |
40
+ | Final corrective data | `v1_1_release_fix.jsonl` |
41
+ | Final corrective steps | 100 |
42
+ | Final corrective learning rate | 6e-6 |
43
+ | Final corrective loss | 0.03875 → 0.02420 |
44
+
45
+ ## Licensing
46
+
47
+ The released model weights, project-generated data, and reference code are distributed under Apache License 2.0 unless otherwise stated.
48
+
49
+ ## Scope
50
+
51
+ The corpus is intentionally narrow. Its presence in the training data does not establish comprehensive knowledge, factual authority, or currency. See the model card for intended use and limitations.
EXLLM8_FORMAT.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EXLLM8 binary format v1
2
+
3
+ All integer fields are little-endian.
4
+
5
+ ## File header
6
+
7
+ | Field | Type | Value |
8
+ |---|---|---|
9
+ | magic | 8 bytes | `EXLLM8\0\0` |
10
+ | format_version | uint32 | `1` |
11
+ | tensor_count | uint32 | number of serialized tensors |
12
+
13
+ ## Tensor record
14
+
15
+ Each tensor is stored as:
16
+
17
+ 1. `name_len`: uint16
18
+ 2. `ndim`: uint8
19
+ 3. `qtype`: uint8
20
+ 4. `name`: `name_len` UTF-8 bytes
21
+ 5. `dims`: `ndim` × uint32
22
+ 6. `scale_count`: uint32
23
+ 7. `data_bytes`: uint32
24
+ 8. `scales`: `scale_count` × float32
25
+ 9. `data`: `data_bytes` bytes
26
+
27
+ ### qtype 1 — row-wise int8
28
+
29
+ Used for 2D matrices. If a weight is shaped `[rows, cols]`, one float32 symmetric scale is stored per row and the matrix data is signed int8.
30
+
31
+ Approximate reconstruction:
32
+
33
+ ```text
34
+ weight[row, col] = int8_value[row, col] * scale[row]
35
+ ```
36
+
37
+ Quantized values are limited to `[-127, 127]`.
38
+
39
+ ### qtype 2 — float16
40
+
41
+ Used for the small RMSNorm vectors. `scale_count` is zero and `data` is IEEE-754 binary16.
42
+
43
+ ## Weight tying
44
+
45
+ `lm_head.weight` is not stored. It aliases `tok.weight`. The companion manifest declares this alias explicitly.
46
+
47
+ ## Deployment note
48
+
49
+ The float scales are an interchange representation. A SH4/no-FPU deployment should translate them into the fixed-point scale representation chosen by the C inference kernel.
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
NOTICE ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ EXLLM
2
+ Copyright 2026 ToTo
3
+
4
+ EXLLM 5M (model version 1.1.0-5m) is distributed under the Apache License, Version 2.0.
5
+ The published model was initialized from random weights for this project and does not contain TinyJP/beta model weights.
README.md CHANGED
@@ -1,3 +1,202 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ language: [ja]
4
+ pipeline_tag: text-generation
5
+ library_name: pytorch
6
+ tags: [japanese, instruction-tuning, tiny-language-model, edge-ai, embedded-ai, ex-word, custom-code]
7
  ---
8
+
9
+ # EXLLM-0.005B-Instruct
10
+
11
+ EXLLM-0.005B-Instruct is a **0.005377824B-parameter** Japanese instruction model for local inference on low-memory embedded hardware. The primary deployment target is the CASIO EX-word XD-B4800. A PyTorch reference runtime is provided for host-side inference and evaluation.
12
+
13
+ The model uses a custom decoder-only Transformer and a hybrid character/UTF-8-byte tokenizer. It is not compatible with the standard `transformers` auto classes, GGUF, llama.cpp, or LM Studio without an architecture-specific implementation.
14
+
15
+ 日本語版の説明は[こちら](#日本語)です。
16
+
17
+ ## Highlights
18
+
19
+ - **0.005377824B parameters**
20
+ - **0.000868M-token vocabulary** with UTF-8 byte fallback
21
+ - **0.000128M-token context length**
22
+ - **0.021526737 GB** fp32 checkpoint
23
+ - **0.005443105 GB** int8 and EXQ12 deployment artifacts
24
+ - Reference inference at **239.082 token/s** on an RTX 3060
25
+ - Integer inference at **0.52–0.55 token/s** on a 0.024184 GHz SH-4A-class CPU
26
+ - Apache-2.0 weights and reference code
27
+
28
+ ## Model Details
29
+
30
+ | Field | Value |
31
+ |---|---|
32
+ | Model type | Instruction-tuned decoder-only Transformer |
33
+ | Parameters | 0.005377824B |
34
+ | Language | Japanese |
35
+ | Context length | 0.000128M tokens |
36
+ | Vocabulary | 0.000868M tokens |
37
+ | Layers | 6 |
38
+ | Hidden size | 288 |
39
+ | Attention heads | 9 |
40
+ | Head dimension | 32 |
41
+ | FFN hidden size | 896 |
42
+ | Activation | ReLU |
43
+ | Normalization | Pre-norm RMSNorm, epsilon 1e-5 |
44
+ | Position encoding | Learned absolute position embedding |
45
+ | Output head | Weight-tied token embedding |
46
+ | Tokenizer | Frequent Japanese characters + UTF-8 byte fallback, NFC normalization |
47
+ | License | Apache-2.0 |
48
+
49
+ The parameter count reports unique trainable parameters. The tied language-model head and token embedding refer to the same parameter tensor.
50
+
51
+ ## Training
52
+
53
+ EXLLM was trained only on project-generated Japanese instruction/response data. It does not use an external pretrained checkpoint or imported public text corpus. The EXLLM project originates from random initialization. The 0.005B release was expanded from an earlier in-project EXLLM checkpoint by transplanting dimension-compatible parameters, followed by staged training and corrective fine-tuning. No external pretrained checkpoint was used.
54
+
55
+ | Item | Value |
56
+ |---|---|
57
+ | Published staged data | 0.086408M JSONL records |
58
+ | External pretrained base | None |
59
+ | Optimizer | AdamW |
60
+ | Base learning rate | 5e-4 |
61
+ | Adam betas | 0.9, 0.95 |
62
+ | Base weight decay | 0.03 |
63
+ | Gradient clipping | 1.0 |
64
+ | LR schedule | Linear warm-up + cosine decay |
65
+ | Checkpoint global step | 1,810 |
66
+ | Final corrective stage | 100 steps at 6e-6 |
67
+ | Final corrective loss | 0.03875 → 0.02420 |
68
+
69
+ The published staged files include overlapping base, robustness, recovery, and corrective sets; 0.086408M is a file-record total, not a deduplicated example count. Exact end-to-end training time and training-device telemetry were not retained in the release checkpoint and are therefore not reported.
70
+
71
+ Data scope and weight lineage are documented in [`DATA_PROVENANCE.md`](DATA_PROVENANCE.md).
72
+ The machine-readable release metadata is available in [`training/release-5m.json`](training/release-5m.json).
73
+
74
+ ## Inference Performance
75
+
76
+ All results use greedy decoding. TTFT means time to first generated token. Decode throughput excludes the first generated token.
77
+
78
+ | Runtime | Compute | Model format | Memory | Load | TTFT | Decode throughput |
79
+ |---|---|---|---:|---:|---:|---:|
80
+ | PyTorch 2.11.0+cu130 | RTX 3060, 12 GB VRAM | fp32 | 0.0307584 GB peak allocated | 0.4645 s | 0.003990 s | 239.082 token/s |
81
+ | EX-word integer runtime | SH-4A-class, 1C/1T, 0.024184 GHz | int8 weights / Q12 activations | 0.00786432 GB verified contiguous application heap | device storage | 23.711 s | 0.52–0.55 token/s |
82
+
83
+ ### RTX 3060 methodology
84
+
85
+ - Driver 580.178.04; Python 3.12.13; CUDA 13.0.
86
+ - 40 warm-up inferences followed by 120 measured inferences.
87
+ - Median TTFT: 0.003990 s; observed range: 0.003913–0.004072 s.
88
+ - Median total generation time: 0.079589 s.
89
+ - Tukey 1.5 IQR filtering removed 0/120 observations for TTFT, total time, and decode throughput.
90
+ - The first cold warm-up inference recorded 0.193056 s TTFT.
91
+ - Raw per-run results are published in [`benchmarks/rtx3060-cuda-robust-20260925.json`](benchmarks/rtx3060-cuda-robust-20260925.json).
92
+
93
+ ### EX-word methodology
94
+
95
+ - CASIO EX-word XD-B4800 / DATAPLUS 6.
96
+ - SH7305-family SH-4A, 1 core / 1 thread; measured instruction clock 0.024184 GHz.
97
+ - Five prompts, Thinking disabled, model stored in internal storage.
98
+ - Application UI rendering and UTF-8 display handling are included.
99
+ - Median TTFT: 23.711 s; observed range: 12.705–28.440 s.
100
+ - Median total generation time: 54.145 s.
101
+
102
+ The two runtimes use the same architecture and training lineage but different numerical representations. The results are deployment measurements, not a direct hardware-compute comparison.
103
+
104
+ ## Evaluation
105
+
106
+ The release was evaluated with a project-specific regression suite after dequantizing the EXLLM8 artifact into the reference runtime.
107
+
108
+ | Suite | Result |
109
+ |---|---:|
110
+ | Semantic behavior | 35 / 35 |
111
+ | Deterministic calculator routing | 300 / 300 |
112
+ | Fuzz prompts | 200 / 200 |
113
+ | Sampling checks | 48 / 48 |
114
+ | Release gate | PASS |
115
+
116
+ These are internal regression tests for the intended application scope. They are not standard language-model benchmarks and should not be interpreted as evidence of broad knowledge, general reasoning, or benchmark comparability with larger models.
117
+
118
+ ## Usage
119
+
120
+ ```bash
121
+ git clone https://huggingface.co/ToTo-40417/EXLLM
122
+ cd EXLLM
123
+ python -m venv .venv
124
+ . .venv/bin/activate
125
+ pip install -r requirements.txt
126
+ python chat.py こんにちは
127
+ ```
128
+
129
+ ```python
130
+ from src.loader import load_release_model
131
+ from src.runtime import answer
132
+
133
+ model, tokenizer = load_release_model()
134
+ print(answer(model, tokenizer, "RAMとは何ですか?", temperature=0.0))
135
+ ```
136
+
137
+ ### Generation Examples
138
+
139
+ | Prompt | Greedy output |
140
+ |---|---|
141
+ | `こんにちは` | `こんにちは。ことばの意味や簡単な質問ならどうぞ。` |
142
+ | `あなたは何というモデルですか?` | `私はEXLLMです。` |
143
+ | `RAMとは何ですか?` | `RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。` |
144
+ | `オフラインとは何ですか?` | `ウェブ検索はできません。` |
145
+
146
+ ## Release Artifacts
147
+
148
+ | Artifact | Size | SHA-256 | Purpose |
149
+ |---|---:|---|---|
150
+ | `weights/EXLLM-v1.1-5m-release3.pt` | 21,526,737 bytes (20.53 MiB; 0.021526737 GB) | `48ad00c6640689595a253fc949cad83f3000e14cccdf69275fcf245e85be3ceb` | fp32 PyTorch checkpoint |
151
+ | `weights/EXLLM-v1.1-5m-int8.bin` | 5,443,105 bytes (5.19 MiB; 0.005443105 GB) | `3b2bf2d9f103cba714bc98976709c5ad34860c1ff55fed2fce91fc95afb5b34a` | EXLLM8 interchange artifact |
152
+ | `weights/model.q12` | 5,443,105 bytes (5.19 MiB; 0.005443105 GB) | `d64037fde791e5c0e48101bc1a8ab366a3287f1f36b4464879e36495ea7e5a53` | EX-word EXQ12 artifact |
153
+
154
+ EXLLM8 and EXQ12 have the same file size but are not interchangeable formats.
155
+
156
+ ## Intended Use
157
+
158
+ - Ultra-small language-model research
159
+ - Embedded and low-memory inference experiments
160
+ - Short Japanese UI responses and narrow-domain instruction handling
161
+ - Integer-runtime and quantization experiments
162
+ - Educational analysis of language models below 0.01B parameters
163
+
164
+ ## Limitations
165
+
166
+ - The model is not a general-purpose assistant.
167
+ - The context limit is 0.000128M tokens.
168
+ - Knowledge coverage is restricted to the project-generated training scope.
169
+ - Unseen concepts, long instructions, translation, and multi-step reasoning are unreliable.
170
+ - No RLHF, DPO, tool use, retrieval, web access, or current-information source is included.
171
+ - The deterministic calculator is runtime routing, not learned arithmetic capability.
172
+ - The model must not be used as an authority for medical, legal, financial, safety-critical, or other high-stakes decisions.
173
+ - Standard Hugging Face Inference Providers cannot serve this checkpoint without custom architecture support.
174
+
175
+ ## Links
176
+
177
+ - Source and training code: [`ToTo-40417/exllm`](https://github.com/ToTo-40417/exllm)
178
+ - EX-word runtime: [`ToTo-40417/exllm-exword`](https://github.com/ToTo-40417/exllm-exword)
179
+ - Hardware probe: [`ToTo-40417/exword-hardware-dump`](https://github.com/ToTo-40417/exword-hardware-dump)
180
+
181
+ ## 日本語
182
+
183
+ EXLLM-0.005B-Instructは、低メモリ組込み機器でのローカル推論を目的とした、**0.005377824Bパラメータ**の日本語instruction modelです。主な実装対象はCASIO EX-word XD-B4800です。
184
+
185
+ 独自のdecoder-only Transformerと、頻出日本語文字・UTF-8 byte fallbackを組み合わせたtokenizerを使用します。標準`transformers`、GGUF、llama.cpp、LM Studioとの直接互換性はありません。
186
+
187
+ RTX 3060でのfp32参照実行は、40回のwarm-up後に120回測定し、TTFT中央値0.003990秒、生成速度239.082 token/sでした。EX-word整数runtimeでは、0.024184 GHzのSH-4A-class CPU上でTTFT中央値23.711秒、生成速度0.52–0.55 token/sでした。
188
+
189
+ 用途は、0.01B未満の言語モデル、組込み推論、量子化、整数runtimeの研究です。汎用的な質問応答、長文処理、専門判断、最新情報の取得を目的としたモデルではありません。
190
+
191
+ コード、重み、付属データはApache License 2.0で公開します。
192
+
193
+ ## Citation
194
+
195
+ ```bibtex
196
+ @software{toto_exllm_2026,
197
+ author = {ToTo},
198
+ title = {EXLLM-0.005B-Instruct},
199
+ year = {2026},
200
+ url = {https://huggingface.co/ToTo-40417/EXLLM}
201
+ }
202
+ ```
benchmarks/rtx3060-cuda-robust-20260925.json ADDED
@@ -0,0 +1,1266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "exllm-benchmark-robust-v1",
3
+ "checkpoint": "EXLLM-v1.1-5m-release3.pt",
4
+ "parameters": 5377824,
5
+ "torch": "2.11.0+cu130",
6
+ "load_seconds": 0.4645,
7
+ "gpu": "NVIDIA GeForce RTX 3060",
8
+ "warmup_runs": 40,
9
+ "measured_runs": 120,
10
+ "first_warmup": {
11
+ "prompt": "こんにちは",
12
+ "input_tokens": 8,
13
+ "output_tokens": 24,
14
+ "ttft_ms": 193.056,
15
+ "total_ms": 304.518,
16
+ "decode_tokens_per_second": 206.348,
17
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
18
+ "bad_text": false
19
+ },
20
+ "last_warmup": {
21
+ "prompt": "オフラインとは何ですか?",
22
+ "input_tokens": 15,
23
+ "output_tokens": 14,
24
+ "ttft_ms": 4.024,
25
+ "total_ms": 58.565,
26
+ "decode_tokens_per_second": 238.355,
27
+ "text": "ウェブ検索はできません。",
28
+ "bad_text": false
29
+ },
30
+ "raw": {
31
+ "median_ttft_ms": 3.99,
32
+ "median_total_ms": 79.589,
33
+ "median_decode_tokens_per_second": 239.082
34
+ },
35
+ "tukey_1_5_iqr": {
36
+ "ttft": {
37
+ "kept": 120,
38
+ "removed": 0,
39
+ "fence": [
40
+ 3.885874999999999,
41
+ 4.0908750000000005
42
+ ],
43
+ "median_ms": 3.99
44
+ },
45
+ "total": {
46
+ "kept": 120,
47
+ "removed": 0,
48
+ "fence": [
49
+ -29.11774999999998,
50
+ 194.55624999999998
51
+ ],
52
+ "median_ms": 79.589
53
+ },
54
+ "decode": {
55
+ "kept": 120,
56
+ "removed": 0,
57
+ "fence": [
58
+ 220.07150000000001,
59
+ 252.1735
60
+ ],
61
+ "median_tokens_per_second": 239.082
62
+ }
63
+ },
64
+ "runs": [
65
+ {
66
+ "prompt": "こんにちは",
67
+ "input_tokens": 8,
68
+ "output_tokens": 24,
69
+ "ttft_ms": 3.931,
70
+ "total_ms": 99.869,
71
+ "decode_tokens_per_second": 239.739,
72
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
73
+ "bad_text": false
74
+ },
75
+ {
76
+ "prompt": "あなたは何というモデルですか?",
77
+ "input_tokens": 18,
78
+ "output_tokens": 10,
79
+ "ttft_ms": 4.02,
80
+ "total_ms": 44.262,
81
+ "decode_tokens_per_second": 223.649,
82
+ "text": "私はEXLLMです。",
83
+ "bad_text": false
84
+ },
85
+ {
86
+ "prompt": "RAMとは何ですか?",
87
+ "input_tokens": 13,
88
+ "output_tokens": 34,
89
+ "ttft_ms": 3.969,
90
+ "total_ms": 140.375,
91
+ "decode_tokens_per_second": 241.924,
92
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
93
+ "bad_text": false
94
+ },
95
+ {
96
+ "prompt": "オフラインとは何ですか?",
97
+ "input_tokens": 15,
98
+ "output_tokens": 14,
99
+ "ttft_ms": 3.994,
100
+ "total_ms": 58.391,
101
+ "decode_tokens_per_second": 238.984,
102
+ "text": "ウェブ検索はできません。",
103
+ "bad_text": false
104
+ },
105
+ {
106
+ "prompt": "こんにちは",
107
+ "input_tokens": 8,
108
+ "output_tokens": 24,
109
+ "ttft_ms": 3.932,
110
+ "total_ms": 100.434,
111
+ "decode_tokens_per_second": 238.338,
112
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
113
+ "bad_text": false
114
+ },
115
+ {
116
+ "prompt": "あなたは何というモデルですか?",
117
+ "input_tokens": 18,
118
+ "output_tokens": 10,
119
+ "ttft_ms": 4.042,
120
+ "total_ms": 44.592,
121
+ "decode_tokens_per_second": 221.948,
122
+ "text": "私はEXLLMです。",
123
+ "bad_text": false
124
+ },
125
+ {
126
+ "prompt": "RAMとは何ですか?",
127
+ "input_tokens": 13,
128
+ "output_tokens": 34,
129
+ "ttft_ms": 3.999,
130
+ "total_ms": 140.552,
131
+ "decode_tokens_per_second": 241.665,
132
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
133
+ "bad_text": false
134
+ },
135
+ {
136
+ "prompt": "オフラインとは何ですか?",
137
+ "input_tokens": 15,
138
+ "output_tokens": 14,
139
+ "ttft_ms": 4.009,
140
+ "total_ms": 59.417,
141
+ "decode_tokens_per_second": 234.625,
142
+ "text": "ウェブ検索はできません。",
143
+ "bad_text": false
144
+ },
145
+ {
146
+ "prompt": "こんにちは",
147
+ "input_tokens": 8,
148
+ "output_tokens": 24,
149
+ "ttft_ms": 3.987,
150
+ "total_ms": 100.517,
151
+ "decode_tokens_per_second": 238.268,
152
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
153
+ "bad_text": false
154
+ },
155
+ {
156
+ "prompt": "あなたは何というモデルですか?",
157
+ "input_tokens": 18,
158
+ "output_tokens": 10,
159
+ "ttft_ms": 4.055,
160
+ "total_ms": 44.662,
161
+ "decode_tokens_per_second": 221.638,
162
+ "text": "私はEXLLMです。",
163
+ "bad_text": false
164
+ },
165
+ {
166
+ "prompt": "RAMとは何ですか?",
167
+ "input_tokens": 13,
168
+ "output_tokens": 34,
169
+ "ttft_ms": 4.013,
170
+ "total_ms": 142.344,
171
+ "decode_tokens_per_second": 238.558,
172
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
173
+ "bad_text": false
174
+ },
175
+ {
176
+ "prompt": "オフラインとは何ですか?",
177
+ "input_tokens": 15,
178
+ "output_tokens": 14,
179
+ "ttft_ms": 3.998,
180
+ "total_ms": 58.517,
181
+ "decode_tokens_per_second": 238.45,
182
+ "text": "ウェブ検索はできません。",
183
+ "bad_text": false
184
+ },
185
+ {
186
+ "prompt": "こんにちは",
187
+ "input_tokens": 8,
188
+ "output_tokens": 24,
189
+ "ttft_ms": 3.948,
190
+ "total_ms": 99.939,
191
+ "decode_tokens_per_second": 239.604,
192
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
193
+ "bad_text": false
194
+ },
195
+ {
196
+ "prompt": "あなたは何というモデルですか?",
197
+ "input_tokens": 18,
198
+ "output_tokens": 10,
199
+ "ttft_ms": 4.013,
200
+ "total_ms": 44.273,
201
+ "decode_tokens_per_second": 223.549,
202
+ "text": "私はEXLLMです。",
203
+ "bad_text": false
204
+ },
205
+ {
206
+ "prompt": "RAMとは何ですか?",
207
+ "input_tokens": 13,
208
+ "output_tokens": 34,
209
+ "ttft_ms": 3.977,
210
+ "total_ms": 140.612,
211
+ "decode_tokens_per_second": 241.518,
212
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
213
+ "bad_text": false
214
+ },
215
+ {
216
+ "prompt": "オフラインとは何ですか?",
217
+ "input_tokens": 15,
218
+ "output_tokens": 14,
219
+ "ttft_ms": 4.001,
220
+ "total_ms": 58.347,
221
+ "decode_tokens_per_second": 239.21,
222
+ "text": "ウェブ検索はできません。",
223
+ "bad_text": false
224
+ },
225
+ {
226
+ "prompt": "こんにちは",
227
+ "input_tokens": 8,
228
+ "output_tokens": 24,
229
+ "ttft_ms": 3.937,
230
+ "total_ms": 100.824,
231
+ "decode_tokens_per_second": 237.39,
232
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
233
+ "bad_text": false
234
+ },
235
+ {
236
+ "prompt": "あなたは何というモデルですか?",
237
+ "input_tokens": 18,
238
+ "output_tokens": 10,
239
+ "ttft_ms": 4.072,
240
+ "total_ms": 44.322,
241
+ "decode_tokens_per_second": 223.606,
242
+ "text": "私はEXLLMです。",
243
+ "bad_text": false
244
+ },
245
+ {
246
+ "prompt": "RAMとは何ですか?",
247
+ "input_tokens": 13,
248
+ "output_tokens": 34,
249
+ "ttft_ms": 3.982,
250
+ "total_ms": 140.555,
251
+ "decode_tokens_per_second": 241.629,
252
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
253
+ "bad_text": false
254
+ },
255
+ {
256
+ "prompt": "オフラインとは何ですか?",
257
+ "input_tokens": 15,
258
+ "output_tokens": 14,
259
+ "ttft_ms": 4.012,
260
+ "total_ms": 58.32,
261
+ "decode_tokens_per_second": 239.375,
262
+ "text": "ウェブ検索はできません。",
263
+ "bad_text": false
264
+ },
265
+ {
266
+ "prompt": "こんにちは",
267
+ "input_tokens": 8,
268
+ "output_tokens": 24,
269
+ "ttft_ms": 3.962,
270
+ "total_ms": 100.061,
271
+ "decode_tokens_per_second": 239.336,
272
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
273
+ "bad_text": false
274
+ },
275
+ {
276
+ "prompt": "あなたは何というモデルですか?",
277
+ "input_tokens": 18,
278
+ "output_tokens": 10,
279
+ "ttft_ms": 4.003,
280
+ "total_ms": 44.08,
281
+ "decode_tokens_per_second": 224.564,
282
+ "text": "私はEXLLMです。",
283
+ "bad_text": false
284
+ },
285
+ {
286
+ "prompt": "RAMとは何ですか?",
287
+ "input_tokens": 13,
288
+ "output_tokens": 34,
289
+ "ttft_ms": 3.956,
290
+ "total_ms": 140.53,
291
+ "decode_tokens_per_second": 241.628,
292
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
293
+ "bad_text": false
294
+ },
295
+ {
296
+ "prompt": "オフラインとは何ですか?",
297
+ "input_tokens": 15,
298
+ "output_tokens": 14,
299
+ "ttft_ms": 4.0,
300
+ "total_ms": 58.306,
301
+ "decode_tokens_per_second": 239.384,
302
+ "text": "ウェブ検索はできません。",
303
+ "bad_text": false
304
+ },
305
+ {
306
+ "prompt": "こんにちは",
307
+ "input_tokens": 8,
308
+ "output_tokens": 24,
309
+ "ttft_ms": 3.913,
310
+ "total_ms": 100.148,
311
+ "decode_tokens_per_second": 238.998,
312
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
313
+ "bad_text": false
314
+ },
315
+ {
316
+ "prompt": "あなたは何というモデルですか?",
317
+ "input_tokens": 18,
318
+ "output_tokens": 10,
319
+ "ttft_ms": 4.031,
320
+ "total_ms": 44.129,
321
+ "decode_tokens_per_second": 224.451,
322
+ "text": "私はEXLLMです。",
323
+ "bad_text": false
324
+ },
325
+ {
326
+ "prompt": "RAMとは何ですか?",
327
+ "input_tokens": 13,
328
+ "output_tokens": 34,
329
+ "ttft_ms": 3.98,
330
+ "total_ms": 140.593,
331
+ "decode_tokens_per_second": 241.558,
332
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
333
+ "bad_text": false
334
+ },
335
+ {
336
+ "prompt": "オフラインとは何ですか?",
337
+ "input_tokens": 15,
338
+ "output_tokens": 14,
339
+ "ttft_ms": 3.98,
340
+ "total_ms": 58.181,
341
+ "decode_tokens_per_second": 239.85,
342
+ "text": "ウェブ検索はできません。",
343
+ "bad_text": false
344
+ },
345
+ {
346
+ "prompt": "こんにちは",
347
+ "input_tokens": 8,
348
+ "output_tokens": 24,
349
+ "ttft_ms": 3.957,
350
+ "total_ms": 100.275,
351
+ "decode_tokens_per_second": 238.791,
352
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
353
+ "bad_text": false
354
+ },
355
+ {
356
+ "prompt": "あなたは何というモデルですか?",
357
+ "input_tokens": 18,
358
+ "output_tokens": 10,
359
+ "ttft_ms": 4.029,
360
+ "total_ms": 44.139,
361
+ "decode_tokens_per_second": 224.381,
362
+ "text": "私はEXLLMです。",
363
+ "bad_text": false
364
+ },
365
+ {
366
+ "prompt": "RAMとは何ですか?",
367
+ "input_tokens": 13,
368
+ "output_tokens": 34,
369
+ "ttft_ms": 3.963,
370
+ "total_ms": 140.51,
371
+ "decode_tokens_per_second": 241.675,
372
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
373
+ "bad_text": false
374
+ },
375
+ {
376
+ "prompt": "オフラインとは何ですか?",
377
+ "input_tokens": 15,
378
+ "output_tokens": 14,
379
+ "ttft_ms": 3.987,
380
+ "total_ms": 58.361,
381
+ "decode_tokens_per_second": 239.088,
382
+ "text": "ウェブ検索はできません。",
383
+ "bad_text": false
384
+ },
385
+ {
386
+ "prompt": "こんにちは",
387
+ "input_tokens": 8,
388
+ "output_tokens": 24,
389
+ "ttft_ms": 3.978,
390
+ "total_ms": 99.76,
391
+ "decode_tokens_per_second": 240.129,
392
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
393
+ "bad_text": false
394
+ },
395
+ {
396
+ "prompt": "あなたは何というモデルですか?",
397
+ "input_tokens": 18,
398
+ "output_tokens": 10,
399
+ "ttft_ms": 4.014,
400
+ "total_ms": 44.151,
401
+ "decode_tokens_per_second": 224.23,
402
+ "text": "私はEXLLMです。",
403
+ "bad_text": false
404
+ },
405
+ {
406
+ "prompt": "RAMとは何ですか?",
407
+ "input_tokens": 13,
408
+ "output_tokens": 34,
409
+ "ttft_ms": 3.964,
410
+ "total_ms": 140.742,
411
+ "decode_tokens_per_second": 241.266,
412
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
413
+ "bad_text": false
414
+ },
415
+ {
416
+ "prompt": "オフラインとは何ですか?",
417
+ "input_tokens": 15,
418
+ "output_tokens": 14,
419
+ "ttft_ms": 3.992,
420
+ "total_ms": 58.387,
421
+ "decode_tokens_per_second": 238.993,
422
+ "text": "ウェブ検索はできません。",
423
+ "bad_text": false
424
+ },
425
+ {
426
+ "prompt": "こんにちは",
427
+ "input_tokens": 8,
428
+ "output_tokens": 24,
429
+ "ttft_ms": 3.939,
430
+ "total_ms": 99.956,
431
+ "decode_tokens_per_second": 239.54,
432
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
433
+ "bad_text": false
434
+ },
435
+ {
436
+ "prompt": "あなたは何というモデルですか?",
437
+ "input_tokens": 18,
438
+ "output_tokens": 10,
439
+ "ttft_ms": 4.034,
440
+ "total_ms": 44.249,
441
+ "decode_tokens_per_second": 223.797,
442
+ "text": "私はEXLLMです。",
443
+ "bad_text": false
444
+ },
445
+ {
446
+ "prompt": "RAMとは何ですか?",
447
+ "input_tokens": 13,
448
+ "output_tokens": 34,
449
+ "ttft_ms": 3.989,
450
+ "total_ms": 140.897,
451
+ "decode_tokens_per_second": 241.037,
452
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
453
+ "bad_text": false
454
+ },
455
+ {
456
+ "prompt": "オフラインとは何ですか?",
457
+ "input_tokens": 15,
458
+ "output_tokens": 14,
459
+ "ttft_ms": 4.012,
460
+ "total_ms": 58.699,
461
+ "decode_tokens_per_second": 237.718,
462
+ "text": "ウェブ検索はできません。",
463
+ "bad_text": false
464
+ },
465
+ {
466
+ "prompt": "こんにちは",
467
+ "input_tokens": 8,
468
+ "output_tokens": 24,
469
+ "ttft_ms": 3.965,
470
+ "total_ms": 100.169,
471
+ "decode_tokens_per_second": 239.075,
472
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
473
+ "bad_text": false
474
+ },
475
+ {
476
+ "prompt": "あなたは何というモデルですか?",
477
+ "input_tokens": 18,
478
+ "output_tokens": 10,
479
+ "ttft_ms": 4.06,
480
+ "total_ms": 44.561,
481
+ "decode_tokens_per_second": 222.22,
482
+ "text": "私はEXLLMです。",
483
+ "bad_text": false
484
+ },
485
+ {
486
+ "prompt": "RAMとは何ですか?",
487
+ "input_tokens": 13,
488
+ "output_tokens": 34,
489
+ "ttft_ms": 3.973,
490
+ "total_ms": 140.606,
491
+ "decode_tokens_per_second": 241.523,
492
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
493
+ "bad_text": false
494
+ },
495
+ {
496
+ "prompt": "オフラインとは何ですか?",
497
+ "input_tokens": 15,
498
+ "output_tokens": 14,
499
+ "ttft_ms": 3.971,
500
+ "total_ms": 58.316,
501
+ "decode_tokens_per_second": 239.21,
502
+ "text": "ウェブ検索はできません。",
503
+ "bad_text": false
504
+ },
505
+ {
506
+ "prompt": "こんにちは",
507
+ "input_tokens": 8,
508
+ "output_tokens": 24,
509
+ "ttft_ms": 3.92,
510
+ "total_ms": 100.053,
511
+ "decode_tokens_per_second": 239.253,
512
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
513
+ "bad_text": false
514
+ },
515
+ {
516
+ "prompt": "あなたは何というモデルですか?",
517
+ "input_tokens": 18,
518
+ "output_tokens": 10,
519
+ "ttft_ms": 4.014,
520
+ "total_ms": 44.205,
521
+ "decode_tokens_per_second": 223.93,
522
+ "text": "私はEXLLMです。",
523
+ "bad_text": false
524
+ },
525
+ {
526
+ "prompt": "RAMとは何ですか?",
527
+ "input_tokens": 13,
528
+ "output_tokens": 34,
529
+ "ttft_ms": 3.99,
530
+ "total_ms": 140.278,
531
+ "decode_tokens_per_second": 242.134,
532
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
533
+ "bad_text": false
534
+ },
535
+ {
536
+ "prompt": "オフラインとは何ですか?",
537
+ "input_tokens": 15,
538
+ "output_tokens": 14,
539
+ "ttft_ms": 3.969,
540
+ "total_ms": 58.101,
541
+ "decode_tokens_per_second": 240.154,
542
+ "text": "ウェブ検索はできません。",
543
+ "bad_text": false
544
+ },
545
+ {
546
+ "prompt": "こんにちは",
547
+ "input_tokens": 8,
548
+ "output_tokens": 24,
549
+ "ttft_ms": 3.928,
550
+ "total_ms": 99.947,
551
+ "decode_tokens_per_second": 239.534,
552
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
553
+ "bad_text": false
554
+ },
555
+ {
556
+ "prompt": "あなたは何というモデルですか?",
557
+ "input_tokens": 18,
558
+ "output_tokens": 10,
559
+ "ttft_ms": 4.031,
560
+ "total_ms": 44.152,
561
+ "decode_tokens_per_second": 224.321,
562
+ "text": "私はEXLLMです。",
563
+ "bad_text": false
564
+ },
565
+ {
566
+ "prompt": "RAMとは何ですか?",
567
+ "input_tokens": 13,
568
+ "output_tokens": 34,
569
+ "ttft_ms": 4.001,
570
+ "total_ms": 140.242,
571
+ "decode_tokens_per_second": 242.218,
572
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
573
+ "bad_text": false
574
+ },
575
+ {
576
+ "prompt": "オフラインとは何ですか?",
577
+ "input_tokens": 15,
578
+ "output_tokens": 14,
579
+ "ttft_ms": 3.984,
580
+ "total_ms": 58.557,
581
+ "decode_tokens_per_second": 238.215,
582
+ "text": "ウェブ検索はできません。",
583
+ "bad_text": false
584
+ },
585
+ {
586
+ "prompt": "こんにちは",
587
+ "input_tokens": 8,
588
+ "output_tokens": 24,
589
+ "ttft_ms": 3.913,
590
+ "total_ms": 100.087,
591
+ "decode_tokens_per_second": 239.151,
592
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
593
+ "bad_text": false
594
+ },
595
+ {
596
+ "prompt": "あなたは何というモデルですか?",
597
+ "input_tokens": 18,
598
+ "output_tokens": 10,
599
+ "ttft_ms": 4.052,
600
+ "total_ms": 44.268,
601
+ "decode_tokens_per_second": 223.79,
602
+ "text": "私はEXLLMです。",
603
+ "bad_text": false
604
+ },
605
+ {
606
+ "prompt": "RAMとは何ですか?",
607
+ "input_tokens": 13,
608
+ "output_tokens": 34,
609
+ "ttft_ms": 3.99,
610
+ "total_ms": 140.926,
611
+ "decode_tokens_per_second": 240.988,
612
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
613
+ "bad_text": false
614
+ },
615
+ {
616
+ "prompt": "オフラインとは何ですか?",
617
+ "input_tokens": 15,
618
+ "output_tokens": 14,
619
+ "ttft_ms": 3.996,
620
+ "total_ms": 58.353,
621
+ "decode_tokens_per_second": 239.16,
622
+ "text": "ウェブ検索はできません。",
623
+ "bad_text": false
624
+ },
625
+ {
626
+ "prompt": "こんにちは",
627
+ "input_tokens": 8,
628
+ "output_tokens": 24,
629
+ "ttft_ms": 3.968,
630
+ "total_ms": 100.327,
631
+ "decode_tokens_per_second": 238.692,
632
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
633
+ "bad_text": false
634
+ },
635
+ {
636
+ "prompt": "あなたは何というモデルですか?",
637
+ "input_tokens": 18,
638
+ "output_tokens": 10,
639
+ "ttft_ms": 4.044,
640
+ "total_ms": 44.639,
641
+ "decode_tokens_per_second": 221.698,
642
+ "text": "私はEXLLMです。",
643
+ "bad_text": false
644
+ },
645
+ {
646
+ "prompt": "RAMとは何ですか?",
647
+ "input_tokens": 13,
648
+ "output_tokens": 34,
649
+ "ttft_ms": 3.988,
650
+ "total_ms": 140.54,
651
+ "decode_tokens_per_second": 241.666,
652
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
653
+ "bad_text": false
654
+ },
655
+ {
656
+ "prompt": "オフラインとは何ですか?",
657
+ "input_tokens": 15,
658
+ "output_tokens": 14,
659
+ "ttft_ms": 4.014,
660
+ "total_ms": 58.378,
661
+ "decode_tokens_per_second": 239.129,
662
+ "text": "ウェブ検索はできません。",
663
+ "bad_text": false
664
+ },
665
+ {
666
+ "prompt": "こんにちは",
667
+ "input_tokens": 8,
668
+ "output_tokens": 24,
669
+ "ttft_ms": 3.933,
670
+ "total_ms": 100.002,
671
+ "decode_tokens_per_second": 239.412,
672
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
673
+ "bad_text": false
674
+ },
675
+ {
676
+ "prompt": "あなたは何というモデルですか?",
677
+ "input_tokens": 18,
678
+ "output_tokens": 10,
679
+ "ttft_ms": 4.057,
680
+ "total_ms": 44.258,
681
+ "decode_tokens_per_second": 223.87,
682
+ "text": "私はEXLLMです。",
683
+ "bad_text": false
684
+ },
685
+ {
686
+ "prompt": "RAMとは何ですか?",
687
+ "input_tokens": 13,
688
+ "output_tokens": 34,
689
+ "ttft_ms": 3.949,
690
+ "total_ms": 140.897,
691
+ "decode_tokens_per_second": 240.968,
692
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
693
+ "bad_text": false
694
+ },
695
+ {
696
+ "prompt": "オフラインとは何ですか?",
697
+ "input_tokens": 15,
698
+ "output_tokens": 14,
699
+ "ttft_ms": 3.984,
700
+ "total_ms": 58.534,
701
+ "decode_tokens_per_second": 238.31,
702
+ "text": "ウェブ検索はできません。",
703
+ "bad_text": false
704
+ },
705
+ {
706
+ "prompt": "こんにちは",
707
+ "input_tokens": 8,
708
+ "output_tokens": 24,
709
+ "ttft_ms": 3.958,
710
+ "total_ms": 100.283,
711
+ "decode_tokens_per_second": 238.776,
712
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
713
+ "bad_text": false
714
+ },
715
+ {
716
+ "prompt": "あなたは何というモデルですか?",
717
+ "input_tokens": 18,
718
+ "output_tokens": 10,
719
+ "ttft_ms": 4.064,
720
+ "total_ms": 44.48,
721
+ "decode_tokens_per_second": 222.68,
722
+ "text": "私はEXLLMです。",
723
+ "bad_text": false
724
+ },
725
+ {
726
+ "prompt": "RAMとは何ですか?",
727
+ "input_tokens": 13,
728
+ "output_tokens": 34,
729
+ "ttft_ms": 3.971,
730
+ "total_ms": 141.188,
731
+ "decode_tokens_per_second": 240.496,
732
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
733
+ "bad_text": false
734
+ },
735
+ {
736
+ "prompt": "オフラインとは何ですか?",
737
+ "input_tokens": 15,
738
+ "output_tokens": 14,
739
+ "ttft_ms": 4.003,
740
+ "total_ms": 58.531,
741
+ "decode_tokens_per_second": 238.408,
742
+ "text": "ウェブ検索はできません。",
743
+ "bad_text": false
744
+ },
745
+ {
746
+ "prompt": "こんにちは",
747
+ "input_tokens": 8,
748
+ "output_tokens": 24,
749
+ "ttft_ms": 3.951,
750
+ "total_ms": 100.5,
751
+ "decode_tokens_per_second": 238.222,
752
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
753
+ "bad_text": false
754
+ },
755
+ {
756
+ "prompt": "あなたは何というモデルですか?",
757
+ "input_tokens": 18,
758
+ "output_tokens": 10,
759
+ "ttft_ms": 4.053,
760
+ "total_ms": 44.364,
761
+ "decode_tokens_per_second": 223.263,
762
+ "text": "私はEXLLMです。",
763
+ "bad_text": false
764
+ },
765
+ {
766
+ "prompt": "RAMとは何ですか?",
767
+ "input_tokens": 13,
768
+ "output_tokens": 34,
769
+ "ttft_ms": 3.992,
770
+ "total_ms": 140.938,
771
+ "decode_tokens_per_second": 240.97,
772
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
773
+ "bad_text": false
774
+ },
775
+ {
776
+ "prompt": "オフラインとは何ですか?",
777
+ "input_tokens": 15,
778
+ "output_tokens": 14,
779
+ "ttft_ms": 3.988,
780
+ "total_ms": 58.44,
781
+ "decode_tokens_per_second": 238.741,
782
+ "text": "ウェブ検索はできません。",
783
+ "bad_text": false
784
+ },
785
+ {
786
+ "prompt": "こんにちは",
787
+ "input_tokens": 8,
788
+ "output_tokens": 24,
789
+ "ttft_ms": 3.942,
790
+ "total_ms": 100.19,
791
+ "decode_tokens_per_second": 238.966,
792
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
793
+ "bad_text": false
794
+ },
795
+ {
796
+ "prompt": "あなたは何というモデルですか?",
797
+ "input_tokens": 18,
798
+ "output_tokens": 10,
799
+ "ttft_ms": 4.039,
800
+ "total_ms": 44.427,
801
+ "decode_tokens_per_second": 222.84,
802
+ "text": "私はEXLLMです。",
803
+ "bad_text": false
804
+ },
805
+ {
806
+ "prompt": "RAMとは何ですか?",
807
+ "input_tokens": 13,
808
+ "output_tokens": 34,
809
+ "ttft_ms": 3.995,
810
+ "total_ms": 140.975,
811
+ "decode_tokens_per_second": 240.912,
812
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
813
+ "bad_text": false
814
+ },
815
+ {
816
+ "prompt": "オフラインとは何ですか?",
817
+ "input_tokens": 15,
818
+ "output_tokens": 14,
819
+ "ttft_ms": 3.983,
820
+ "total_ms": 58.464,
821
+ "decode_tokens_per_second": 238.615,
822
+ "text": "ウェブ検索はできません。",
823
+ "bad_text": false
824
+ },
825
+ {
826
+ "prompt": "こんにちは",
827
+ "input_tokens": 8,
828
+ "output_tokens": 24,
829
+ "ttft_ms": 3.949,
830
+ "total_ms": 100.054,
831
+ "decode_tokens_per_second": 239.322,
832
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
833
+ "bad_text": false
834
+ },
835
+ {
836
+ "prompt": "あなたは何というモデルですか?",
837
+ "input_tokens": 18,
838
+ "output_tokens": 10,
839
+ "ttft_ms": 4.072,
840
+ "total_ms": 44.404,
841
+ "decode_tokens_per_second": 223.146,
842
+ "text": "私はEXLLMです。",
843
+ "bad_text": false
844
+ },
845
+ {
846
+ "prompt": "RAMとは何ですか?",
847
+ "input_tokens": 13,
848
+ "output_tokens": 34,
849
+ "ttft_ms": 3.985,
850
+ "total_ms": 140.609,
851
+ "decode_tokens_per_second": 241.538,
852
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
853
+ "bad_text": false
854
+ },
855
+ {
856
+ "prompt": "オフラインとは何ですか?",
857
+ "input_tokens": 15,
858
+ "output_tokens": 14,
859
+ "ttft_ms": 4.011,
860
+ "total_ms": 58.503,
861
+ "decode_tokens_per_second": 238.568,
862
+ "text": "ウェブ検索はできません。",
863
+ "bad_text": false
864
+ },
865
+ {
866
+ "prompt": "こんにちは",
867
+ "input_tokens": 8,
868
+ "output_tokens": 24,
869
+ "ttft_ms": 3.94,
870
+ "total_ms": 100.041,
871
+ "decode_tokens_per_second": 239.331,
872
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
873
+ "bad_text": false
874
+ },
875
+ {
876
+ "prompt": "あなたは何というモデルですか?",
877
+ "input_tokens": 18,
878
+ "output_tokens": 10,
879
+ "ttft_ms": 4.021,
880
+ "total_ms": 44.183,
881
+ "decode_tokens_per_second": 224.091,
882
+ "text": "私はEXLLMです。",
883
+ "bad_text": false
884
+ },
885
+ {
886
+ "prompt": "RAMとは何ですか?",
887
+ "input_tokens": 13,
888
+ "output_tokens": 34,
889
+ "ttft_ms": 3.954,
890
+ "total_ms": 140.591,
891
+ "decode_tokens_per_second": 241.516,
892
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
893
+ "bad_text": false
894
+ },
895
+ {
896
+ "prompt": "オフラインとは何ですか?",
897
+ "input_tokens": 15,
898
+ "output_tokens": 14,
899
+ "ttft_ms": 3.963,
900
+ "total_ms": 58.28,
901
+ "decode_tokens_per_second": 239.335,
902
+ "text": "ウェブ検索はできません。",
903
+ "bad_text": false
904
+ },
905
+ {
906
+ "prompt": "こんにちは",
907
+ "input_tokens": 8,
908
+ "output_tokens": 24,
909
+ "ttft_ms": 3.95,
910
+ "total_ms": 100.182,
911
+ "decode_tokens_per_second": 239.004,
912
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
913
+ "bad_text": false
914
+ },
915
+ {
916
+ "prompt": "あなたは何というモデルですか?",
917
+ "input_tokens": 18,
918
+ "output_tokens": 10,
919
+ "ttft_ms": 4.053,
920
+ "total_ms": 44.243,
921
+ "decode_tokens_per_second": 223.938,
922
+ "text": "私はEXLLMです。",
923
+ "bad_text": false
924
+ },
925
+ {
926
+ "prompt": "RAMとは何ですか?",
927
+ "input_tokens": 13,
928
+ "output_tokens": 34,
929
+ "ttft_ms": 3.978,
930
+ "total_ms": 141.061,
931
+ "decode_tokens_per_second": 240.73,
932
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
933
+ "bad_text": false
934
+ },
935
+ {
936
+ "prompt": "オフラインとは何ですか?",
937
+ "input_tokens": 15,
938
+ "output_tokens": 14,
939
+ "ttft_ms": 4.001,
940
+ "total_ms": 58.506,
941
+ "decode_tokens_per_second": 238.511,
942
+ "text": "ウェブ検索はできません。",
943
+ "bad_text": false
944
+ },
945
+ {
946
+ "prompt": "こんにちは",
947
+ "input_tokens": 8,
948
+ "output_tokens": 24,
949
+ "ttft_ms": 3.95,
950
+ "total_ms": 100.129,
951
+ "decode_tokens_per_second": 239.138,
952
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
953
+ "bad_text": false
954
+ },
955
+ {
956
+ "prompt": "あなたは何というモデルですか?",
957
+ "input_tokens": 18,
958
+ "output_tokens": 10,
959
+ "ttft_ms": 4.047,
960
+ "total_ms": 44.332,
961
+ "decode_tokens_per_second": 223.404,
962
+ "text": "私はEXLLMです。",
963
+ "bad_text": false
964
+ },
965
+ {
966
+ "prompt": "RAMとは何ですか?",
967
+ "input_tokens": 13,
968
+ "output_tokens": 34,
969
+ "ttft_ms": 3.975,
970
+ "total_ms": 140.585,
971
+ "decode_tokens_per_second": 241.563,
972
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
973
+ "bad_text": false
974
+ },
975
+ {
976
+ "prompt": "オフラインとは何ですか?",
977
+ "input_tokens": 15,
978
+ "output_tokens": 14,
979
+ "ttft_ms": 3.979,
980
+ "total_ms": 58.304,
981
+ "decode_tokens_per_second": 239.301,
982
+ "text": "ウェブ検索はできません。",
983
+ "bad_text": false
984
+ },
985
+ {
986
+ "prompt": "こんにちは",
987
+ "input_tokens": 8,
988
+ "output_tokens": 24,
989
+ "ttft_ms": 3.922,
990
+ "total_ms": 100.302,
991
+ "decode_tokens_per_second": 238.64,
992
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
993
+ "bad_text": false
994
+ },
995
+ {
996
+ "prompt": "あなたは何というモデルですか?",
997
+ "input_tokens": 18,
998
+ "output_tokens": 10,
999
+ "ttft_ms": 4.042,
1000
+ "total_ms": 44.33,
1001
+ "decode_tokens_per_second": 223.393,
1002
+ "text": "私はEXLLMです。",
1003
+ "bad_text": false
1004
+ },
1005
+ {
1006
+ "prompt": "RAMとは何ですか?",
1007
+ "input_tokens": 13,
1008
+ "output_tokens": 34,
1009
+ "ttft_ms": 3.997,
1010
+ "total_ms": 140.985,
1011
+ "decode_tokens_per_second": 240.896,
1012
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
1013
+ "bad_text": false
1014
+ },
1015
+ {
1016
+ "prompt": "オフラインとは何ですか?",
1017
+ "input_tokens": 15,
1018
+ "output_tokens": 14,
1019
+ "ttft_ms": 4.006,
1020
+ "total_ms": 58.363,
1021
+ "decode_tokens_per_second": 239.157,
1022
+ "text": "ウェブ検索はできません。",
1023
+ "bad_text": false
1024
+ },
1025
+ {
1026
+ "prompt": "こんにちは",
1027
+ "input_tokens": 8,
1028
+ "output_tokens": 24,
1029
+ "ttft_ms": 3.94,
1030
+ "total_ms": 100.091,
1031
+ "decode_tokens_per_second": 239.208,
1032
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
1033
+ "bad_text": false
1034
+ },
1035
+ {
1036
+ "prompt": "あなたは何というモデルですか?",
1037
+ "input_tokens": 18,
1038
+ "output_tokens": 10,
1039
+ "ttft_ms": 4.051,
1040
+ "total_ms": 44.265,
1041
+ "decode_tokens_per_second": 223.8,
1042
+ "text": "私はEXLLMです。",
1043
+ "bad_text": false
1044
+ },
1045
+ {
1046
+ "prompt": "RAMとは何ですか?",
1047
+ "input_tokens": 13,
1048
+ "output_tokens": 34,
1049
+ "ttft_ms": 3.956,
1050
+ "total_ms": 140.628,
1051
+ "decode_tokens_per_second": 241.454,
1052
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
1053
+ "bad_text": false
1054
+ },
1055
+ {
1056
+ "prompt": "オフラインとは何ですか?",
1057
+ "input_tokens": 15,
1058
+ "output_tokens": 14,
1059
+ "ttft_ms": 3.997,
1060
+ "total_ms": 58.529,
1061
+ "decode_tokens_per_second": 238.393,
1062
+ "text": "ウェブ検索はできません。",
1063
+ "bad_text": false
1064
+ },
1065
+ {
1066
+ "prompt": "こんにちは",
1067
+ "input_tokens": 8,
1068
+ "output_tokens": 24,
1069
+ "ttft_ms": 3.94,
1070
+ "total_ms": 100.004,
1071
+ "decode_tokens_per_second": 239.425,
1072
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
1073
+ "bad_text": false
1074
+ },
1075
+ {
1076
+ "prompt": "あなたは何というモデルですか?",
1077
+ "input_tokens": 18,
1078
+ "output_tokens": 10,
1079
+ "ttft_ms": 4.042,
1080
+ "total_ms": 44.257,
1081
+ "decode_tokens_per_second": 223.797,
1082
+ "text": "私はEXLLMです。",
1083
+ "bad_text": false
1084
+ },
1085
+ {
1086
+ "prompt": "RAMとは何ですか?",
1087
+ "input_tokens": 13,
1088
+ "output_tokens": 34,
1089
+ "ttft_ms": 3.996,
1090
+ "total_ms": 140.957,
1091
+ "decode_tokens_per_second": 240.946,
1092
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
1093
+ "bad_text": false
1094
+ },
1095
+ {
1096
+ "prompt": "オフラインとは何ですか?",
1097
+ "input_tokens": 15,
1098
+ "output_tokens": 14,
1099
+ "ttft_ms": 4.008,
1100
+ "total_ms": 58.759,
1101
+ "decode_tokens_per_second": 237.439,
1102
+ "text": "ウェブ検索はできません。",
1103
+ "bad_text": false
1104
+ },
1105
+ {
1106
+ "prompt": "こんにちは",
1107
+ "input_tokens": 8,
1108
+ "output_tokens": 24,
1109
+ "ttft_ms": 3.953,
1110
+ "total_ms": 100.107,
1111
+ "decode_tokens_per_second": 239.201,
1112
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
1113
+ "bad_text": false
1114
+ },
1115
+ {
1116
+ "prompt": "あなたは何というモデルですか?",
1117
+ "input_tokens": 18,
1118
+ "output_tokens": 10,
1119
+ "ttft_ms": 4.014,
1120
+ "total_ms": 44.313,
1121
+ "decode_tokens_per_second": 223.331,
1122
+ "text": "私はEXLLMです。",
1123
+ "bad_text": false
1124
+ },
1125
+ {
1126
+ "prompt": "RAMとは何ですか?",
1127
+ "input_tokens": 13,
1128
+ "output_tokens": 34,
1129
+ "ttft_ms": 4.014,
1130
+ "total_ms": 141.071,
1131
+ "decode_tokens_per_second": 240.776,
1132
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
1133
+ "bad_text": false
1134
+ },
1135
+ {
1136
+ "prompt": "オフラインとは何ですか?",
1137
+ "input_tokens": 15,
1138
+ "output_tokens": 14,
1139
+ "ttft_ms": 4.004,
1140
+ "total_ms": 58.664,
1141
+ "decode_tokens_per_second": 237.834,
1142
+ "text": "ウェブ検索はできません。",
1143
+ "bad_text": false
1144
+ },
1145
+ {
1146
+ "prompt": "こんにち��",
1147
+ "input_tokens": 8,
1148
+ "output_tokens": 24,
1149
+ "ttft_ms": 3.924,
1150
+ "total_ms": 99.978,
1151
+ "decode_tokens_per_second": 239.449,
1152
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
1153
+ "bad_text": false
1154
+ },
1155
+ {
1156
+ "prompt": "あなたは何というモデルですか?",
1157
+ "input_tokens": 18,
1158
+ "output_tokens": 10,
1159
+ "ttft_ms": 4.027,
1160
+ "total_ms": 44.737,
1161
+ "decode_tokens_per_second": 221.078,
1162
+ "text": "私はEXLLMです。",
1163
+ "bad_text": false
1164
+ },
1165
+ {
1166
+ "prompt": "RAMとは何ですか?",
1167
+ "input_tokens": 13,
1168
+ "output_tokens": 34,
1169
+ "ttft_ms": 4.052,
1170
+ "total_ms": 140.769,
1171
+ "decode_tokens_per_second": 241.375,
1172
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
1173
+ "bad_text": false
1174
+ },
1175
+ {
1176
+ "prompt": "オフラインとは何ですか?",
1177
+ "input_tokens": 15,
1178
+ "output_tokens": 14,
1179
+ "ttft_ms": 3.98,
1180
+ "total_ms": 58.193,
1181
+ "decode_tokens_per_second": 239.793,
1182
+ "text": "ウェブ検索はできません。",
1183
+ "bad_text": false
1184
+ },
1185
+ {
1186
+ "prompt": "こんにちは",
1187
+ "input_tokens": 8,
1188
+ "output_tokens": 24,
1189
+ "ttft_ms": 3.928,
1190
+ "total_ms": 99.848,
1191
+ "decode_tokens_per_second": 239.784,
1192
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
1193
+ "bad_text": false
1194
+ },
1195
+ {
1196
+ "prompt": "あなたは何というモデルですか?",
1197
+ "input_tokens": 18,
1198
+ "output_tokens": 10,
1199
+ "ttft_ms": 4.009,
1200
+ "total_ms": 44.317,
1201
+ "decode_tokens_per_second": 223.281,
1202
+ "text": "私はEXLLMです。",
1203
+ "bad_text": false
1204
+ },
1205
+ {
1206
+ "prompt": "RAMとは何ですか?",
1207
+ "input_tokens": 13,
1208
+ "output_tokens": 34,
1209
+ "ttft_ms": 3.992,
1210
+ "total_ms": 140.695,
1211
+ "decode_tokens_per_second": 241.4,
1212
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
1213
+ "bad_text": false
1214
+ },
1215
+ {
1216
+ "prompt": "オフラインとは何ですか?",
1217
+ "input_tokens": 15,
1218
+ "output_tokens": 14,
1219
+ "ttft_ms": 4.022,
1220
+ "total_ms": 58.849,
1221
+ "decode_tokens_per_second": 237.11,
1222
+ "text": "ウェブ検索はできません。",
1223
+ "bad_text": false
1224
+ },
1225
+ {
1226
+ "prompt": "こんにちは",
1227
+ "input_tokens": 8,
1228
+ "output_tokens": 24,
1229
+ "ttft_ms": 3.957,
1230
+ "total_ms": 100.025,
1231
+ "decode_tokens_per_second": 239.414,
1232
+ "text": "こんにちは。ことばの意味や簡単な質問ならどうぞ。",
1233
+ "bad_text": false
1234
+ },
1235
+ {
1236
+ "prompt": "あなたは何というモデルですか?",
1237
+ "input_tokens": 18,
1238
+ "output_tokens": 10,
1239
+ "ttft_ms": 4.045,
1240
+ "total_ms": 44.274,
1241
+ "decode_tokens_per_second": 223.722,
1242
+ "text": "私はEXLLMです。",
1243
+ "bad_text": false
1244
+ },
1245
+ {
1246
+ "prompt": "RAMとは何ですか?",
1247
+ "input_tokens": 13,
1248
+ "output_tokens": 34,
1249
+ "ttft_ms": 3.978,
1250
+ "total_ms": 140.529,
1251
+ "decode_tokens_per_second": 241.669,
1252
+ "text": "RAMは、処理中のデータやプログラムを一時的に保持する記憶装置です。",
1253
+ "bad_text": false
1254
+ },
1255
+ {
1256
+ "prompt": "オフラインとは何ですか?",
1257
+ "input_tokens": 15,
1258
+ "output_tokens": 14,
1259
+ "ttft_ms": 4.028,
1260
+ "total_ms": 58.501,
1261
+ "decode_tokens_per_second": 238.652,
1262
+ "text": "ウェブ検索はできません。",
1263
+ "bad_text": false
1264
+ }
1265
+ ]
1266
+ }
chat.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ import argparse, torch
3
+ from src.loader import load_release_model
4
+ from src.runtime import answer
5
+
6
+ def main():
7
+ ap=argparse.ArgumentParser(description='EXLLM v1.0.0 reference chat runtime')
8
+ ap.add_argument('--temperature',type=float,default=0.0,help='0 for deterministic; e.g. 0.55 for sampling')
9
+ ap.add_argument('--top-k',type=int,default=8)
10
+ ap.add_argument('--threads',type=int,default=4)
11
+ ap.add_argument('prompt',nargs='*')
12
+ a=ap.parse_args(); torch.set_num_threads(max(1,a.threads))
13
+ m,t=load_release_model()
14
+ if a.prompt:
15
+ print(answer(m,t,' '.join(a.prompt),temperature=a.temperature,top_k=a.top_k)); return
16
+ print('EXLLM v1.0.0 / 終了: /exit')
17
+ while True:
18
+ try:q=input('> ')
19
+ except (EOFError,KeyboardInterrupt): break
20
+ if q.strip() in ('/exit','/quit'): break
21
+ print(answer(m,t,q,temperature=a.temperature,top_k=a.top_k))
22
+ if __name__=='__main__': main()
config-v1.1-5m.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "vocab_size": 868,
3
+ "max_seq_len": 128,
4
+ "d_model": 288,
5
+ "n_layers": 6,
6
+ "n_heads": 9,
7
+ "d_ff": 896,
8
+ "rms_eps": 1e-05
9
+ }
config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "vocab_size": 868,
3
+ "max_seq_len": 128,
4
+ "d_model": 288,
5
+ "n_layers": 6,
6
+ "n_heads": 9,
7
+ "d_ff": 896,
8
+ "rms_eps": 1e-05
9
+ }
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ torch>=2.1
2
+ numpy>=1.24
src/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from .model import *
src/infer.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json, math
2
+ from pathlib import Path
3
+ import torch
4
+ from .model import EXLLM,EXLLMConfig
5
+ from .tokenizer import HybridTokenizer,UTF8State,normalize_text
6
+
7
+ def load_model(ckpt='weights/EXLLM-v1.0-train.pt'):
8
+ tok=HybridTokenizer.load('tokenizer.json'); c=torch.load(ckpt,map_location='cpu'); cfg=EXLLMConfig(**c['config']); m=EXLLM(cfg); m.load_state_dict(c['model']); m.eval(); return m,tok,c
9
+
10
+ def bad_text(s):
11
+ if not s or '\ufffd' in s or '\x00' in s: return True
12
+ if any((ord(c)<32 and c not in '\n\t') for c in s): return True
13
+ # obvious repetition collapse
14
+ if len(s)>=12:
15
+ for n in range(1,7):
16
+ unit=s[-n:]
17
+ if len(unit)*4<=len(s) and s.endswith(unit*4): return True
18
+ return False
19
+
20
+ @torch.inference_mode()
21
+ def generate(m,tok,prompt,max_new=64,temperature=0.0,top_k=12,confidence_fallback=True):
22
+ ids=tok.encode_user(prompt)
23
+ # Reserve output space. Left-trim user content but preserve role tokens.
24
+ reserve=min(max_new, m.cfg.max_seq_len//2)
25
+ if len(ids)>m.cfg.max_seq_len-reserve:
26
+ keep=m.cfg.max_seq_len-reserve-3
27
+ body=ids[2:-1][-max(1,keep):]; ids=[tok.BOS,tok.USER,*body,tok.ASSIST]
28
+ out=[]; state=UTF8State(); lps=[]
29
+ for _ in range(min(max_new,m.cfg.max_seq_len-len(ids))):
30
+ x=torch.tensor([ids+out],dtype=torch.long); logits=m(x)[0,-1].clone()
31
+ # Structural specials are never generated inside assistant text.
32
+ logits[tok.PAD]=logits[tok.BOS]=logits[tok.USER]=logits[tok.ASSIST]=-1e30
33
+ # UTF-8 constrained token mask.
34
+ valid=torch.zeros_like(logits,dtype=torch.bool)
35
+ if state.complete:
36
+ valid[tok.EOS]=True
37
+ for t in range(256):
38
+ if state.accepts_byte(t): valid[t]=True
39
+ if tok.chars: valid[256:256+len(tok.chars)]=True
40
+ else:
41
+ for t in range(256):
42
+ if state.accepts_byte(t): valid[t]=True
43
+ logits[~valid]=-1e30
44
+ lp=torch.log_softmax(logits,dim=-1)
45
+ if temperature and temperature>0:
46
+ z=logits/temperature
47
+ if top_k and top_k<z.numel():
48
+ v,ix=torch.topk(z,top_k); probs=torch.softmax(v,dim=-1); t=int(ix[torch.multinomial(probs,1)].item())
49
+ else: t=int(torch.multinomial(torch.softmax(z,dim=-1),1).item())
50
+ else: t=int(torch.argmax(logits).item())
51
+ lps.append(float(lp[t]))
52
+ if t==tok.EOS: break
53
+ if t<256: state.push(t)
54
+ elif not state.complete: continue
55
+ out.append(t)
56
+ # If max length stopped in a partial byte sequence, drop trailing raw bytes until valid.
57
+ while out:
58
+ try: text=tok.decode(out); break
59
+ except UnicodeDecodeError: out.pop()
60
+ else: text=''
61
+ text=text.strip()
62
+ avg_lp=sum(lps)/max(1,len(lps))
63
+ if confidence_fallback and (bad_text(text) or avg_lp < -2.8):
64
+ text='うまく答えられませんでした。質問を短く言い換えてください。'
65
+ return text,avg_lp
66
+
67
+ if __name__=='__main__':
68
+ import sys; torch.set_num_threads(2); m,tok,c=load_model(); q=' '.join(sys.argv[1:]) or 'こんにちは'; print(generate(m,tok,q)[0])
src/loader.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from pathlib import Path
3
+ import torch
4
+ from .model import EXLLM, EXLLMConfig
5
+ from .tokenizer import HybridTokenizer
6
+
7
+ def load_release_model(root=None, weights=None):
8
+ root=Path(root or Path(__file__).resolve().parents[1])
9
+ cfg=EXLLMConfig(**json.loads((root/'config.json').read_text(encoding='utf-8')))
10
+ tok=HybridTokenizer.load(root/'tokenizer.json')
11
+ model=EXLLM(cfg)
12
+ path=Path(weights) if weights else root/'weights'/'EXLLM-v1.1-5m-release3.pt'
13
+ checkpoint=torch.load(path,map_location='cpu',weights_only=False)
14
+ model.load_state_dict(checkpoint['model'],strict=True)
15
+ model.eval()
16
+ return model,tok
src/model.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dataclasses import dataclass, asdict
2
+ import torch, torch.nn as nn, torch.nn.functional as F
3
+
4
+ @dataclass
5
+ class EXLLMConfig:
6
+ vocab_size:int=1029
7
+ max_seq_len:int=128
8
+ d_model:int=160
9
+ n_layers:int=4
10
+ n_heads:int=5
11
+ d_ff:int=512
12
+ rms_eps:float=1e-5
13
+
14
+ class RMSNorm(nn.Module):
15
+ def __init__(self,dim,eps=1e-5): super().__init__(); self.weight=nn.Parameter(torch.ones(dim)); self.eps=eps
16
+ def forward(self,x): return x*torch.rsqrt(x.pow(2).mean(-1,keepdim=True)+self.eps)*self.weight
17
+ class Block(nn.Module):
18
+ def __init__(self,cfg):
19
+ super().__init__(); d=cfg.d_model; self.n_heads=cfg.n_heads; self.head_dim=d//cfg.n_heads
20
+ self.norm1=RMSNorm(d,cfg.rms_eps); self.qkv=nn.Linear(d,3*d,bias=False); self.proj=nn.Linear(d,d,bias=False)
21
+ self.norm2=RMSNorm(d,cfg.rms_eps); self.fc1=nn.Linear(d,cfg.d_ff,bias=False); self.fc2=nn.Linear(cfg.d_ff,d,bias=False)
22
+ def forward(self,x):
23
+ b,t,d=x.shape; h=self.norm1(x); qkv=self.qkv(h).view(b,t,3,self.n_heads,self.head_dim).permute(2,0,3,1,4)
24
+ q,k,v=qkv[0],qkv[1],qkv[2]; a=F.scaled_dot_product_attention(q,k,v,is_causal=True)
25
+ x=x+self.proj(a.transpose(1,2).contiguous().view(b,t,d)); h=self.norm2(x); return x+self.fc2(F.relu(self.fc1(h)))
26
+ class EXLLM(nn.Module):
27
+ def __init__(self,cfg):
28
+ super().__init__(); self.cfg=cfg; self.tok=nn.Embedding(cfg.vocab_size,cfg.d_model); self.pos=nn.Embedding(cfg.max_seq_len,cfg.d_model)
29
+ self.blocks=nn.ModuleList([Block(cfg) for _ in range(cfg.n_layers)]); self.norm=RMSNorm(cfg.d_model,cfg.rms_eps); self.lm_head=nn.Linear(cfg.d_model,cfg.vocab_size,bias=False); self.lm_head.weight=self.tok.weight; self.apply(self._init)
30
+ def _init(self,m):
31
+ if isinstance(m,(nn.Linear,nn.Embedding)): nn.init.normal_(m.weight,0.0,0.02)
32
+ def forward(self,idx):
33
+ b,t=idx.shape
34
+ if t>self.cfg.max_seq_len: raise ValueError('context too long')
35
+ p=torch.arange(t,device=idx.device); x=self.tok(idx)+self.pos(p)[None,:,:]
36
+ for block in self.blocks: x=block(x)
37
+ return self.lm_head(self.norm(x))
38
+ def num_parameters(self): return sum(p.numel() for p in self.parameters())
src/runtime.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ from .tokenizer import normalize_text
3
+ from .infer import generate, bad_text
4
+
5
+ FALLBACK='うまく答えられませんでした。質問を短く言い換えてください。'
6
+ TOO_LONG='質問が長すぎます。短く分けて入力してください。'
7
+
8
+ # Small deterministic tool path. This is algorithmic, not a table of fixed answers.
9
+ _CALC_PATTERNS=[
10
+ (re.compile(r'^\s*([+-]?\d{1,5})\s*([+\-*×])\s*([+-]?\d{1,5})\s*(?:は|=)?\s*[??]?\s*$'), None),
11
+ (re.compile(r'^\s*([+-]?\d{1,5})\s*(たす|ひく|かける)\s*([+-]?\d{1,5})\s*(?:と|は)?\s*[??]?\s*$'), None),
12
+ ]
13
+
14
+ def try_calculate(prompt:str):
15
+ s=normalize_text(prompt)
16
+ for pat,_ in _CALC_PATTERNS:
17
+ m=pat.fullmatch(s)
18
+ if not m: continue
19
+ a=int(m.group(1)); op=m.group(2); b=int(m.group(3))
20
+ if op in ('+','たす'): r=a+b
21
+ elif op in ('-','ひく'): r=a-b
22
+ elif op in ('*','×','かける'): r=a*b
23
+ else: return None
24
+ # keep device-side integer formatting simple and bounded
25
+ if not (-2147483648 <= r <= 2147483647): return '計算結果が扱える範囲を超えています。'
26
+ return f'{r}です。'
27
+ return None
28
+
29
+ def _clean_output(text:str):
30
+ text=normalize_text(text)
31
+ if bad_text(text): return FALLBACK
32
+ try:
33
+ text.encode('utf-8','strict').decode('utf-8','strict')
34
+ except Exception:
35
+ return FALLBACK
36
+ # If a generation ran long and contains a complete Japanese sentence, keep the complete prefix.
37
+ if len(text)>72 and '。' in text:
38
+ text=text[:text.rfind('。')+1]
39
+ # Long non-terminated fragments are safer as a fallback than as broken prose.
40
+ if len(text)>24 and text[-1] not in '。!??!':
41
+ cut=max(text.rfind('。'),text.rfind('!'),text.rfind('?'))
42
+ if cut>=6: text=text[:cut+1]
43
+ else: return FALLBACK
44
+ return text or FALLBACK
45
+
46
+ def answer(model,tok,prompt,max_new=64,temperature=0.0,top_k=8):
47
+ s=normalize_text(prompt)
48
+ if not s: return '質問を入力してください。'
49
+ # Unicode character count limit; byte-fallback may use more tokens internally.
50
+ if len(s)>160: return TOO_LONG
51
+ calc=try_calculate(s)
52
+ if calc is not None: return calc
53
+ text,_=generate(model,tok,s,max_new=max_new,temperature=temperature,top_k=top_k,confidence_fallback=True)
54
+ return _clean_output(text)
src/tokenizer.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json, unicodedata
2
+ from collections import Counter
3
+ from pathlib import Path
4
+
5
+ BYTE_BASE=0; BYTE_COUNT=256
6
+
7
+ def normalize_text(s:str)->str:
8
+ s=unicodedata.normalize('NFC',s)
9
+ return ''.join((' ' if (ord(c)<32 and c not in '\n\t') else c) for c in s).strip()
10
+
11
+ class HybridTokenizer:
12
+ def __init__(self, chars):
13
+ self.chars=list(chars); self.char_to_id={c:256+i for i,c in enumerate(self.chars)}
14
+ s=256+len(self.chars)
15
+ self.PAD=s; self.BOS=s+1; self.USER=s+2; self.ASSIST=s+3; self.EOS=s+4; self.vocab_size=s+5
16
+ @classmethod
17
+ def build_from_jsonl(cls, paths, max_chars=768):
18
+ cnt=Counter()
19
+ for path in paths:
20
+ for line in open(path,encoding='utf-8'):
21
+ r=json.loads(line)
22
+ cnt.update(normalize_text(r['prompt'])); cnt.update(normalize_text(r['answer']))
23
+ # ASCII stays as byte tokens. Frequent non-ASCII chars become atomic tokens.
24
+ chars=[c for c,_ in cnt.most_common() if ord(c)>=128][:max_chars]
25
+ return cls(chars)
26
+ def save(self,path):
27
+ Path(path).write_text(json.dumps({'type':'hybrid-char-byte-fallback','chars':self.chars,'normalization':'NFC','special':{'PAD':self.PAD,'BOS':self.BOS,'USER':self.USER,'ASSIST':self.ASSIST,'EOS':self.EOS}},ensure_ascii=False,indent=2),encoding='utf-8')
28
+ @classmethod
29
+ def load(cls,path): return cls(json.loads(Path(path).read_text(encoding='utf-8'))['chars'])
30
+ def encode_text(self,s):
31
+ out=[]
32
+ for c in normalize_text(s):
33
+ if c in self.char_to_id: out.append(self.char_to_id[c])
34
+ else: out.extend(c.encode('utf-8','strict'))
35
+ return out
36
+ def encode_user(self,s): return [self.BOS,self.USER,*self.encode_text(s),self.ASSIST]
37
+ def encode_example(self,prompt,answer,max_seq_len=128):
38
+ p=self.encode_text(prompt); a=self.encode_text(answer)
39
+ seq=[self.BOS,self.USER,*p,self.ASSIST,*a,self.EOS]
40
+ if len(seq)>max_seq_len:
41
+ excess=len(seq)-max_seq_len; p=p[min(excess,len(p)):]
42
+ seq=[self.BOS,self.USER,*p,self.ASSIST,*a,self.EOS]
43
+ if len(seq)>max_seq_len:
44
+ a=a[:max(1,max_seq_len-(4+len(p)))]
45
+ seq=[self.BOS,self.USER,*p,self.ASSIST,*a,self.EOS]
46
+ return seq
47
+ def token_bytes(self,tok):
48
+ if 0<=tok<256: return bytes([tok])
49
+ i=tok-256
50
+ if 0<=i<len(self.chars): return self.chars[i].encode('utf-8')
51
+ return b''
52
+ def decode(self,toks):
53
+ b=bytearray()
54
+ for t in toks:
55
+ if t in (self.PAD,self.BOS,self.USER,self.ASSIST,self.EOS): continue
56
+ b.extend(self.token_bytes(t))
57
+ return bytes(b).decode('utf-8','strict')
58
+
59
+ class UTF8State:
60
+ __slots__=('need','lo','hi')
61
+ def __init__(self): self.need=0; self.lo=0x80; self.hi=0xBF
62
+ def accepts_byte(self,b):
63
+ if self.need: return self.lo<=b<=self.hi
64
+ return b in (9,10,13) or 0x20<=b<=0x7E or 0xC2<=b<=0xF4
65
+ def push(self,b):
66
+ if not self.accepts_byte(b): return False
67
+ if self.need:
68
+ self.need-=1; self.lo=0x80; self.hi=0xBF; return True
69
+ if b<=0x7F: return True
70
+ if 0xC2<=b<=0xDF: self.need=1
71
+ elif b==0xE0: self.need=2; self.lo=0xA0
72
+ elif 0xE1<=b<=0xEC or 0xEE<=b<=0xEF: self.need=2
73
+ elif b==0xED: self.need=2; self.hi=0x9F
74
+ elif b==0xF0: self.need=3; self.lo=0x90
75
+ elif 0xF1<=b<=0xF3: self.need=3
76
+ elif b==0xF4: self.need=3; self.hi=0x8F
77
+ return True
78
+ @property
79
+ def complete(self): return self.need==0
tokenizer.json ADDED
@@ -0,0 +1,620 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "type": "hybrid-char-byte-fallback",
3
+ "chars": [
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
+ "ル",
85
+ "単",
86
+ "み",
87
+ "私",
88
+ "ぞ",
89
+ "ス",
90
+ "時",
91
+ "理",
92
+ "「",
93
+ "」",
94
+ "ろ",
95
+ "ょ",
96
+ "デ",
97
+ "タ",
98
+ "葉",
99
+ "物",
100
+ "誰",
101
+ "使",
102
+ "モ",
103
+ "話",
104
+ "カ",
105
+ "書",
106
+ "ン",
107
+ "読",
108
+ "小",
109
+ "説",
110
+ "明",
111
+ "断",
112
+ "わ",
113
+ "ず",
114
+ "型",
115
+ "イ",
116
+ "足",
117
+ "大",
118
+ "定",
119
+ "ネ",
120
+ "ご",
121
+ "合",
122
+ "願",
123
+ "法",
124
+ "体",
125
+ "ト",
126
+ "電",
127
+ "フ",
128
+ "子",
129
+ "一",
130
+ "地",
131
+ "場",
132
+ "辞",
133
+ "検",
134
+ "伝",
135
+ "対",
136
+ "索",
137
+ "間",
138
+ "動",
139
+ "水",
140
+ "ざ",
141
+ "ッ",
142
+ "度",
143
+ "自",
144
+ "能",
145
+ "記",
146
+ "前",
147
+ "角",
148
+ "コ",
149
+ "丈",
150
+ "夫",
151
+ "全",
152
+ "手",
153
+ "端",
154
+ "末",
155
+ "英",
156
+ "数",
157
+ "ュ",
158
+ "周",
159
+ "内",
160
+ "会",
161
+ "少",
162
+ "公",
163
+ "無",
164
+ "ひ",
165
+ "信",
166
+ "状",
167
+ "具",
168
+ "正",
169
+ "ェ",
170
+ "要",
171
+ "聞",
172
+ "ド",
173
+ "ワ",
174
+ "球",
175
+ "機",
176
+ "ラ",
177
+ "猫",
178
+ "天",
179
+ "絵",
180
+ "上",
181
+ "ア",
182
+ "持",
183
+ "☕",
184
+ "想",
185
+ "元",
186
+ "現",
187
+ "×",
188
+ "飲",
189
+ "潔",
190
+ "ニ",
191
+ "薬",
192
+ "パ",
193
+ "医",
194
+ "療",
195
+ "律",
196
+ "診",
197
+ "半",
198
+ "カ",
199
+ "在",
200
+ "取",
201
+ "方",
202
+ "必",
203
+ "向",
204
+ "解",
205
+ "最",
206
+ "A",
207
+ "I",
208
+ "休",
209
+ "新",
210
+ "安",
211
+ "量",
212
+ "強",
213
+ "点",
214
+ "用",
215
+ "品",
216
+ "む",
217
+ "関",
218
+ "凍",
219
+ "首",
220
+ "都",
221
+ "続",
222
+ "事",
223
+ "標",
224
+ "準",
225
+ "圧",
226
+ "℃",
227
+ "付",
228
+ "近",
229
+ "心",
230
+ "換",
231
+ "応",
232
+ "月",
233
+ "転",
234
+ "犬",
235
+ "指",
236
+ "ク",
237
+ "ね",
238
+ "案",
239
+ "秒",
240
+ "沸",
241
+ "騰",
242
+ "ム",
243
+ "般",
244
+ "変",
245
+ "回",
246
+ "行",
247
+ "長",
248
+ "性",
249
+ "音",
250
+ "学",
251
+ "セ",
252
+ "相",
253
+ "進",
254
+ "疲",
255
+ "重",
256
+ "部",
257
+ "ナ",
258
+ "識",
259
+ "接",
260
+ "リ",
261
+ "🙂",
262
+ "限",
263
+ "別",
264
+ "製",
265
+ "ロ",
266
+ "テ",
267
+ "軽",
268
+ "食",
269
+ "提",
270
+ "供",
271
+ "店",
272
+ "ヒ",
273
+ "扱",
274
+ "外",
275
+ "科",
276
+ "類",
277
+ "配",
278
+ "証",
279
+ "段",
280
+ "域",
281
+ "工",
282
+ "錠",
283
+ "異",
284
+ "従",
285
+ "中",
286
+ "髙",
287
+ "珍",
288
+ "得",
289
+ "哺",
290
+ "乳",
291
+ "暮",
292
+ "病",
293
+ "症",
294
+ "談",
295
+ "タ",
296
+ "ナ",
297
+ "他",
298
+ "管",
299
+ "判",
300
+ "況",
301
+ "専",
302
+ "門",
303
+ "家",
304
+ "オ",
305
+ "可",
306
+ "じ",
307
+ "先",
308
+ "詞",
309
+ "古",
310
+ "刻",
311
+ "直",
312
+ "ほ",
313
+ "順",
314
+ "序",
315
+ "危",
316
+ "険",
317
+ "優",
318
+ "傷",
319
+ "為",
320
+ "避",
321
+ "太",
322
+ "陽",
323
+ "己",
324
+ "紹",
325
+ "介",
326
+ "東",
327
+ "京",
328
+ "助",
329
+ "マ",
330
+ "生",
331
+ "組",
332
+ "化",
333
+ "範",
334
+ "立",
335
+ "制",
336
+ "君",
337
+ "勉",
338
+ "野",
339
+ "主",
340
+ "了",
341
+ "眠",
342
+ "詳",
343
+ "囲",
344
+ "憩",
345
+ "切",
346
+ "態",
347
+ "活",
348
+ "ピ",
349
+ "規",
350
+ "容",
351
+ "素",
352
+ "習",
353
+ "暇",
354
+ "仕",
355
+ "算",
356
+ "号",
357
+ "形",
358
+ "章",
359
+ "構",
360
+ "グ",
361
+ "計",
362
+ "バ",
363
+ "プ",
364
+ "目",
365
+ "社",
366
+ "研",
367
+ "究",
368
+ "称",
369
+ "処",
370
+ "係",
371
+ "論",
372
+ "総",
373
+ "空",
374
+ "技",
375
+ "ビ",
376
+ "命",
377
+ "置",
378
+ "値",
379
+ "ソ",
380
+ "利",
381
+ "然",
382
+ "界",
383
+ "版",
384
+ "位",
385
+ "系",
386
+ "則",
387
+ "成",
388
+ "令",
389
+ "実",
390
+ "装",
391
+ "来",
392
+ "録",
393
+ "式",
394
+ "星",
395
+ "世",
396
+ "広",
397
+ "図",
398
+ "出",
399
+ "基",
400
+ "保",
401
+ "述",
402
+ "器",
403
+ "著",
404
+ "多",
405
+ "求",
406
+ "ウ",
407
+ "程",
408
+ "造",
409
+ "推",
410
+ "通",
411
+ "共",
412
+ "波",
413
+ "温",
414
+ "熱",
415
+ "身",
416
+ "ぶ",
417
+ "済",
418
+ "サ",
419
+ "節",
420
+ "象",
421
+ "符",
422
+ "下",
423
+ "光",
424
+ "感",
425
+ "磁",
426
+ "漢",
427
+ "隔",
428
+ "概",
429
+ "念",
430
+ "ァ",
431
+ "存",
432
+ "術",
433
+ "連",
434
+ "見",
435
+ "過",
436
+ "・",
437
+ "同",
438
+ "権",
439
+ "脊",
440
+ "椎",
441
+ "題",
442
+ "そ",
443
+ "速",
444
+ "条",
445
+ "件",
446
+ "満",
447
+ "酸",
448
+ "常",
449
+ "距",
450
+ "離",
451
+ "二",
452
+ "引",
453
+ "複",
454
+ "義",
455
+ "ォ",
456
+ "ダ",
457
+ "面",
458
+ "積",
459
+ "育",
460
+ "観",
461
+ "模",
462
+ "導",
463
+ "集",
464
+ "団",
465
+ "様",
466
+ "呼",
467
+ "似",
468
+ "敬",
469
+ "へ",
470
+ "不",
471
+ "修",
472
+ "業",
473
+ "振",
474
+ "媒",
475
+ "尺",
476
+ "経",
477
+ "財",
478
+ "産",
479
+ "消",
480
+ "費",
481
+ "演",
482
+ "擬",
483
+ "析",
484
+ "〜",
485
+ "改",
486
+ "例",
487
+ "示",
488
+ "柄",
489
+ "約",
490
+ "衛",
491
+ "放",
492
+ "射",
493
+ "秩",
494
+ "暗",
495
+ "鍵",
496
+ "復",
497
+ "歴",
498
+ "史",
499
+ "去",
500
+ "宇",
501
+ "宙",
502
+ "含",
503
+ "所",
504
+ "士",
505
+ "送",
506
+ "給",
507
+ "格",
508
+ "創",
509
+ "昼",
510
+ "鳥",
511
+ "羽",
512
+ "毛",
513
+ "翼",
514
+ "種",
515
+ "飛",
516
+ "ゴ",
517
+ "ズ",
518
+ "精",
519
+ "げ",
520
+ "高",
521
+ "ベ",
522
+ "階",
523
+ "許",
524
+ "諾",
525
+ "液",
526
+ "メ",
527
+ "憶",
528
+ "反",
529
+ "照",
530
+ "整",
531
+ "謝",
532
+ "移",
533
+ "平",
534
+ "校",
535
+ "施",
536
+ "設",
537
+ "織",
538
+ "察",
539
+ "験",
540
+ "営",
541
+ "訓",
542
+ "尾",
543
+ "達",
544
+ "互",
545
+ "網",
546
+ "恒",
547
+ "届",
548
+ "械",
549
+ "純",
550
+ "既",
551
+ "筋",
552
+ "道",
553
+ "結",
554
+ "交",
555
+ "ハ",
556
+ "層",
557
+ "ぎ",
558
+ "特",
559
+ "徴",
560
+ "占",
561
+ "三",
562
+ "次",
563
+ "混",
564
+ "窒",
565
+ "有",
566
+ "価",
567
+ "尋",
568
+ "魚",
569
+ "吸",
570
+ "惑",
571
+ "翻",
572
+ "訳",
573
+ "声",
574
+ "ツ",
575
+ "収",
576
+ "々",
577
+ "ヌ",
578
+ "資",
579
+ "料",
580
+ "誤",
581
+ "起",
582
+ "欠",
583
+ "陥",
584
+ "原",
585
+ "因",
586
+ "副",
587
+ "飾",
588
+ "番",
589
+ "び",
590
+ "期",
591
+ "待",
592
+ "沿",
593
+ "探",
594
+ "キ",
595
+ "ィ",
596
+ "シ",
597
+ "故",
598
+ "攻",
599
+ "撃",
600
+ "守",
601
+ "考",
602
+ "策",
603
+ "エ",
604
+ "ギ",
605
+ "運",
606
+ "秘",
607
+ "密",
608
+ "列",
609
+ "環",
610
+ "境"
611
+ ],
612
+ "normalization": "NFC",
613
+ "special": {
614
+ "PAD": 863,
615
+ "BOS": 864,
616
+ "USER": 865,
617
+ "ASSIST": 866,
618
+ "EOS": 867
619
+ }
620
+ }
tools/benchmark_5m.py ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Reproducible timing probe for the EXLLM 5M PyTorch checkpoint."""
3
+ import argparse
4
+ import json
5
+ import platform
6
+ import statistics
7
+ import sys
8
+ import time
9
+ from pathlib import Path
10
+
11
+ import torch
12
+
13
+ ROOT = Path(__file__).resolve().parents[1]
14
+ sys.path.insert(0, str(ROOT))
15
+
16
+ from src.infer import bad_text # noqa: E402
17
+ from src.model import EXLLM, EXLLMConfig # noqa: E402
18
+ from src.tokenizer import HybridTokenizer, UTF8State # noqa: E402
19
+
20
+
21
+ def sync(device):
22
+ if device.type == "cuda":
23
+ torch.cuda.synchronize(device)
24
+
25
+
26
+ def load(checkpoint, device):
27
+ data = torch.load(checkpoint, map_location="cpu", weights_only=False)
28
+ model = EXLLM(EXLLMConfig(**data["config"]))
29
+ model.load_state_dict(data["model"])
30
+ return model.eval().to(device), HybridTokenizer.load(ROOT / "tokenizer.json")
31
+
32
+
33
+ @torch.inference_mode()
34
+ def generate_timed(model, tok, prompt, device, max_new=48):
35
+ ids = tok.encode_user(prompt)
36
+ reserve = min(max_new, model.cfg.max_seq_len // 2)
37
+ if len(ids) > model.cfg.max_seq_len - reserve:
38
+ keep = model.cfg.max_seq_len - reserve - 3
39
+ ids = [tok.BOS, tok.USER, *ids[2:-1][-max(1, keep):], tok.ASSIST]
40
+
41
+ out, state, token_ms = [], UTF8State(), []
42
+ sync(device)
43
+ start = time.perf_counter_ns()
44
+ ttft_ns = None
45
+ for _ in range(min(max_new, model.cfg.max_seq_len - len(ids))):
46
+ x = torch.tensor([ids + out], dtype=torch.long, device=device)
47
+ logits = model(x)[0, -1].clone()
48
+ logits[tok.PAD] = logits[tok.BOS] = logits[tok.USER] = logits[tok.ASSIST] = -1e30
49
+ valid = torch.zeros_like(logits, dtype=torch.bool)
50
+ if state.complete:
51
+ valid[tok.EOS] = True
52
+ for token in range(256):
53
+ if state.accepts_byte(token):
54
+ valid[token] = True
55
+ if tok.chars:
56
+ valid[256:256 + len(tok.chars)] = True
57
+ else:
58
+ for token in range(256):
59
+ if state.accepts_byte(token):
60
+ valid[token] = True
61
+ logits[~valid] = -1e30
62
+ token = int(torch.argmax(logits).item())
63
+ sync(device)
64
+ now = time.perf_counter_ns()
65
+ if ttft_ns is None:
66
+ ttft_ns = now - start
67
+ token_ms.append((now - start) / 1e6 if len(token_ms) == 0 else 0.0)
68
+ if token == tok.EOS:
69
+ break
70
+ if token < 256:
71
+ state.push(token)
72
+ elif not state.complete:
73
+ continue
74
+ out.append(token)
75
+ sync(device)
76
+ end = time.perf_counter_ns()
77
+ while out:
78
+ try:
79
+ text = tok.decode(out)
80
+ break
81
+ except UnicodeDecodeError:
82
+ out.pop()
83
+ else:
84
+ text = ""
85
+ total_s = (end - start) / 1e9
86
+ generated = len(out)
87
+ decode_s = max(0.0, total_s - (ttft_ns or 0) / 1e9)
88
+ return {
89
+ "prompt": prompt,
90
+ "input_tokens": len(ids),
91
+ "output_tokens": generated,
92
+ "ttft_ms": round((ttft_ns or 0) / 1e6, 3),
93
+ "total_ms": round(total_s * 1000, 3),
94
+ "decode_tokens_per_second": round(max(0, generated - 1) / decode_s, 3) if decode_s else None,
95
+ "text": text.strip(),
96
+ "bad_text": bad_text(text.strip()),
97
+ }
98
+
99
+
100
+ def main():
101
+ ap = argparse.ArgumentParser()
102
+ ap.add_argument("--checkpoint", default=str(ROOT / "weights" / "EXLLM-v1.1-5m-release3.pt"))
103
+ ap.add_argument("--device", choices=("cpu", "cuda"), default="cuda" if torch.cuda.is_available() else "cpu")
104
+ ap.add_argument("--repeats", type=int, default=3)
105
+ args = ap.parse_args()
106
+ device = torch.device(args.device)
107
+ if device.type == "cuda" and not torch.cuda.is_available():
108
+ raise SystemExit("CUDA was requested but is unavailable")
109
+
110
+ started = time.perf_counter()
111
+ model, tok = load(args.checkpoint, device)
112
+ sync(device)
113
+ load_s = time.perf_counter() - started
114
+ prompts = ["こんにちは", "あなたは何というモデルですか?", "RAMとは何ですか?", "オフラインとは何ですか?"]
115
+ _ = generate_timed(model, tok, prompts[0], device, 16) # warm-up
116
+ runs = [generate_timed(model, tok, p, device) for p in prompts for _ in range(args.repeats)]
117
+ report = {
118
+ "schema": "exllm-benchmark-v1",
119
+ "checkpoint": Path(args.checkpoint).name,
120
+ "parameters": model.num_parameters(),
121
+ "device": str(device),
122
+ "torch": torch.__version__,
123
+ "python": platform.python_version(),
124
+ "load_seconds": round(load_s, 4),
125
+ "gpu": None,
126
+ "runs": runs,
127
+ "summary": {
128
+ "median_ttft_ms": round(statistics.median(x["ttft_ms"] for x in runs), 3),
129
+ "median_total_ms": round(statistics.median(x["total_ms"] for x in runs), 3),
130
+ "median_decode_tokens_per_second": round(statistics.median(x["decode_tokens_per_second"] for x in runs if x["decode_tokens_per_second"] is not None), 3),
131
+ },
132
+ }
133
+ if device.type == "cuda":
134
+ prop = torch.cuda.get_device_properties(device)
135
+ report["gpu"] = {
136
+ "name": prop.name,
137
+ "vram_bytes": prop.total_memory,
138
+ "compute_capability": f"{prop.major}.{prop.minor}",
139
+ "peak_allocated_bytes": torch.cuda.max_memory_allocated(device),
140
+ }
141
+ print(json.dumps(report, ensure_ascii=False, indent=2))
142
+
143
+
144
+ if __name__ == "__main__":
145
+ main()
tools/benchmark_robust.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Warm EXLLM repeatedly, then report raw and Tukey-filtered timing medians."""
3
+ import json
4
+ import statistics
5
+ import sys
6
+ import time
7
+ from pathlib import Path
8
+
9
+ ROOT = Path(__file__).resolve().parents[1]
10
+ sys.path.insert(0, str(ROOT))
11
+ sys.path.insert(0, str(ROOT / "tools"))
12
+
13
+ import torch
14
+ from benchmark_5m import generate_timed, load, sync
15
+
16
+
17
+ def quartiles(values):
18
+ ordered = sorted(values)
19
+ q1, _, q3 = statistics.quantiles(ordered, n=4, method="inclusive")
20
+ return q1, q3
21
+
22
+
23
+ def tukey_keep(rows, key):
24
+ values = [row[key] for row in rows if row[key] is not None]
25
+ q1, q3 = quartiles(values)
26
+ iqr = q3 - q1
27
+ low, high = q1 - 1.5 * iqr, q3 + 1.5 * iqr
28
+ return [row for row in rows if row[key] is not None and low <= row[key] <= high], low, high
29
+
30
+
31
+ def median(rows, key):
32
+ return round(statistics.median(row[key] for row in rows if row[key] is not None), 3)
33
+
34
+
35
+ device = torch.device("cuda")
36
+ torch.cuda.empty_cache()
37
+ started = time.perf_counter()
38
+ model, tokenizer = load(ROOT / "weights" / "EXLLM-v1.1-5m-release3.pt", device)
39
+ sync(device)
40
+ load_seconds = time.perf_counter() - started
41
+ prompts = ["こんにちは", "あなたは何というモデルですか?", "RAMとは何ですか?", "オフラインとは何ですか?"]
42
+
43
+ # Exercise every prompt shape before recording. These runs are intentionally discarded.
44
+ warmups = []
45
+ for _ in range(10):
46
+ for prompt in prompts:
47
+ warmups.append(generate_timed(model, tokenizer, prompt, device))
48
+
49
+ runs = []
50
+ for _ in range(30):
51
+ for prompt in prompts:
52
+ runs.append(generate_timed(model, tokenizer, prompt, device))
53
+
54
+ ttft_kept, ttft_low, ttft_high = tukey_keep(runs, "ttft_ms")
55
+ speed_kept, speed_low, speed_high = tukey_keep(runs, "decode_tokens_per_second")
56
+ total_kept, total_low, total_high = tukey_keep(runs, "total_ms")
57
+
58
+ report = {
59
+ "schema": "exllm-benchmark-robust-v1",
60
+ "checkpoint": "EXLLM-v1.1-5m-release3.pt",
61
+ "parameters": model.num_parameters(),
62
+ "torch": torch.__version__,
63
+ "load_seconds": round(load_seconds, 4),
64
+ "gpu": torch.cuda.get_device_name(0),
65
+ "warmup_runs": len(warmups),
66
+ "measured_runs": len(runs),
67
+ "first_warmup": warmups[0],
68
+ "last_warmup": warmups[-1],
69
+ "raw": {
70
+ "median_ttft_ms": median(runs, "ttft_ms"),
71
+ "median_total_ms": median(runs, "total_ms"),
72
+ "median_decode_tokens_per_second": median(runs, "decode_tokens_per_second"),
73
+ },
74
+ "tukey_1_5_iqr": {
75
+ "ttft": {"kept": len(ttft_kept), "removed": len(runs) - len(ttft_kept), "fence": [ttft_low, ttft_high], "median_ms": median(ttft_kept, "ttft_ms")},
76
+ "total": {"kept": len(total_kept), "removed": len(runs) - len(total_kept), "fence": [total_low, total_high], "median_ms": median(total_kept, "total_ms")},
77
+ "decode": {"kept": len(speed_kept), "removed": len(runs) - len(speed_kept), "fence": [speed_low, speed_high], "median_tokens_per_second": median(speed_kept, "decode_tokens_per_second")},
78
+ },
79
+ "runs": runs,
80
+ }
81
+ print(json.dumps(report, ensure_ascii=False, indent=2))
tools/dequantize_int8.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse,json,struct,sys
2
+ from pathlib import Path
3
+ import numpy as np,torch
4
+ ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT))
5
+ from src.model import EXLLM,EXLLMConfig
6
+ MAGIC=b'EXLLM8\0\0'
7
+ def load_bin(path,manifest_path):
8
+ man=json.loads(Path(manifest_path).read_text(encoding='utf-8'));m=EXLLM(EXLLMConfig(**man['config']));vals={}
9
+ with open(path,'rb') as f:
10
+ if f.read(8)!=MAGIC:raise ValueError('bad magic')
11
+ ver,n=struct.unpack('<II',f.read(8));
12
+ if ver!=1:raise ValueError('unsupported format')
13
+ for _ in range(n):
14
+ nl,nd,qt=struct.unpack('<HBB',f.read(4));name=f.read(nl).decode();dims=[struct.unpack('<I',f.read(4))[0] for _ in range(nd)];ns,nb=struct.unpack('<II',f.read(8));sc=np.frombuffer(f.read(ns*4),dtype='<f4').copy() if ns else np.array([],dtype=np.float32);raw=f.read(nb)
15
+ if qt==1:a=np.frombuffer(raw,dtype=np.int8).reshape(dims).astype(np.float32)*sc[:,None]
16
+ elif qt==2:a=np.frombuffer(raw,dtype='<f2').reshape(dims).astype(np.float32)
17
+ else:raise ValueError(qt)
18
+ vals[name]=torch.from_numpy(a.copy())
19
+ sd=m.state_dict();aliases=man.get('aliases',{})
20
+ for k in sd:
21
+ src=aliases.get(k,k)
22
+ if src in vals:sd[k]=vals[src]
23
+ m.load_state_dict(sd);m.eval();return m,man
24
+ def main():
25
+ ap=argparse.ArgumentParser();ap.add_argument('--bin',default='weights/EXLLM-v1.0.0-int8.bin');ap.add_argument('--manifest',default='weights/EXLLM-v1.0.0-int8.manifest.json');ap.add_argument('--out',default='weights/EXLLM-v1.0.0-int8-dequant-test.pt');a=ap.parse_args();m,man=load_bin(ROOT/a.bin,ROOT/a.manifest);torch.save({'model':m.state_dict(),'config':m.cfg.__dict__,'meta':{'name':'EXLLM','developer':'ToTo','version':'1.0.0','quantized_source':a.bin}},ROOT/a.out);print(a.out)
26
+ if __name__=='__main__':main()
training/release-5m.json ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "exllm-training-release-v1",
3
+ "model": "EXLLM-0.005B-Instruct",
4
+ "checkpoint": "weights/EXLLM-v1.1-5m-release3.pt",
5
+ "checkpoint_sha256": "48ad00c6640689595a253fc949cad83f3000e14cccdf69275fcf245e85be3ceb",
6
+ "parameters": 5377824,
7
+ "parameters_billions": 0.005377824,
8
+ "global_step": 1810,
9
+ "lineage": {
10
+ "project_origin": "random initialization",
11
+ "release_parent": "earlier in-project EXLLM checkpoint",
12
+ "expansion": "dimension-compatible parameter transplantation",
13
+ "external_pretrained_checkpoint": null
14
+ },
15
+ "architecture": {
16
+ "vocab_size": 868,
17
+ "max_seq_len": 128,
18
+ "d_model": 288,
19
+ "n_layers": 6,
20
+ "n_heads": 9,
21
+ "d_ff": 896,
22
+ "activation": "relu",
23
+ "normalization": "pre-norm RMSNorm",
24
+ "rms_eps": 0.00001,
25
+ "position_encoding": "learned absolute"
26
+ },
27
+ "base_training": {
28
+ "optimizer": "AdamW",
29
+ "learning_rate": 0.0005,
30
+ "betas": [0.9, 0.95],
31
+ "weight_decay": 0.03,
32
+ "gradient_clip_norm": 1.0,
33
+ "schedule": "linear warm-up and cosine decay"
34
+ },
35
+ "final_corrective_stage": {
36
+ "source": "weights/EXLLM-v1.1-5m-release2.pt",
37
+ "data": "data/v1_1_release_fix.jsonl",
38
+ "steps": 100,
39
+ "learning_rate": 0.000006,
40
+ "loss_first": 0.038745223909500054,
41
+ "loss_last": 0.024198499539634214
42
+ },
43
+ "published_staged_data": {
44
+ "jsonl_file_records": 86408,
45
+ "records_millions": 0.086408,
46
+ "deduplicated": false,
47
+ "note": "Sum of records across overlapping staged files; not a unique-example count."
48
+ }
49
+ }
weights/EXLLM-v1.1-5m-int8.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b2bf2d9f103cba714bc98976709c5ad34860c1ff55fed2fce91fc95afb5b34a
3
+ size 5443105
weights/EXLLM-v1.1-5m-int8.manifest.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format": "EXLLM8",
3
+ "format_version": 1,
4
+ "model": "EXLLM",
5
+ "model_version": "1.1.0-5m",
6
+ "architecture": "decoder-only Transformer, RMSNorm, ReLU, tied token/lm-head embedding",
7
+ "config": {
8
+ "vocab_size": 868,
9
+ "max_seq_len": 128,
10
+ "d_model": 288,
11
+ "n_layers": 6,
12
+ "n_heads": 9,
13
+ "d_ff": 896,
14
+ "rms_eps": 1e-05
15
+ },
16
+ "unique_parameters": 5377824,
17
+ "tokenizer": "hybrid-char-byte-fallback",
18
+ "tokenizer_vocab": 868,
19
+ "quantization": {
20
+ "matrix_weights": "symmetric int8 per output row",
21
+ "matrix_scale": "float32 per row",
22
+ "rmsnorm_weights": "float16"
23
+ },
24
+ "aliases": {
25
+ "lm_head.weight": "tok.weight"
26
+ },
27
+ "tensor_count": 39,
28
+ "file": "weights/EXLLM-v1.1-5m-int8.bin",
29
+ "bytes": 5443105,
30
+ "sha256": "3b2bf2d9f103cba714bc98976709c5ad34860c1ff55fed2fce91fc95afb5b34a"
31
+ }
weights/EXLLM-v1.1-5m-release3.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:48ad00c6640689595a253fc949cad83f3000e14cccdf69275fcf245e85be3ceb
3
+ size 21526737
weights/model.q12 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d64037fde791e5c0e48101bc1a8ab366a3287f1f36b4464879e36495ea7e5a53
3
+ size 5443105