Text Generation
ONNX
GGUF
inkling2
qwencoin
qwork
windows
webgpu
rocm
q8_0
quantized
local-inference
proof-of-work
bitcoin
ordinals
hashfun
conversational
Instructions to use staccs/Inkling-2-Mini-QWork-Q8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use staccs/Inkling-2-Mini-QWork-Q8 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf staccs/Inkling-2-Mini-QWork-Q8:Q8_0 # Run inference directly in the terminal: llama cli -hf staccs/Inkling-2-Mini-QWork-Q8:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf staccs/Inkling-2-Mini-QWork-Q8:Q8_0 # Run inference directly in the terminal: llama cli -hf staccs/Inkling-2-Mini-QWork-Q8:Q8_0
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf staccs/Inkling-2-Mini-QWork-Q8:Q8_0 # Run inference directly in the terminal: ./build/bin/llama cli -hf staccs/Inkling-2-Mini-QWork-Q8:Q8_0
Use Docker
docker model run hf.co/staccs/Inkling-2-Mini-QWork-Q8:Q8_0
- Llama new
- LM Studio
- Jan
- vLLM
How to use staccs/Inkling-2-Mini-QWork-Q8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "staccs/Inkling-2-Mini-QWork-Q8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "staccs/Inkling-2-Mini-QWork-Q8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/staccs/Inkling-2-Mini-QWork-Q8:Q8_0
- Ollama
How to use staccs/Inkling-2-Mini-QWork-Q8 with Ollama:
ollama run hf.co/staccs/Inkling-2-Mini-QWork-Q8:Q8_0
- Unsloth Desktop
- Pi
How to use staccs/Inkling-2-Mini-QWork-Q8 with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf staccs/Inkling-2-Mini-QWork-Q8:Q8_0
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "staccs/Inkling-2-Mini-QWork-Q8:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use staccs/Inkling-2-Mini-QWork-Q8 with Docker Model Runner:
docker model run hf.co/staccs/Inkling-2-Mini-QWork-Q8:Q8_0
- Lemonade
How to use staccs/Inkling-2-Mini-QWork-Q8 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull staccs/Inkling-2-Mini-QWork-Q8:Q8_0
Run and chat with the model
lemonade run user.Inkling-2-Mini-QWork-Q8-Q8_0
List all available models
lemonade list
- Hermes Agent
How to use staccs/Inkling-2-Mini-QWork-Q8 with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf staccs/Inkling-2-Mini-QWork-Q8:Q8_0
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default staccs/Inkling-2-Mini-QWork-Q8:Q8_0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use staccs/Inkling-2-Mini-QWork-Q8 with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf staccs/Inkling-2-Mini-QWork-Q8:Q8_0
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "staccs/Inkling-2-Mini-QWork-Q8:Q8_0" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Expand model card and add release support files
Browse files
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.
|
README.md
CHANGED
|
@@ -18,6 +18,18 @@ tags:
|
|
| 18 |
|
| 19 |
This is the higher-weight-precision candidate in the Inkling 2 Mini + QWork project. A host can authorize a capped amount of deterministic work for a single turn. When the model emits the trigger, the decoder computes an independently verifiable receipt, then resumes generation. QWork is off by default; text cannot grant it. Q8_0 is the weight format, not a different receipt protocol or a claim of measured quality improvement over IQ4.
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
## Tested platform
|
| 22 |
|
| 23 |
| Item | Verified development configuration |
|
|
@@ -32,6 +44,10 @@ This is the higher-weight-precision candidate in the Inkling 2 Mini + QWork proj
|
|
| 32 |
|
| 33 |
The separate repaired staging run with the provider dependencies was **IQ4**, not Q8. No Q8 Mac pass is claimed. Do not use this Q8_0 build on the 24 GB M5; the IQ4 Mac findings do not establish Q8 fit or behavior even on the 36 GB M3. No minimum RAM estimate is extrapolated from the 128 GB qualification machine.
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
## Integrity and receipt verification
|
| 36 |
|
| 37 |
| Frozen input | SHA-256 |
|
|
|
|
| 18 |
|
| 19 |
This is the higher-weight-precision candidate in the Inkling 2 Mini + QWork project. A host can authorize a capped amount of deterministic work for a single turn. When the model emits the trigger, the decoder computes an independently verifiable receipt, then resumes generation. QWork is off by default; text cannot grant it. Q8_0 is the weight format, not a different receipt protocol or a claim of measured quality improvement over IQ4.
|
| 20 |
|
| 21 |
+
## Social without cheap Sybils
|
| 22 |
+
|
| 23 |
+
**A local model you can keep. A public history you can check. No mandatory app.**
|
| 24 |
+
|
| 25 |
+
If the servers disappear, two bits of software should still earn their keep: a record people can verify for themselves, and a model that runs on hardware they already have. The same system should make room for a message that carries value and one that just says “the bridge is out.” A message doesn't need a payment attached to matter.
|
| 26 |
+
|
| 27 |
+
The broader Qwencoin design takes Bitcoin-style consensus as a starting point and adds bonding, vouching, and slashing to raise the cost of faking social trust at scale. It aims to make coordinated fake identities expensive, not magically eliminate them. Consensus can establish what was recorded and in what order. It can't establish that a claim in a message is true. This is a separate Bitcoin-derived design, not a change to Bitcoin mainnet.
|
| 28 |
+
|
| 29 |
+
These repositories ship the **model side** of that idea. The model can do capped deterministic work in the middle of an answer, surface a receipt another machine can verify, and continue chatting. A terminal, browser, or future app can use the same protocol; no single interface is the product. Local chat and receipt checking can work without a cloud service once the artifacts are installed. Syncing a shared record still requires peers.
|
| 30 |
+
|
| 31 |
+
[hashfun at aichat.fyi/fun](https://aichat.fyi/fun/) is a separate project surface for Bitcoin-derived chains and their public records. The Inkling artifacts do not embed that website, run a node, hold keys, launch a chain, or submit transactions. QWork receipts aren't proof of a payment, a published message, or an answer's truth.
|
| 32 |
+
|
| 33 |
## Tested platform
|
| 34 |
|
| 35 |
| Item | Verified development configuration |
|
|
|
|
| 44 |
|
| 45 |
The separate repaired staging run with the provider dependencies was **IQ4**, not Q8. No Q8 Mac pass is claimed. Do not use this Q8_0 build on the 24 GB M5; the IQ4 Mac findings do not establish Q8 fit or behavior even on the 36 GB M3. No minimum RAM estimate is extrapolated from the 128 GB qualification machine.
|
| 46 |
|
| 47 |
+
### Why offer Q8 separately?
|
| 48 |
+
|
| 49 |
+
Q8_0 keeps a higher-precision weight representation on hardware that can afford it. The Windows weight file is about 58% larger than IQ4_NL; that does not imply a measured answer-quality improvement. Both test suites use the same QWork table and digest format. Choose IQ4 when machine fit and cross-platform testing matter most; treat Q8 as the Windows experiment until another backend is qualified.
|
| 50 |
+
|
| 51 |
## Integrity and receipt verification
|
| 52 |
|
| 53 |
| Frozen input | SHA-256 |
|
backends/windows-x64-webgpu/model/SHA256SUMS.part
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
97da4ae22136cbc66689e57f7188bf80b163a1ceac2c215147cb32146ad21036 chat_template.jinja
|
| 2 |
+
8666439c51982d98c1c47f8e1604c5fd6508afbbbc3b02eef1636e575ced7522 tokenizer_config.json
|
| 3 |
+
5740c9af9c600dd138540f52b71ed5023e3934f33ab51e42c71343ca0157b658 genai_config.json
|
| 4 |
+
189812825d42e0565f53a1009850ee08f941cdafebdd74d1a1b09fc0df240df8 actual-merged.onnx
|
backends/windows-x64-webgpu/model/chat_template.jinja
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{%- set eff = reasoning_effort if reasoning_effort is defined and reasoning_effort is not none else 0.1 -%}{%- for message in messages -%}{%- if message.role == 'system' -%}{{- '<|message_system|><|content_text|>' -}}{{- message.content -}}{{- '<|end_message|>' -}}{%- endif -%}{%- endfor -%}{{- '<|message_system|><|content_text|>Thinking effort level: ' -}}{{- eff -}}{{- '<|end_message|>' -}}{%- for message in messages -%}{%- if message.role == 'user' -%}{{- '<|message_user|><|content_text|>' -}}{{- message.content -}}{{- '<|end_message|>' -}}{%- elif message.role == 'assistant' -%}{{- '<|message_model|><|content_text|>' -}}{{- message.content -}}{{- '<|end_message|><|content_model_end_sampling|>' -}}{%- endif -%}{%- endfor -%}
|
backends/windows-x64-webgpu/model/genai_config.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": {
|
| 3 |
+
"type": "decoder",
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
200006
|
| 6 |
+
],
|
| 7 |
+
"pad_token_id": 199999,
|
| 8 |
+
"context_length": 4096,
|
| 9 |
+
"vocab_size": 200058,
|
| 10 |
+
"decoder": {
|
| 11 |
+
"filename": "actual-merged.onnx",
|
| 12 |
+
"head_size": 544,
|
| 13 |
+
"hidden_size": 2304,
|
| 14 |
+
"num_attention_heads": 24,
|
| 15 |
+
"num_hidden_layers": 48,
|
| 16 |
+
"num_key_value_heads": 8,
|
| 17 |
+
"inputs": {
|
| 18 |
+
"input_ids": "input_ids",
|
| 19 |
+
"attention_mask": "attention_mask",
|
| 20 |
+
"past_key_names": "past_key_values.%d.key",
|
| 21 |
+
"past_value_names": "past_key_values.%d.value"
|
| 22 |
+
},
|
| 23 |
+
"outputs": {
|
| 24 |
+
"logits": "logits",
|
| 25 |
+
"present_key_names": "present.%d.key",
|
| 26 |
+
"present_value_names": "present.%d.value"
|
| 27 |
+
},
|
| 28 |
+
"session_options": {
|
| 29 |
+
"log_id": "inkling-v2-q8",
|
| 30 |
+
"intra_op_num_threads": 8,
|
| 31 |
+
"inter_op_num_threads": 1,
|
| 32 |
+
"enable_mem_pattern": false,
|
| 33 |
+
"enable_cpu_mem_arena": false,
|
| 34 |
+
"graph_optimization_level": "ORT_DISABLE_ALL",
|
| 35 |
+
"provider_options": [
|
| 36 |
+
{
|
| 37 |
+
"WebGPU": {
|
| 38 |
+
"adapterIndex": "0",
|
| 39 |
+
"powerPreference": "high-performance"
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
]
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
},
|
| 46 |
+
"search": {
|
| 47 |
+
"batch_size": 1,
|
| 48 |
+
"do_sample": false,
|
| 49 |
+
"max_length": 4096,
|
| 50 |
+
"past_present_share_buffer": false,
|
| 51 |
+
"num_beams": 1,
|
| 52 |
+
"num_return_sequences": 1
|
| 53 |
+
}
|
| 54 |
+
}
|
backends/windows-x64-webgpu/model/tokenizer_config.json
ADDED
|
@@ -0,0 +1,549 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
+
"fix_mistral_regex": false,
|
| 6 |
+
"extra_special_tokens": {
|
| 7 |
+
"endoftext": "<|endoftext|>",
|
| 8 |
+
"message_user": "<|message_user|>",
|
| 9 |
+
"message_model": "<|message_model|>",
|
| 10 |
+
"message_system": "<|message_system|>",
|
| 11 |
+
"message_tool": "<|message_tool|>",
|
| 12 |
+
"content_text": "<|content_text|>",
|
| 13 |
+
"content_image": "<|content_image|>",
|
| 14 |
+
"content_model_end_sampling": "<|content_model_end_sampling|>",
|
| 15 |
+
"content_thinking": "<|content_thinking|>",
|
| 16 |
+
"end_message": "<|end_message|>",
|
| 17 |
+
"content_tool_error": "<|content_tool_error|>",
|
| 18 |
+
"content_xml": "<|content_xml|>",
|
| 19 |
+
"begin_of_text": "<|begin_of_text|>",
|
| 20 |
+
"content_invoke_tool_json": "<|content_invoke_tool_json|>",
|
| 21 |
+
"content_invoke_tool_text": "<|content_invoke_tool_text|>"
|
| 22 |
+
},
|
| 23 |
+
"added_tokens_decoder": {
|
| 24 |
+
"199998": {
|
| 25 |
+
"content": "<|unused|>",
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"lstrip": false,
|
| 28 |
+
"rstrip": false,
|
| 29 |
+
"normalized": false,
|
| 30 |
+
"special": true
|
| 31 |
+
},
|
| 32 |
+
"199999": {
|
| 33 |
+
"content": "<|endoftext|>",
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"lstrip": false,
|
| 36 |
+
"rstrip": false,
|
| 37 |
+
"normalized": false,
|
| 38 |
+
"special": true
|
| 39 |
+
},
|
| 40 |
+
"200000": {
|
| 41 |
+
"content": "<|message_user|>",
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"lstrip": false,
|
| 44 |
+
"rstrip": false,
|
| 45 |
+
"normalized": false,
|
| 46 |
+
"special": true
|
| 47 |
+
},
|
| 48 |
+
"200001": {
|
| 49 |
+
"content": "<|message_model|>",
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"lstrip": false,
|
| 52 |
+
"rstrip": false,
|
| 53 |
+
"normalized": false,
|
| 54 |
+
"special": true
|
| 55 |
+
},
|
| 56 |
+
"200002": {
|
| 57 |
+
"content": "<|message_system|>",
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"lstrip": false,
|
| 60 |
+
"rstrip": false,
|
| 61 |
+
"normalized": false,
|
| 62 |
+
"special": true
|
| 63 |
+
},
|
| 64 |
+
"200003": {
|
| 65 |
+
"content": "<|message_tool|>",
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"lstrip": false,
|
| 68 |
+
"rstrip": false,
|
| 69 |
+
"normalized": false,
|
| 70 |
+
"special": true
|
| 71 |
+
},
|
| 72 |
+
"200004": {
|
| 73 |
+
"content": "<|content_text|>",
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"lstrip": false,
|
| 76 |
+
"rstrip": false,
|
| 77 |
+
"normalized": false,
|
| 78 |
+
"special": true
|
| 79 |
+
},
|
| 80 |
+
"200005": {
|
| 81 |
+
"content": "<|content_image|>",
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"lstrip": false,
|
| 84 |
+
"rstrip": false,
|
| 85 |
+
"normalized": false,
|
| 86 |
+
"special": true
|
| 87 |
+
},
|
| 88 |
+
"200006": {
|
| 89 |
+
"content": "<|content_model_end_sampling|>",
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"lstrip": false,
|
| 92 |
+
"rstrip": false,
|
| 93 |
+
"normalized": false,
|
| 94 |
+
"special": true
|
| 95 |
+
},
|
| 96 |
+
"200007": {
|
| 97 |
+
"content": "<|unused_200007|>",
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"lstrip": false,
|
| 100 |
+
"rstrip": false,
|
| 101 |
+
"normalized": false,
|
| 102 |
+
"special": true
|
| 103 |
+
},
|
| 104 |
+
"200008": {
|
| 105 |
+
"content": "<|content_thinking|>",
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"lstrip": false,
|
| 108 |
+
"rstrip": false,
|
| 109 |
+
"normalized": false,
|
| 110 |
+
"special": true
|
| 111 |
+
},
|
| 112 |
+
"200009": {
|
| 113 |
+
"content": "<|unused_200009|>",
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"lstrip": false,
|
| 116 |
+
"rstrip": false,
|
| 117 |
+
"normalized": false,
|
| 118 |
+
"special": true
|
| 119 |
+
},
|
| 120 |
+
"200010": {
|
| 121 |
+
"content": "<|end_message|>",
|
| 122 |
+
"single_word": false,
|
| 123 |
+
"lstrip": false,
|
| 124 |
+
"rstrip": false,
|
| 125 |
+
"normalized": false,
|
| 126 |
+
"special": true
|
| 127 |
+
},
|
| 128 |
+
"200011": {
|
| 129 |
+
"content": "<|unused_200011|>",
|
| 130 |
+
"single_word": false,
|
| 131 |
+
"lstrip": false,
|
| 132 |
+
"rstrip": false,
|
| 133 |
+
"normalized": false,
|
| 134 |
+
"special": true
|
| 135 |
+
},
|
| 136 |
+
"200012": {
|
| 137 |
+
"content": "<|unused_200012|>",
|
| 138 |
+
"single_word": false,
|
| 139 |
+
"lstrip": false,
|
| 140 |
+
"rstrip": false,
|
| 141 |
+
"normalized": false,
|
| 142 |
+
"special": true
|
| 143 |
+
},
|
| 144 |
+
"200013": {
|
| 145 |
+
"content": "<|unused_200013|>",
|
| 146 |
+
"single_word": false,
|
| 147 |
+
"lstrip": false,
|
| 148 |
+
"rstrip": false,
|
| 149 |
+
"normalized": false,
|
| 150 |
+
"special": true
|
| 151 |
+
},
|
| 152 |
+
"200014": {
|
| 153 |
+
"content": "<|unused_200014|>",
|
| 154 |
+
"single_word": false,
|
| 155 |
+
"lstrip": false,
|
| 156 |
+
"rstrip": false,
|
| 157 |
+
"normalized": false,
|
| 158 |
+
"special": true
|
| 159 |
+
},
|
| 160 |
+
"200015": {
|
| 161 |
+
"content": "<|unused_200015|>",
|
| 162 |
+
"single_word": false,
|
| 163 |
+
"lstrip": false,
|
| 164 |
+
"rstrip": false,
|
| 165 |
+
"normalized": false,
|
| 166 |
+
"special": true
|
| 167 |
+
},
|
| 168 |
+
"200016": {
|
| 169 |
+
"content": "<|unused_200016|>",
|
| 170 |
+
"single_word": false,
|
| 171 |
+
"lstrip": false,
|
| 172 |
+
"rstrip": false,
|
| 173 |
+
"normalized": false,
|
| 174 |
+
"special": true
|
| 175 |
+
},
|
| 176 |
+
"200017": {
|
| 177 |
+
"content": "<|unused_200017|>",
|
| 178 |
+
"single_word": false,
|
| 179 |
+
"lstrip": false,
|
| 180 |
+
"rstrip": false,
|
| 181 |
+
"normalized": false,
|
| 182 |
+
"special": true
|
| 183 |
+
},
|
| 184 |
+
"200018": {
|
| 185 |
+
"content": "<|unused_200018|>",
|
| 186 |
+
"single_word": false,
|
| 187 |
+
"lstrip": false,
|
| 188 |
+
"rstrip": false,
|
| 189 |
+
"normalized": false,
|
| 190 |
+
"special": true
|
| 191 |
+
},
|
| 192 |
+
"200019": {
|
| 193 |
+
"content": "<|unused_200019|>",
|
| 194 |
+
"single_word": false,
|
| 195 |
+
"lstrip": false,
|
| 196 |
+
"rstrip": false,
|
| 197 |
+
"normalized": false,
|
| 198 |
+
"special": true
|
| 199 |
+
},
|
| 200 |
+
"200020": {
|
| 201 |
+
"content": "<|unused_200020|>",
|
| 202 |
+
"single_word": false,
|
| 203 |
+
"lstrip": false,
|
| 204 |
+
"rstrip": false,
|
| 205 |
+
"normalized": false,
|
| 206 |
+
"special": true
|
| 207 |
+
},
|
| 208 |
+
"200021": {
|
| 209 |
+
"content": "<|unused_200021|>",
|
| 210 |
+
"single_word": false,
|
| 211 |
+
"lstrip": false,
|
| 212 |
+
"rstrip": false,
|
| 213 |
+
"normalized": false,
|
| 214 |
+
"special": true
|
| 215 |
+
},
|
| 216 |
+
"200022": {
|
| 217 |
+
"content": "<|content_tool_error|>",
|
| 218 |
+
"single_word": false,
|
| 219 |
+
"lstrip": false,
|
| 220 |
+
"rstrip": false,
|
| 221 |
+
"normalized": false,
|
| 222 |
+
"special": true
|
| 223 |
+
},
|
| 224 |
+
"200023": {
|
| 225 |
+
"content": "<|unused_200023|>",
|
| 226 |
+
"single_word": false,
|
| 227 |
+
"lstrip": false,
|
| 228 |
+
"rstrip": false,
|
| 229 |
+
"normalized": false,
|
| 230 |
+
"special": true
|
| 231 |
+
},
|
| 232 |
+
"200024": {
|
| 233 |
+
"content": "<|content_xml|>",
|
| 234 |
+
"single_word": false,
|
| 235 |
+
"lstrip": false,
|
| 236 |
+
"rstrip": false,
|
| 237 |
+
"normalized": false,
|
| 238 |
+
"special": true
|
| 239 |
+
},
|
| 240 |
+
"200025": {
|
| 241 |
+
"content": "<|unused_200025|>",
|
| 242 |
+
"single_word": false,
|
| 243 |
+
"lstrip": false,
|
| 244 |
+
"rstrip": false,
|
| 245 |
+
"normalized": false,
|
| 246 |
+
"special": true
|
| 247 |
+
},
|
| 248 |
+
"200026": {
|
| 249 |
+
"content": "<|unused_200026|>",
|
| 250 |
+
"single_word": false,
|
| 251 |
+
"lstrip": false,
|
| 252 |
+
"rstrip": false,
|
| 253 |
+
"normalized": false,
|
| 254 |
+
"special": true
|
| 255 |
+
},
|
| 256 |
+
"200027": {
|
| 257 |
+
"content": "<|unused_200027|>",
|
| 258 |
+
"single_word": false,
|
| 259 |
+
"lstrip": false,
|
| 260 |
+
"rstrip": false,
|
| 261 |
+
"normalized": false,
|
| 262 |
+
"special": true
|
| 263 |
+
},
|
| 264 |
+
"200028": {
|
| 265 |
+
"content": "<|begin_of_text|>",
|
| 266 |
+
"single_word": false,
|
| 267 |
+
"lstrip": false,
|
| 268 |
+
"rstrip": false,
|
| 269 |
+
"normalized": false,
|
| 270 |
+
"special": true
|
| 271 |
+
},
|
| 272 |
+
"200029": {
|
| 273 |
+
"content": "<|unused_200029|>",
|
| 274 |
+
"single_word": false,
|
| 275 |
+
"lstrip": false,
|
| 276 |
+
"rstrip": false,
|
| 277 |
+
"normalized": false,
|
| 278 |
+
"special": true
|
| 279 |
+
},
|
| 280 |
+
"200030": {
|
| 281 |
+
"content": "<|unused_200030|>",
|
| 282 |
+
"single_word": false,
|
| 283 |
+
"lstrip": false,
|
| 284 |
+
"rstrip": false,
|
| 285 |
+
"normalized": false,
|
| 286 |
+
"special": true
|
| 287 |
+
},
|
| 288 |
+
"200031": {
|
| 289 |
+
"content": "<|unused_200031|>",
|
| 290 |
+
"single_word": false,
|
| 291 |
+
"lstrip": false,
|
| 292 |
+
"rstrip": false,
|
| 293 |
+
"normalized": false,
|
| 294 |
+
"special": true
|
| 295 |
+
},
|
| 296 |
+
"200032": {
|
| 297 |
+
"content": "<|unused_200032|>",
|
| 298 |
+
"single_word": false,
|
| 299 |
+
"lstrip": false,
|
| 300 |
+
"rstrip": false,
|
| 301 |
+
"normalized": false,
|
| 302 |
+
"special": true
|
| 303 |
+
},
|
| 304 |
+
"200033": {
|
| 305 |
+
"content": "<|unused_200033|>",
|
| 306 |
+
"single_word": false,
|
| 307 |
+
"lstrip": false,
|
| 308 |
+
"rstrip": false,
|
| 309 |
+
"normalized": false,
|
| 310 |
+
"special": true
|
| 311 |
+
},
|
| 312 |
+
"200034": {
|
| 313 |
+
"content": "<|unused_200034|>",
|
| 314 |
+
"single_word": false,
|
| 315 |
+
"lstrip": false,
|
| 316 |
+
"rstrip": false,
|
| 317 |
+
"normalized": false,
|
| 318 |
+
"special": true
|
| 319 |
+
},
|
| 320 |
+
"200035": {
|
| 321 |
+
"content": "<|unused_200035|>",
|
| 322 |
+
"single_word": false,
|
| 323 |
+
"lstrip": false,
|
| 324 |
+
"rstrip": false,
|
| 325 |
+
"normalized": false,
|
| 326 |
+
"special": true
|
| 327 |
+
},
|
| 328 |
+
"200036": {
|
| 329 |
+
"content": "<|unused_200036|>",
|
| 330 |
+
"single_word": false,
|
| 331 |
+
"lstrip": false,
|
| 332 |
+
"rstrip": false,
|
| 333 |
+
"normalized": false,
|
| 334 |
+
"special": true
|
| 335 |
+
},
|
| 336 |
+
"200037": {
|
| 337 |
+
"content": "<|unused_200037|>",
|
| 338 |
+
"single_word": false,
|
| 339 |
+
"lstrip": false,
|
| 340 |
+
"rstrip": false,
|
| 341 |
+
"normalized": false,
|
| 342 |
+
"special": true
|
| 343 |
+
},
|
| 344 |
+
"200038": {
|
| 345 |
+
"content": "<|unused_200038|>",
|
| 346 |
+
"single_word": false,
|
| 347 |
+
"lstrip": false,
|
| 348 |
+
"rstrip": false,
|
| 349 |
+
"normalized": false,
|
| 350 |
+
"special": true
|
| 351 |
+
},
|
| 352 |
+
"200039": {
|
| 353 |
+
"content": "<|unused_200039|>",
|
| 354 |
+
"single_word": false,
|
| 355 |
+
"lstrip": false,
|
| 356 |
+
"rstrip": false,
|
| 357 |
+
"normalized": false,
|
| 358 |
+
"special": true
|
| 359 |
+
},
|
| 360 |
+
"200040": {
|
| 361 |
+
"content": "<|unused_200040|>",
|
| 362 |
+
"single_word": false,
|
| 363 |
+
"lstrip": false,
|
| 364 |
+
"rstrip": false,
|
| 365 |
+
"normalized": false,
|
| 366 |
+
"special": true
|
| 367 |
+
},
|
| 368 |
+
"200041": {
|
| 369 |
+
"content": "<|unused_200041|>",
|
| 370 |
+
"single_word": false,
|
| 371 |
+
"lstrip": false,
|
| 372 |
+
"rstrip": false,
|
| 373 |
+
"normalized": false,
|
| 374 |
+
"special": true
|
| 375 |
+
},
|
| 376 |
+
"200042": {
|
| 377 |
+
"content": "<|unused_200042|>",
|
| 378 |
+
"single_word": false,
|
| 379 |
+
"lstrip": false,
|
| 380 |
+
"rstrip": false,
|
| 381 |
+
"normalized": false,
|
| 382 |
+
"special": true
|
| 383 |
+
},
|
| 384 |
+
"200043": {
|
| 385 |
+
"content": "<|unused_200043|>",
|
| 386 |
+
"single_word": false,
|
| 387 |
+
"lstrip": false,
|
| 388 |
+
"rstrip": false,
|
| 389 |
+
"normalized": false,
|
| 390 |
+
"special": true
|
| 391 |
+
},
|
| 392 |
+
"200044": {
|
| 393 |
+
"content": "<|unused_200044|>",
|
| 394 |
+
"single_word": false,
|
| 395 |
+
"lstrip": false,
|
| 396 |
+
"rstrip": false,
|
| 397 |
+
"normalized": false,
|
| 398 |
+
"special": true
|
| 399 |
+
},
|
| 400 |
+
"200045": {
|
| 401 |
+
"content": "<|unused_200045|>",
|
| 402 |
+
"single_word": false,
|
| 403 |
+
"lstrip": false,
|
| 404 |
+
"rstrip": false,
|
| 405 |
+
"normalized": false,
|
| 406 |
+
"special": true
|
| 407 |
+
},
|
| 408 |
+
"200046": {
|
| 409 |
+
"content": "<|unused_200046|>",
|
| 410 |
+
"single_word": false,
|
| 411 |
+
"lstrip": false,
|
| 412 |
+
"rstrip": false,
|
| 413 |
+
"normalized": false,
|
| 414 |
+
"special": true
|
| 415 |
+
},
|
| 416 |
+
"200047": {
|
| 417 |
+
"content": "<|unused_200047|>",
|
| 418 |
+
"single_word": false,
|
| 419 |
+
"lstrip": false,
|
| 420 |
+
"rstrip": false,
|
| 421 |
+
"normalized": false,
|
| 422 |
+
"special": true
|
| 423 |
+
},
|
| 424 |
+
"200048": {
|
| 425 |
+
"content": "<|unused_200048|>",
|
| 426 |
+
"single_word": false,
|
| 427 |
+
"lstrip": false,
|
| 428 |
+
"rstrip": false,
|
| 429 |
+
"normalized": false,
|
| 430 |
+
"special": true
|
| 431 |
+
},
|
| 432 |
+
"200049": {
|
| 433 |
+
"content": "<|content_invoke_tool_json|>",
|
| 434 |
+
"single_word": false,
|
| 435 |
+
"lstrip": false,
|
| 436 |
+
"rstrip": false,
|
| 437 |
+
"normalized": false,
|
| 438 |
+
"special": true
|
| 439 |
+
},
|
| 440 |
+
"200050": {
|
| 441 |
+
"content": "<|unused_200050|>",
|
| 442 |
+
"single_word": false,
|
| 443 |
+
"lstrip": false,
|
| 444 |
+
"rstrip": false,
|
| 445 |
+
"normalized": false,
|
| 446 |
+
"special": true
|
| 447 |
+
},
|
| 448 |
+
"200051": {
|
| 449 |
+
"content": "<|unused_200051|>",
|
| 450 |
+
"single_word": false,
|
| 451 |
+
"lstrip": false,
|
| 452 |
+
"rstrip": false,
|
| 453 |
+
"normalized": false,
|
| 454 |
+
"special": true
|
| 455 |
+
},
|
| 456 |
+
"200052": {
|
| 457 |
+
"content": "<|unused_200052|>",
|
| 458 |
+
"single_word": false,
|
| 459 |
+
"lstrip": false,
|
| 460 |
+
"rstrip": false,
|
| 461 |
+
"normalized": false,
|
| 462 |
+
"special": true
|
| 463 |
+
},
|
| 464 |
+
"200053": {
|
| 465 |
+
"content": "<|unused_200053|>",
|
| 466 |
+
"single_word": false,
|
| 467 |
+
"lstrip": false,
|
| 468 |
+
"rstrip": false,
|
| 469 |
+
"normalized": false,
|
| 470 |
+
"special": true
|
| 471 |
+
},
|
| 472 |
+
"200054": {
|
| 473 |
+
"content": "<|unused_200054|>",
|
| 474 |
+
"single_word": false,
|
| 475 |
+
"lstrip": false,
|
| 476 |
+
"rstrip": false,
|
| 477 |
+
"normalized": false,
|
| 478 |
+
"special": true
|
| 479 |
+
},
|
| 480 |
+
"200055": {
|
| 481 |
+
"content": "<|unused_200055|>",
|
| 482 |
+
"single_word": false,
|
| 483 |
+
"lstrip": false,
|
| 484 |
+
"rstrip": false,
|
| 485 |
+
"normalized": false,
|
| 486 |
+
"special": true
|
| 487 |
+
},
|
| 488 |
+
"200056": {
|
| 489 |
+
"content": "<|unused_200056|>",
|
| 490 |
+
"single_word": false,
|
| 491 |
+
"lstrip": false,
|
| 492 |
+
"rstrip": false,
|
| 493 |
+
"normalized": false,
|
| 494 |
+
"special": true
|
| 495 |
+
},
|
| 496 |
+
"200057": {
|
| 497 |
+
"content": "<|content_invoke_tool_text|>",
|
| 498 |
+
"single_word": false,
|
| 499 |
+
"lstrip": false,
|
| 500 |
+
"rstrip": false,
|
| 501 |
+
"normalized": false,
|
| 502 |
+
"special": true
|
| 503 |
+
}
|
| 504 |
+
},
|
| 505 |
+
"response_template": {
|
| 506 |
+
"defaults": {
|
| 507 |
+
"role": "assistant"
|
| 508 |
+
},
|
| 509 |
+
"start_anchor_pattern": "<\\|end_message\\|>|<\\|content_model_end_sampling\\|>",
|
| 510 |
+
"fields": {
|
| 511 |
+
"reasoning_content": {
|
| 512 |
+
"open_pattern": "(?:<\\|message_model\\|>[^<]*)?<\\|content_thinking\\|>",
|
| 513 |
+
"close": "<|end_message|>",
|
| 514 |
+
"repeats": true,
|
| 515 |
+
"join": "",
|
| 516 |
+
"content": "text",
|
| 517 |
+
"content_args": {
|
| 518 |
+
"strip": false
|
| 519 |
+
}
|
| 520 |
+
},
|
| 521 |
+
"content": {
|
| 522 |
+
"open_pattern": "(?:<\\|message_model\\|>[^<]*)?<\\|content_(?:text|tool_error|invoke_tool_text)\\|>",
|
| 523 |
+
"close": "<|end_message|>",
|
| 524 |
+
"repeats": true,
|
| 525 |
+
"join": "",
|
| 526 |
+
"content": "text",
|
| 527 |
+
"content_args": {
|
| 528 |
+
"strip": false
|
| 529 |
+
}
|
| 530 |
+
},
|
| 531 |
+
"tool_calls": {
|
| 532 |
+
"open_pattern": "(?:<\\|message_model\\|>[^<]*)?<\\|content_invoke_tool_json\\|>",
|
| 533 |
+
"close": "<|end_message|>",
|
| 534 |
+
"repeats": true,
|
| 535 |
+
"content": "json",
|
| 536 |
+
"transform": {
|
| 537 |
+
"type": "function",
|
| 538 |
+
"function": {
|
| 539 |
+
"name": "{content.name}",
|
| 540 |
+
"arguments": "{content.args}"
|
| 541 |
+
}
|
| 542 |
+
}
|
| 543 |
+
}
|
| 544 |
+
}
|
| 545 |
+
},
|
| 546 |
+
"eos_token": "<|content_model_end_sampling|>",
|
| 547 |
+
"pad_token": "<|endoftext|>",
|
| 548 |
+
"chat_template": "{%- set eff = reasoning_effort if reasoning_effort is defined and reasoning_effort is not none else 0.1 -%}{%- for message in messages -%}{%- if message.role == 'system' -%}{{- '<|message_system|><|content_text|>' -}}{{- message.content -}}{{- '<|end_message|>' -}}{%- endif -%}{%- endfor -%}{{- '<|message_system|><|content_text|>Thinking effort level: ' -}}{{- eff -}}{{- '<|end_message|>' -}}{%- for message in messages -%}{%- if message.role == 'user' -%}{{- '<|message_user|><|content_text|>' -}}{{- message.content -}}{{- '<|end_message|>' -}}{%- elif message.role == 'assistant' -%}{{- '<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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Zero-dependency (stdlib + numpy) offline oracle & receipt verifier for Inkling QWork/1.
|
| 3 |
+
Exact circuit:
|
| 4 |
+
1. seed = SHA256(SHA256(header_80_bytes_with_nonce_zeroed)) (header[0:76] || 0x00000000)
|
| 5 |
+
2. expand(seed, header[76:80]) via xoshiro256** -> 1024-element {-1, +1} int32 vector x
|
| 6 |
+
3. 24-layer INT16/INT32 binary-activation gated-MLP using qwork.bin (72 matrices, 528,482,328 bytes):
|
| 7 |
+
x = sign(D @ (sign(G @ x) * sign(U @ x))) where sign(v) = +1 if v > 0 else -1
|
| 8 |
+
4. Pack 1024 bits (x > 0) little-endian -> 128 bytes -> XOR the 4x32-byte rows -> XOR with seed
|
| 9 |
+
5. digest = SHA256(32_bytes) -> 64 lowercase hex chars.
|
| 10 |
+
"""
|
| 11 |
+
import argparse
|
| 12 |
+
import hashlib
|
| 13 |
+
import json
|
| 14 |
+
import struct
|
| 15 |
+
import sys
|
| 16 |
+
from pathlib import Path
|
| 17 |
+
import numpy as np
|
| 18 |
+
|
| 19 |
+
QWORK_TABLE_SHA256 = "8f53884f7727e80b86f3ddf288d3c3f0f998f1c63b8cd4f0bdad182ddd3f2c03"
|
| 20 |
+
QWORK_HEADER_MAGIC = b"QWRK1\x00\x00\x00" + struct.pack("<4I", 24, 1024, 3584, 0)
|
| 21 |
+
MASK64 = (1 << 64) - 1
|
| 22 |
+
|
| 23 |
+
def _rotl64(x: int, k: int) -> int:
|
| 24 |
+
return ((x << k) | (x >> (64 - k))) & MASK64
|
| 25 |
+
|
| 26 |
+
def _splitmix64_mix(x: int) -> int:
|
| 27 |
+
x = ((x ^ (x >> 30)) * 0xBF58476D1CE4E5B9) & MASK64
|
| 28 |
+
x = ((x ^ (x >> 27)) * 0x94D049BB133111EB) & MASK64
|
| 29 |
+
return (x ^ (x >> 31)) & MASK64
|
| 30 |
+
|
| 31 |
+
def qwork_digest(header80: bytes, qwork_bin: Path, verify_table_hash: bool = False) -> str:
|
| 32 |
+
if len(header80) != 80:
|
| 33 |
+
raise ValueError(f"Expected 80-byte header, got {len(header80)}")
|
| 34 |
+
if verify_table_hash:
|
| 35 |
+
with qwork_bin.open("rb") as fh:
|
| 36 |
+
got = hashlib.file_digest(fh, "sha256").hexdigest()
|
| 37 |
+
if got != QWORK_TABLE_SHA256:
|
| 38 |
+
raise ValueError(f"qwork.bin SHA-256 mismatch: {got} != {QWORK_TABLE_SHA256}")
|
| 39 |
+
|
| 40 |
+
# 1. seed = SHA256(SHA256(header[0:76] + b'\x00\x00\x00\x00'))
|
| 41 |
+
seed_in = header80[:76] + b"\x00\x00\x00\x00"
|
| 42 |
+
seed = hashlib.sha256(hashlib.sha256(seed_in).digest()).digest()
|
| 43 |
+
|
| 44 |
+
# 2. expand(seed, header[76:80])
|
| 45 |
+
w0, w1, w2, w3 = struct.unpack("<4Q", seed)
|
| 46 |
+
nonce = struct.unpack("<I", header80[76:80])[0]
|
| 47 |
+
a = w0 ^ ((nonce << 32) | nonce)
|
| 48 |
+
s0 = _splitmix64_mix(a)
|
| 49 |
+
s1 = _splitmix64_mix((w1 + a) & MASK64)
|
| 50 |
+
s2 = _splitmix64_mix(w2 ^ _rotl64(a, 21))
|
| 51 |
+
s3 = _splitmix64_mix((w3 + _rotl64(a, 42)) & MASK64)
|
| 52 |
+
if (s0 | s1 | s2 | s3) == 0:
|
| 53 |
+
s0 |= 1
|
| 54 |
+
|
| 55 |
+
bits = np.empty(1024, dtype=np.int32)
|
| 56 |
+
for blk in range(16):
|
| 57 |
+
r = (_rotl64((s1 * 5) & MASK64, 7) * 9) & MASK64
|
| 58 |
+
t = (s1 << 17) & MASK64
|
| 59 |
+
s2 ^= s0
|
| 60 |
+
s3 ^= s1
|
| 61 |
+
s1 ^= s2
|
| 62 |
+
s0 ^= s3
|
| 63 |
+
s2 ^= t
|
| 64 |
+
s3 = _rotl64(s3, 45)
|
| 65 |
+
for j in range(64):
|
| 66 |
+
bits[blk * 64 + j] = 1 if ((r >> j) & 1) else -1
|
| 67 |
+
|
| 68 |
+
# 3. 24-layer INT16/INT32 binary-activation gated-MLP
|
| 69 |
+
x = bits
|
| 70 |
+
with qwork_bin.open("rb") as fh:
|
| 71 |
+
hdr = fh.read(24)
|
| 72 |
+
if hdr != QWORK_HEADER_MAGIC:
|
| 73 |
+
raise ValueError(f"Invalid qwork.bin header: {hdr!r}")
|
| 74 |
+
mm = np.memmap(qwork_bin, dtype="<i2", mode="r", offset=24)
|
| 75 |
+
pos = 0
|
| 76 |
+
for _ in range(24):
|
| 77 |
+
g_sz = 3584 * 1024
|
| 78 |
+
G = mm[pos : pos + g_sz].reshape(3584, 1024).astype(np.int32)
|
| 79 |
+
pos += g_sz
|
| 80 |
+
U = mm[pos : pos + g_sz].reshape(3584, 1024).astype(np.int32)
|
| 81 |
+
pos += g_sz
|
| 82 |
+
D = mm[pos : pos + g_sz].reshape(1024, 3584).astype(np.int32)
|
| 83 |
+
pos += g_sz
|
| 84 |
+
gx = np.where((G @ x) > 0, 1, -1).astype(np.int32)
|
| 85 |
+
ux = np.where((U @ x) > 0, 1, -1).astype(np.int32)
|
| 86 |
+
x = np.where((D @ (gx * ux)) > 0, 1, -1).astype(np.int32)
|
| 87 |
+
|
| 88 |
+
# 4. Pack 1024 bits little-endian -> 128 bytes -> XOR 4x32 rows -> XOR seed -> SHA256
|
| 89 |
+
b = (x > 0).astype(np.uint8).reshape(128, 8)
|
| 90 |
+
packed = (b @ np.array([1, 2, 4, 8, 16, 32, 64, 128], dtype=np.uint8)).astype(np.uint8)
|
| 91 |
+
folded = packed[0:32] ^ packed[32:64] ^ packed[64:96] ^ packed[96:128]
|
| 92 |
+
final_in = bytes(folded ^ np.frombuffer(seed, dtype=np.uint8))
|
| 93 |
+
return hashlib.sha256(final_in).hexdigest()
|
| 94 |
+
|
| 95 |
+
def parse_frame_bytes(frame_text: str) -> bytes:
|
| 96 |
+
"""Parse canonical 'INKLING QWORK/1:001:000:...;' into 80 bytes."""
|
| 97 |
+
s = frame_text.strip()
|
| 98 |
+
if not s.startswith("INKLING QWORK/1:") or not s.endswith(";"):
|
| 99 |
+
raise ValueError("Frame must start with 'INKLING QWORK/1:' and end with ';'")
|
| 100 |
+
parts = s[len("INKLING QWORK/1:") : -1].split(":")
|
| 101 |
+
if len(parts) != 80:
|
| 102 |
+
raise ValueError(f"Expected 80 decimal byte fields, got {len(parts)}")
|
| 103 |
+
return bytes(int(p, 10) for p in parts)
|
| 104 |
+
|
| 105 |
+
def verify_receipt_string(receipt_text: str, qwork_bin: Path, verify_table_hash: bool = False) -> dict:
|
| 106 |
+
"""Extract and verify a canonical '[QWORK_RECEIPT v=1 u=<hex> n=<8-hex> d=<64-hex>]' from any chat transcript."""
|
| 107 |
+
import re
|
| 108 |
+
m = re.search(r"\[QWORK_RECEIPT v=1 u=([0-9a-fA-F]) n=([0-9a-fA-F]{8}) d=([0-9a-fA-F]{64})\]", receipt_text)
|
| 109 |
+
if not m:
|
| 110 |
+
raise ValueError("No canonical [QWORK_RECEIPT v=1 ...] found in input text")
|
| 111 |
+
unit = int(m.group(1), 16)
|
| 112 |
+
nonce_hex = m.group(2).lower()
|
| 113 |
+
claimed = m.group(3).lower()
|
| 114 |
+
if unit < 1 or unit > 15:
|
| 115 |
+
raise ValueError(f"Invalid unit index: {unit}")
|
| 116 |
+
nb = bytes.fromhex(nonce_hex)
|
| 117 |
+
hdr = bytes([1, unit - 1, 0, 0]) + nb + bytes(68) + nb
|
| 118 |
+
computed = qwork_digest(hdr, qwork_bin, verify_table_hash=verify_table_hash)
|
| 119 |
+
return {
|
| 120 |
+
"version": 1,
|
| 121 |
+
"unit": unit,
|
| 122 |
+
"nonce": nonce_hex,
|
| 123 |
+
"claimed_digest": claimed,
|
| 124 |
+
"computed_digest": computed,
|
| 125 |
+
"valid": claimed == computed,
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
if __name__ == "__main__":
|
| 130 |
+
ap = argparse.ArgumentParser(description="Offline Inkling QWork/1 verifier")
|
| 131 |
+
ap.add_argument("--qwork-bin", type=Path, required=True)
|
| 132 |
+
ap.add_argument("--header-hex", type=str, help="80-byte header as 160 hex chars")
|
| 133 |
+
ap.add_argument("--frame", type=str, help="Canonical INKLING QWORK/1:...; string")
|
| 134 |
+
ap.add_argument("--receipt", type=str, help="Chat transcript or [QWORK_RECEIPT v=1 ...] string")
|
| 135 |
+
ap.add_argument("--expect", type=str, help="Expected 64-hex digest")
|
| 136 |
+
ap.add_argument("--verify-table", action="store_true")
|
| 137 |
+
args = ap.parse_args()
|
| 138 |
+
|
| 139 |
+
if args.receipt:
|
| 140 |
+
res = verify_receipt_string(args.receipt, args.qwork_bin, verify_table_hash=args.verify_table)
|
| 141 |
+
print(json.dumps(res, indent=2))
|
| 142 |
+
sys.exit(0 if res["valid"] else 1)
|
| 143 |
+
|
| 144 |
+
if args.header_hex:
|
| 145 |
+
hdr = bytes.fromhex(args.header_hex)
|
| 146 |
+
elif args.frame:
|
| 147 |
+
hdr = parse_frame_bytes(args.frame)
|
| 148 |
+
else:
|
| 149 |
+
# Built-in golden self-test vector (matches exact-model golden 168-token frame)
|
| 150 |
+
hdr = bytes([
|
| 151 |
+
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
| 152 |
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
| 153 |
+
0, 0, 0, 0, 168, 128, 224, 112, 190, 31, 67, 161, 171, 219, 0, 54,
|
| 154 |
+
219, 41, 228, 197, 141, 227, 232, 100, 108, 151, 137, 10, 184, 130, 25, 156,
|
| 155 |
+
249, 155, 220, 35, 96, 73, 245, 106, 255, 255, 0, 32, 6, 0, 0, 0
|
| 156 |
+
])
|
| 157 |
+
digest = qwork_digest(hdr, args.qwork_bin, verify_table_hash=args.verify_table)
|
| 158 |
+
out = {"header_hex": hdr.hex(), "digest": digest}
|
| 159 |
+
if args.expect:
|
| 160 |
+
out["expected"] = args.expect.lower()
|
| 161 |
+
out["match"] = digest == args.expect.lower()
|
| 162 |
+
print(json.dumps(out, indent=2))
|
| 163 |
+
if args.expect and digest != args.expect.lower():
|
| 164 |
+
sys.exit(1)
|