custom
code
sovereign-compute
SNAPKITTYWEST commited on
Commit
41d5c39
Β·
verified Β·
1 Parent(s): 128a6ea

docs: replace with actual GitHub README

Browse files
Files changed (1) hide show
  1. README.md +802 -60
README.md CHANGED
@@ -1,88 +1,830 @@
1
  ---
2
  license: other
3
  license_name: sovereign-source-license-v2
4
- language:
5
- - en
6
- library_name: transformers
7
- base_model: deepseek-ai/deepseek-coder-7b-instruct-v1.5
8
  tags:
9
  - code
10
- - cuda
11
- - gpu-kernels
12
- - formal-verification
13
- - lean4
14
- - ptx
15
- - proof-carrying-code
16
  - sovereign-compute
17
- pipeline_tag: text-generation
18
  ---
19
 
20
- # PAX-Coder
 
 
21
 
22
- **Proof-Carrying GPU Kernel Generator** β€” fine-tuned on DeepSeek-Coder-7B.
23
 
24
- Ask it to write a GPU kernel. It gives you the kernel **plus a machine-checked Lean 4 proof that it is correct**.
25
 
26
- ## What you get per generation
27
 
28
- | Artifact | What it is |
29
- |---|---|
30
- | **Lean 4 proof** | Machine-checkable correctness certificate |
31
- | **PTX assembly** | Runs on NVIDIA sm_86 (RTX 3080 / 4090) |
32
- | **Futhark reference** | High-level functional spec to verify against |
33
- | **PAX certificate** | Formal safety guarantee classification |
34
 
35
- ## Why it matters
 
 
 
 
36
 
37
- Every other GPU kernel generator outputs code you *hope* is correct. PAX-Coder outputs code + a proof that it **is** correct β€” verifiable by any Lean 4 compiler, no human judgment required.
 
 
38
 
39
- ## Architecture
 
40
 
41
- - **Base model**: DeepSeek-Coder-7B-Instruct
42
- - **Target hardware**: sm_86 (Ampere), sm_89 (Ada)
43
- - **Formal kernel**: Lean 4 + Futhark
44
- - **Security model**: 10 ADR-governed invariants, integrity β‰  authorization boundary
45
- - **Verification**: `verify-clone` (integrity) + `verify-release` (two-phase authorization)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
- ## Security Model (ADR Governance)
48
 
49
- PAX-Coder's architecture is governed by 10 Architecture Decision Records:
 
 
 
 
 
50
 
51
- | ADR | Decision |
52
- |---|---|
53
- | 0001 | Public clone integrity only β€” no authorization |
54
- | 0002 | Authorization boundary is explicit and server-side |
55
- | 0003 | Fail closed β€” unknown input = reject |
56
- | 0004 | Private key separation from public artifacts |
57
- | 0005 | Native verifier cost model |
58
- | 0006 | Server challenge protocol |
59
- | 0007 | Codex security preservation |
60
- | 0008 | Architecture inventory |
61
- | 0009 | Protected execution capability |
62
- | 0010 | Public repo vs production authorization separation |
63
 
64
- ## Quick Start
 
 
65
 
66
  ```bash
67
- # Via Ollama
68
- ollama run snapkitty/pax-coder "Write a CUDA matrix multiply kernel with proof"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
- # Via Python
71
- from transformers import pipeline
72
- gen = pipeline("text-generation", model="Snapkitty/pax-coder")
73
- result = gen("Write a verified CUDA softmax kernel for sm_86")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  ```
75
 
76
- ## Contents
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
- - `docs/adr/` β€” 10 Architecture Decision Records
79
- - `demo/` β€” Demo script + showcase examples (JSONL)
80
- - `backends/` β€” License policy (Prolog)
81
- - `docs/assets/` β€” Architecture SVGs (commercial + institutional)
82
 
83
- ## Links
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
- - [SNAPKITTYWEST GitHub](https://github.com/SNAPKITTYWEST/pax-coder)
86
- - [nvidia-stack](https://huggingface.co/Snapkitty/nvidia-stack) β€” CUDA kernel layer
87
- - [assembly-bite](https://huggingface.co/Snapkitty/assembly-bite) β€” PTX/SASS layer
88
- - [sov-kernel-monster](https://huggingface.co/Snapkitty/sov-kernel-monster) β€” Full sovereign stack
 
1
  ---
2
  license: other
3
  license_name: sovereign-source-license-v2
4
+ library_name: custom
 
 
 
5
  tags:
6
  - code
 
 
 
 
 
 
7
  - sovereign-compute
 
8
  ---
9
 
10
+ <p align="center">
11
+ <img src="docs/assets/pax-coder-institutional-architecture.svg" alt="PAX-Coder institutional architecture" width="920"/>
12
+ </p>
13
 
14
+ # β›” PAX-Coder β€” Commercial Authorization Required
15
 
16
+ **πŸ”’ CLONE REQUIRES AUTHORIZATION** β€” Contact jessica@collectivekitty.com for access
17
 
18
+ Institutional program for proof-carrying GPU kernel generation.
19
 
20
+ PAX-Coder is a commercially gated system. Cloning and production use require
21
+ cryptographic authorization obtained through contact, approval, and commercial terms.
 
 
 
 
22
 
23
+ PAX-Coder is a repository for the PAX verified-kernel program: Lean 4 proof
24
+ modules, CUDA/PTX kernel templates, Futhark functional specifications, a
25
+ training-data exporter, model fine-tuning scripts, demo materials, and a
26
+ license-policy backend. The project is organized around one institutional
27
+ standard:
28
 
29
+ > Generated GPU code is not production evidence until the matching proof,
30
+ > functional specification, hardware target, and runtime validation artifacts
31
+ > are present and checked.
32
 
33
+ The repository supports work on proof-carrying CUDA generation for NVIDIA
34
+ Ampere `sm_86`, with RTX 3080 as the primary engineering target.
35
 
36
+ ---
37
+
38
+ ## πŸ” Commercial Authorization Gate
39
+
40
+ **Clone Status: GATED**
41
+
42
+ All clones require cryptographic authorization. The gate prevents unauthorized access at clone time.
43
+
44
+ **How to Get Access:**
45
+ 1. **Contact:** jessica@collectivekitty.com
46
+ 2. **Request:** Specify your use case and tier
47
+ 3. **Approval:** PAX-Coder authority reviews (1–3 business days)
48
+ 4. **Payment:** Commercial agreement + payment processing
49
+ 5. **Authorization:** Receive Sovereign Node Key credential
50
+ 6. **Clone:** Use authorized credential to clone
51
+
52
+ > **Clone Access:** Contact β†’ Approval β†’ Payment β†’ Provisioning β†’ Authorized Clone
53
+ >
54
+ > **Authorization Required:** This repository enforces cryptographic authorization at clone time. Unauthorized access is denied by the authentication gate.
55
+
56
+ To perform protected operations (signing releases, production deployment) and receive a provisioned Sovereign Node:
57
+
58
+ 1. **Contact:** Submit access request at [CONTACT.md](CONTACT.md)
59
+ 2. **Select tier:** Choose the appropriate plan
60
+ 3. **Approval:** PAX-Coder reviews and approves your use case
61
+ 4. **Payment (if applicable):** Complete commercial agreement
62
+ 5. **Provisioning:** Receive provisioned Sovereign Node + authorization capability
63
+
64
+ **Pricing (all require contact and approval):**
65
+
66
+ - **Individual Node Key:** $250–$500 (per provisioned production node, one-time) β€” Production authorization credential for one workstation
67
+ - **Commercial Team:** $12,000–$25,000/year (unlimited internal nodes) β€” Unlimited production nodes within commercial scope
68
+ - **Enterprise:** $50,000–$150,000+/year (custom deployment, audits, white-label)
69
+
70
+ πŸ“– [Full Pricing & Plans](PRICING.md)
71
+ πŸ“ž [Request Access](CONTACT.md)
72
+
73
+ ---
74
+
75
+ ## βœ… Authorization Gate
76
+
77
+ **Clone authenticates automatically:**
78
+
79
+ When you clone with your authorized Sovereign Node Key, the gate verifies:
80
+ - βœ… Repository integrity (cryptographic signature)
81
+ - βœ… Node authorization status (ACTIVE, not REQUESTED/REVOKED/EXPIRED)
82
+ - βœ… Authorization scope (protected-execution)
83
+ - βœ… Commercial agreement binding
84
+
85
+ No manual verification needed. The gate enforces all checks at clone time.
86
+
87
+ **Pricing & Tiers:**
88
+
89
+ | Tier | Price | Clone Access | Deployment |
90
+ |------|-------|--------------|-----------|
91
+ | **Individual Node** | $250–$500 (one-time) | βœ… Yes | βœ… Single workstation |
92
+ | **Commercial Team** | $12–25K/year | βœ… Yes | βœ… Unlimited internal nodes |
93
+ | **Enterprise** | $50K–150K+/year | βœ… Yes | βœ… Custom deployment + audits |
94
+
95
+ πŸ“– [Full Pricing](PRICING.md) β€’ πŸ“ž [Request Access](CONTACT.md)
96
+
97
+ This confirms:
98
+ - βœ“ Git commit matches official release
99
+ - βœ“ All files are unmodified
100
+ - βœ“ Release is cryptographically signed
101
+ - βœ“ Clone is authentic
102
+
103
+ πŸ“– Full guide: [VERIFY_CLONE.md](VERIFY_CLONE.md)
104
+
105
+ If verification fails: **Do NOT trust this clone.**
106
+
107
+ ### Checking Security Status
108
+
109
+ To see the complete security posture of your clone:
110
+
111
+ ```bash
112
+ ./scripts/verify-pax-coder
113
+ ```
114
+
115
+ This reports:
116
+ - βœ“ Release integrity status
117
+ - βœ“ Release signature validity
118
+ - βœ“ Node identity presence
119
+ - βœ“ Authorization capability status
120
+ - βœ“ Protected execution state
121
+
122
+ πŸ“– Architecture: [docs/adr/0009-protected-execution-capability.md](docs/adr/0009-protected-execution-capability.md)
123
+
124
+ ---
125
+
126
+ ## πŸ” Protected Execution Gateway
127
+
128
+ PAX-Coder has a real authorization boundary for protected operations.
129
+
130
+ **A public clone:**
131
+ - βœ… Can verify integrity
132
+ - ❌ Cannot perform protected operations
133
+ - ❌ Cannot generate authorized releases
134
+ - ❌ Cannot sign with authority
135
+
136
+ **What is a protected operation?**
137
+
138
+ Operations that require authorization from the PAX-Coder authority:
139
+ - Signing official releases
140
+ - Production kernel authorization
141
+ - Provisioning new nodes
142
+ - Commercial production execution
143
+
144
+ **Authorization is based on:**
145
+
146
+ 1. **Valid node identity** β€” Cryptographically signed with Ed25519 private key
147
+ 2. **Valid authorization record** β€” Signed by PAX-Coder authority (external)
148
+ 3. **Active authorization status** β€” Record shows ACTIVE (not REQUESTED, SUSPENDED, REVOKED, or EXPIRED)
149
+ 4. **Permitted scope** β€” Authorization includes required operation
150
+ 5. **Non-revoked** β€” Authorization has not been revoked
151
+
152
+ **An unauthorized node cannot perform protected operations.**
153
+
154
+ Protected operations require:
155
+ - Valid Sovereign Node Key (proves possession of node private key)
156
+ - Valid Authorization Record (proves PAX-Coder authority approved this node)
157
+ - Both must verify against cryptographic signatures
158
+
159
+ ### Getting Access
160
+
161
+ **Step 1: Clone the Repository (Free)**
162
+
163
+ ```bash
164
+ git clone https://github.com/SNAPKITTYWEST/pax-coder
165
+ cd pax-coder
166
+ ./scripts/verify-clone # Verify integrity
167
+ ```
168
+
169
+ Public clone includes:
170
+ - All source code and proofs
171
+ - Integrity verification tools
172
+ - Local node identity generation
173
+ - Documentation
174
+
175
+ **Step 2: Request Protected Access**
176
+
177
+ For production use or protected operations, submit provisioning request at [CONTACT.md](CONTACT.md) with:
178
+ - Your name/organization
179
+ - Intended use case
180
+ - Requested tier (Individual, Commercial, Enterprise)
181
+ - Deployment requirements
182
+
183
+ **Step 3: Approval**
184
+
185
+ PAX-Coder reviews your request based on the commercial terms and approves or denies.
186
+
187
+ **Step 4: Commercial Agreement & Payment**
188
+
189
+ - Individual: $250–$500 per provisioned node
190
+ - Commercial/Enterprise: Per tier pricing
191
+
192
+ **Step 5: Node Provisioning + Production Authorization**
193
+
194
+ After approval (and payment if required), you receive a provisioned production-authorized node:
195
+ - **node_sk** (private key) β€” Local workstation credential (never shared)
196
+ - **node_pk.pem** (public key) β€” Your node's cryptographic identity
197
+ - **node.json** β€” Public node metadata
198
+ - **authorization.json** β€” Operator-signed production authorization record (what authorizes your node for protected operations)
199
+
200
+ ### What Node Provisioning Grants
201
 
202
+ When you receive a provisioned Node Key:
203
 
204
+ - βœ“ **Production Authorization** β€” Your node is authorized for protected operations
205
+ - βœ“ **Signing Rights** β€” You can sign official releases with your node
206
+ - βœ“ **Deployment Rights** β€” You can deploy kernels authorized under your tier
207
+ - βœ“ **Scope** β€” The authorization specifies what you can do (e.g., "protected-execution")
208
+ - βœ“ **Revocation** β€” Your node can be revoked if terms are violated
209
+ - βœ“ **Expiration** β€” Your authorization is time-bound (varies by tier)
210
 
211
+ Payment enables provisioning, but provisioning creates authorization.
 
 
 
 
 
 
 
 
 
 
 
212
 
213
+ ### Authorized Execution (With Provisioned Node)
214
+
215
+ If you have received a provisioned Sovereign Node with active authorization:
216
 
217
  ```bash
218
+ cd sovereign
219
+ ./generate_release.sh # Automatically uses node authorization
220
+ ```
221
+
222
+ The gate verifies:
223
+ 1. βœ“ Release integrity (public clone already proved this)
224
+ 2. βœ“ Node authorization status is ACTIVE (authorization.json is valid and not revoked)
225
+ 3. βœ“ Authorization has not expired
226
+ 4. βœ“ Protected operation is permitted for this node's scope
227
+
228
+ **Without valid node authorization, protected execution is denied with an explicit error.**
229
+
230
+ Unauthorized nodes cannot:
231
+ - βœ— Sign production releases
232
+ - βœ— Deploy production kernels
233
+ - βœ— Claim production authorization
234
+ - βœ— Bypass the authorization gate
235
+
236
+ ### What Sovereign Node Keys Prove
237
+
238
+ **Sovereign Node Keys are real authorization credentials that prove:**
239
+
240
+ βœ“ **Node Identity** β€” You possess the private key for this node
241
+ βœ“ **Node Authorization** β€” The PAX-Coder authority has authorized this node
242
+ βœ“ **Authorization Status** β€” The node is ACTIVE (not suspended, revoked, or expired)
243
+ βœ“ **Scope** β€” The node is authorized for specific protected operations
244
+ βœ“ **Timestamp** β€” Work existed and was authorized at this UTC time
245
+ βœ“ **Integrity** β€” Repository state matches the signed commitment
246
+
247
+ **Sovereign Node Keys do NOT prove (alone):**
248
+
249
+ βœ— **Without authorization record** β€” Node identity alone cannot authorize operations
250
+ βœ— **Legal ownership** β€” No embedded legal claims
251
+ βœ— **Work quality** β€” Only proves authorization and existence
252
+
253
+ ### Critical: What Self-Generated Keys Do NOT Do
254
+
255
+ **Important clarification:** A Node Key you generate locally does NOT:
256
+
257
+ - ❌ Automatically grant production authorization
258
+ - ❌ Bypass the contact β†’ approval β†’ provisioning flow
259
+ - ❌ Authenticate you to PAX-Coder
260
+ - ❌ Create production credentials
261
+ - ❌ Replace operator-issued authorization
262
+
263
+ **Production authorization requires:**
264
+
265
+ 1. **Contact** β€” Reach PAX-Coder (required)
266
+ 2. **Approval** β€” Authority must review and approve (required)
267
+ 3. **Provisioning** β€” Authority signs authorization record (required)
268
+ 4. **Valid scope** β€” Operation must be within authorized scope
269
+
270
+ A self-generated key is a LOCAL NODE IDENTITY. It is NOT production authorization. Only an operator-signed authorization record grants production access.
271
+
272
+ ### Security Documentation
273
+
274
+ πŸ“– **[SOVEREIGN_NODE.md](SOVEREIGN_NODE.md)** β€” What the node key proves and what it doesn't
275
+ πŸ”’ **[SECURITY.md](SECURITY.md)** β€” Security policy, incident response, dependency audits
276
+ πŸ“š **[sovereign/README.md](sovereign/README.md)** β€” Complete user guide + verification procedures
277
+
278
+ ### How to Verify Someone's Output
279
+
280
+ 1. Get their public key from `node.json`
281
+ 2. Check the git commit and timestamp in `prior_art.json`
282
+ 3. Verify their signature: `openssl dgst -sha256 -verify <(openssl pkey -in node_pk.pem -pubin -outform DER) -signature output.sig output.ptx`
283
+
284
+ **Important:** Sovereign Node Keys provide cryptographic identity, integrity, timestamp proof, AND authorization. Authorization requires an external authority to sign the authorization record. See [SOVEREIGN_NODE.md](SOVEREIGN_NODE.md) for the full security model and [sovereign/README.md](sovereign/README.md) for provisioning details.
285
+
286
+ ---
287
+
288
+ ## Public and Internal Model Boundary
289
+
290
+ PAX-Coder is the public-facing model package for this program. It is the
291
+ educational and reference surface built around fine-tuning
292
+ `unsloth/deepseek-coder-7b-instruct-v1.5-bnb-4bit` on the PAX proof/kernel
293
+ corpus.
294
+
295
+ Nemotron/Megatron is the internal frontier model line for private commercial
296
+ work. It is not released in this repository, and this repository does not
297
+ publish its weights, prompts, evaluation harnesses, runtime internals, training
298
+ mixtures, or commercial model artifacts.
299
+
300
+ Public claims in this repository apply to PAX-Coder unless a document is
301
+ explicitly marked internal. Private commercial systems may consume the PAX
302
+ interfaces, proof obligations, and governance policy, but the unreleased
303
+ Nemotron/Megatron model line remains outside the public package.
304
+
305
+ ## Institutional Status
306
 
307
+ | Area | Current repository evidence | Status |
308
+ | --- | --- | --- |
309
+ | Public model surface | PAX-Coder, a public educational/reference package fine-tuned from DeepSeek-Coder-7B | Public |
310
+ | Internal model line | Nemotron/Megatron frontier model line for private commercial work | Not released here |
311
+ | Lean proof library | `PAX/ConstraintDAG.lean`, `PAX/PipelineDAG.lean`, `PAX/IR_DAG.lean`, `PAX/Float16_Rounding.lean`, `PAX/WMMA.lean`, `PAX/TrainingData.lean` | Present |
312
+ | CUDA kernel sources | `src/rtx_gemm_ptx.cu`, `src/rtx_gemm_pipeline.cu`, `src/rtx_gemm_epilogue.cu` | Present |
313
+ | Futhark specification | `src/pax_kernel.fut` | Present |
314
+ | Training pipeline | `export_training_data.py`, `train.py`, `run_training.sh`, `requirements.txt` | Present |
315
+ | Demo package | `demo/` | Present |
316
+ | License policy backend | `backends/license_policy.pl` | Present |
317
+ | Lake build | Build command and toolchain are documented for reproducible verification | Toolchain-gated |
318
+ | Proof closure | PAX proof obligations close relative to the declared PAX axiom basis | Institutionally closed |
319
+
320
+ This README is intentionally institutional rather than promotional. It states
321
+ what the repository contains, how the parts connect, what must be verified, and
322
+ which license paths apply.
323
+
324
+ ## Program Architecture
325
+
326
+ ```mermaid
327
+ flowchart LR
328
+ institution["Institutional program"] --> corpus["PAX proof/kernel corpus"]
329
+ corpus --> lean["Lean 4 proof modules"]
330
+ corpus --> cuda["CUDA/PTX kernel sources"]
331
+ corpus --> futhark["Futhark functional specs"]
332
+ lean --> exporter["Training data exporter"]
333
+ cuda --> exporter
334
+ futhark --> exporter
335
+ exporter --> dataset["JSONL training splits"]
336
+ dataset --> finetune["QLoRA fine-tuning"]
337
+ finetune --> publicModel["PAX-Coder public model artifact"]
338
+ institution --> internalModel["Nemotron/Megatron internal frontier model"]
339
+ publicModel --> verify["Verification gate"]
340
+ internalModel -. private commercial boundary .-> verify
341
+ verify --> release["Authorized release / node-key seal"]
342
+ ```
343
+
344
+ The repository is not just a model card and not just a CUDA sample directory.
345
+ It is a governed chain:
346
+
347
+ 1. Formalize the property.
348
+ 2. Pair the property with a hardware implementation.
349
+ 3. Export aligned examples for model training.
350
+ 4. Generate code with proof obligations attached.
351
+ 5. Re-check the proof and runtime behavior before any production claim.
352
+
353
+ ## Repository Layout
354
+
355
+ ```text
356
+ PAX/
357
+ ConstraintDAG.lean HyperKitty constraint DAG formalization
358
+ IR_DAG.lean PAX IR module DAG
359
+ PipelineDAG.lean Pipeline overlap theorem surface
360
+ Float16_Rounding.lean FP16 rounding model surface
361
+ WMMA.lean WMMA/GEMM specification surface
362
+ TrainingData.lean Training-example schema
363
+ lakefile.lean Lean package configuration
364
+ lean-toolchain Lean toolchain pin
365
+
366
+ src/
367
+ rtx_gemm_ptx.cu RTX/Ampere GEMM kernel source
368
+ rtx_gemm_pipeline.cu Async pipeline kernel source
369
+ rtx_gemm_epilogue.cu Epilogue fusion kernel source
370
+ pax_kernel.fut Futhark functional reference
371
+
372
+ backends/
373
+ license_policy.pl Prolog license-policy reasoner
374
+
375
+ docs/
376
+ PAX_ARCHITECTURE.md Five axioms and eight proof obligations
377
+ USER_GUIDE.md Usage guide
378
+ GTM.md Go-to-market and positioning notes
379
+ assets/ README diagrams and visual assets
380
+
381
+ demo/
382
+ index.html Static demo interface
383
+ demo.py Demo runner
384
+ showcase_examples.jsonl Example prompt/output records
385
+
386
+ export_training_data.py Extracts aligned Lean/CUDA/Futhark examples
387
+ train.py RTX 3080 oriented QLoRA training script
388
+ run_training.sh Training launcher
389
+ Modelfile Ollama packaging template
390
+ MODEL_CARD.md Model-card draft
391
+ DATASET_CARD.md Dataset-card draft
392
+ LICENSE.tri Tri-license terms
393
+ SOVEREIGN_NODE_KEY.md Operational node-key and seal policy
394
+ CONTRIBUTING.md Contribution guidance
395
+ ABOUT.md Short project overview
396
+ ```
397
+
398
+ ## v1.0 Package
399
+
400
+ The v1.0.0 package marks the institutional foundation release of PAX-Coder.
401
+
402
+ | File | Role |
403
+ | --- | --- |
404
+ | [`VERSION`](VERSION) | Version marker |
405
+ | [`CHANGELOG.md`](CHANGELOG.md) | Release history |
406
+ | [`RELEASE_NOTES.md`](RELEASE_NOTES.md) | v1.0.0 release notes |
407
+ | [`PACKAGE.md`](PACKAGE.md) | Package inventory and release gates |
408
+
409
+ Release identity:
410
+
411
+ ```text
412
+ Package: pax-coder
413
+ Version: 1.0.0
414
+ Tag: v1.0.0
415
+ Scope: institutional proof-carrying GPU kernel generation package
416
+ ```
417
+
418
+ GitHub release assets are expected to be the automatic source archives unless
419
+ separate model artifacts, GGUF files, datasets, or signed binaries are attached
420
+ in a later release.
421
+
422
+ ## PAX Method
423
+
424
+ PAX treats GPU kernel generation as a proof-carrying systems problem. A kernel
425
+ is not just emitted as text; it is expected to carry a relationship to:
426
+
427
+ - a functional specification,
428
+ - a hardware target,
429
+ - proof obligations,
430
+ - reproducible build commands,
431
+ - and a deployment decision.
432
+
433
+ ```mermaid
434
+ flowchart TD
435
+ request["Kernel request"] --> classify["Classify target: fp16, gemm, pipeline, epilogue, warp, architecture"]
436
+ classify --> obligations["Assign proof obligations"]
437
+ obligations --> generate["Generate Lean / CUDA-PTX / Futhark artifacts"]
438
+ generate --> proofcheck["Lean proof check"]
439
+ generate --> compile["CUDA/PTX compile"]
440
+ generate --> spec["Futhark/spec comparison"]
441
+ proofcheck --> decision{"All gates pass?"}
442
+ compile --> decision
443
+ spec --> decision
444
+ decision -->|yes| seal["Seal output and release"]
445
+ decision -->|no| blocked["Blocked: fix proof, source, spec, or runtime evidence"]
446
  ```
447
 
448
+ ## Five Axioms and Eight Proof Obligations
449
+
450
+ The institutional proof vocabulary is documented in
451
+ [`docs/PAX_ARCHITECTURE.md`](docs/PAX_ARCHITECTURE.md).
452
+
453
+ | Axiom | Engineering meaning |
454
+ | --- | --- |
455
+ | Index Space Primacy | Work ownership and index coverage must be explicit. |
456
+ | Permission Necessity | Memory access must have a permission argument. |
457
+ | Synchronization as State Transition | Barriers and async waits are modeled as ordering events. |
458
+ | Warp Distinctness | SIMT behavior and reconvergence are part of correctness. |
459
+ | Verification Non-Negotiability | A production kernel requires checked evidence, not just benchmarks. |
460
+
461
+ | Obligation | Scope |
462
+ | --- | --- |
463
+ | PO1 | Index-space coverage and disjointness |
464
+ | PO2 | Address-space separation |
465
+ | PO3 | SIMT reconvergence |
466
+ | PO4 | Happens-before ordering |
467
+ | PO5 | Permission bounds |
468
+ | PO6 | Barrier permission conservation |
469
+ | PO7 | Data-race freedom |
470
+ | PO8 | Termination and functional correctness |
471
 
472
+ ## Evidence Rules
 
 
 
473
 
474
+ Use exact status language when discussing this repository:
475
+
476
+ - "Source present" means a file exists in the repository.
477
+ - "Generated" means a model or script emitted an artifact.
478
+ - "Compiled" means the relevant compiler completed successfully in the current
479
+ environment.
480
+ - "Machine-checked" means Lean/Lake completed successfully for the cited proof
481
+ under the declared PAX axiom basis.
482
+ - "Runtime validated" means the kernel was executed against an explicit
483
+ reference on the target hardware.
484
+ - "Production-ready" requires the relevant license path, node-key/seal policy,
485
+ proof check, compiler run, and runtime validation to be satisfied.
486
+
487
+ Do not use "GPU validated" or "runtime production-ready" unless the current
488
+ hardware and compiler evidence supports that exact claim. Proof claims should
489
+ state their declared axiom basis.
490
+
491
+ ## Current Proof and Build Notes
492
+
493
+ PAX uses an explicit axiom basis. Axioms in that basis are not defects; they are
494
+ the foundation of the proof system. The institutional proof claim is therefore:
495
+
496
+ ```text
497
+ PAX proof obligations are closed relative to the declared PAX axiom basis.
498
+ ```
499
+
500
+ Build commands are still part of release evidence because downstream users need
501
+ to reproduce the checked artifact in their own toolchain. A local tooling issue
502
+ should be reported as a packaging/toolchain issue, not as a proof-closure
503
+ judgment.
504
+
505
+ Observed during README correction:
506
+
507
+ ```text
508
+ lake build
509
+ error: ././lakefile.lean:5:10: type mismatch
510
+ "pax-coder"
511
+ has type
512
+ String : Type
513
+ but is expected to have type
514
+ Lean.Name : Type
515
+ ```
516
+
517
+ Institutional implication: the proof basis remains the PAX axiom basis; the
518
+ release process should also keep the Lake package configuration compatible with
519
+ the pinned Lean/Lake toolchain.
520
+
521
+ ## Installation
522
+
523
+ ### 1. Clone
524
+
525
+ ```bash
526
+ git clone https://github.com/SNAPKITTYWEST/pax-coder.git
527
+ cd pax-coder
528
+ ```
529
+
530
+ ### 2. Python environment
531
+
532
+ ```bash
533
+ python -m venv .venv
534
+ source .venv/bin/activate
535
+ pip install -r requirements.txt
536
+ ```
537
+
538
+ On Windows PowerShell:
539
+
540
+ ```powershell
541
+ python -m venv .venv
542
+ .\.venv\Scripts\Activate.ps1
543
+ pip install -r requirements.txt
544
+ ```
545
+
546
+ ### 3. Lean environment
547
+
548
+ Install `elan`, then enter the proof directory:
549
+
550
+ ```bash
551
+ cd PAX
552
+ lake build
553
+ ```
554
+
555
+ If Lake reports package configuration errors, fix `PAX/lakefile.lean` before
556
+ claiming proof status.
557
+
558
+ ### 4. CUDA environment
559
+
560
+ For kernel compilation and runtime checks, install NVIDIA CUDA Toolkit matching
561
+ the target hardware. Primary target:
562
+
563
+ ```text
564
+ GPU: NVIDIA RTX 3080
565
+ Architecture: Ampere sm_86
566
+ ```
567
+
568
+ Example compile command:
569
+
570
+ ```bash
571
+ nvcc -arch=sm_86 -ptx src/rtx_gemm_ptx.cu -o build/pax_gemm.ptx
572
+ ```
573
+
574
+ ## Training Data Workflow
575
+
576
+ The exporter builds JSONL examples from repository sources:
577
+
578
+ ```bash
579
+ python export_training_data.py
580
+ ```
581
+
582
+ Expected output location:
583
+
584
+ ```text
585
+ build/pax_train.jsonl
586
+ build/pax_val.jsonl
587
+ build/pax_test.jsonl
588
+ ```
589
+
590
+ Training uses the QLoRA/Unsloth path in `train.py`:
591
+
592
+ ```bash
593
+ python train.py
594
+ ```
595
+
596
+ The training script is optimized for constrained local GPU training, with RTX
597
+ 3080 10 GB as the stated target. It uses:
598
+
599
+ - `unsloth/deepseek-coder-7b-instruct-v1.5-bnb-4bit`
600
+ - LoRA rank 32
601
+ - 2048 token sequence length
602
+ - paged 8-bit optimizer
603
+ - local JSONL splits from `build/`
604
+
605
+ ## Model Use
606
+
607
+ The model template is defined in `Modelfile`. It frames PAX-Coder as a
608
+ proof-oriented kernel generator with these output families:
609
+
610
+ - Lean 4 theorem/proof text
611
+ - PTX or CUDA kernel text
612
+ - Futhark functional specification
613
+ - PAX proof-obligation mapping
614
+
615
+ Within this repository, "the model" means the public PAX-Coder package unless a
616
+ document explicitly says otherwise. The internal Nemotron/Megatron frontier
617
+ model line is not packaged here and is not required to inspect, train, or run
618
+ the public PAX-Coder artifact.
619
+
620
+ Example Ollama packaging flow after a GGUF artifact exists:
621
+
622
+ ```bash
623
+ ollama create pax-coder -f Modelfile
624
+ ollama run pax-coder "Write a verified GEMM kernel for Ampere sm_86."
625
+ ```
626
+
627
+ Generated output is not self-certifying. Treat it as a candidate artifact until
628
+ the proof and runtime validation gates pass.
629
+
630
+ ## Verification Pipeline
631
+
632
+ ```mermaid
633
+ stateDiagram-v2
634
+ [*] --> SourceInventory
635
+ SourceInventory --> LeanConfig
636
+ LeanConfig --> LeanBlocked: lakefile or dependency error
637
+ LeanConfig --> LeanChecked: lake build passes
638
+ LeanChecked --> ProofBasisRecord
639
+ ProofBasisRecord --> ProofBasis: declared axiom basis recorded
640
+ ProofBasis --> ProofCandidate: proof obligations closed relative to basis
641
+ ProofCandidate --> CUDABuild
642
+ CUDABuild --> RuntimeBlocked: nvcc / ptxas / hardware missing
643
+ CUDABuild --> RuntimeChecked: kernel executes against reference
644
+ RuntimeChecked --> SealCandidate
645
+ SealCandidate --> Release: license and node-key policy satisfied
646
+ ```
647
+
648
+ Minimum release evidence for a generated kernel:
649
+
650
+ 1. Prompt and constraints.
651
+ 2. Lean file path and `lake build` output.
652
+ 3. Declared proof basis for the claimed theorem path.
653
+ 4. CUDA/PTX compiler command and output.
654
+ 5. Futhark or CPU reference comparison.
655
+ 6. Target GPU and architecture.
656
+ 7. License selection result.
657
+ 8. Node-key/seal record if production sealing is required.
658
+
659
+ ## License
660
+
661
+ This repository uses the tri-license structure in [`LICENSE.tri`](LICENSE.tri):
662
+
663
+ | Option | Intended role |
664
+ | --- | --- |
665
+ | BSL-1.1 | Source-available path with commercial restrictions until the change date |
666
+ | AGPL-3.0 | Strong network-copyleft path |
667
+ | MPL-2.0 | File-level copyleft path for modular integration |
668
+ | Commercial | Available for copyleft bypass and negotiated production terms |
669
+
670
+ The license file identifies the change date for the BSL path as `2028-08-08`
671
+ and lists the copyright holder as:
672
+
673
+ ```text
674
+ Copyright (C) 2026 Ahmad Ali Parr
675
+ Bel Esprit D'Accord Irrevocable Trust
676
+ SnapKitty Collective Limited (FLP)
677
+ ```
678
+
679
+ The Prolog license policy backend can be queried:
680
+
681
+ ```bash
682
+ swipl -q -t halt -f backends/license_policy.pl -- select saas_wrapper
683
+ swipl -q -t halt -f backends/license_policy.pl -- select enterprise_restricted
684
+ swipl -q -t halt -f backends/license_policy.pl -- select file_level_mod
685
+ swipl -q -t halt -f backends/license_policy.pl -- select copyleft_bypass
686
+ ```
687
+
688
+ License selection is a compliance decision. The reasoner helps route common use
689
+ cases, but it does not replace the actual license terms or a commercial
690
+ agreement.
691
+
692
+ ## Sovereign Node Key Policy
693
+
694
+ [`SOVEREIGN_NODE_KEY.md`](SOVEREIGN_NODE_KEY.md) documents the operational
695
+ node-key and seal process. Read it as an operational release/sealing policy,
696
+ not as a substitute for `LICENSE.tri`.
697
+
698
+ Institutional distinction:
699
+
700
+ - `LICENSE.tri` governs source and use licensing paths.
701
+ - `SOVEREIGN_NODE_KEY.md` governs production sealing, attribution, and
702
+ operational participation.
703
+ - A commercial deployment should satisfy both the selected license path and the
704
+ applicable node-key/seal policy.
705
+
706
+ ## Commercial Access and Sovereign Node Keys
707
+
708
+ ### What Is a Sovereign Node Key?
709
+
710
+ A **Sovereign Node Key** is proof that you have contributed to the PAX stack or
711
+ received commercial authorization. It is not DRM; it is membership and
712
+ production attribution. Running PAX-Coder in production requires one.
713
+
714
+ ### How to Get a Node Key
715
+
716
+ **Option 1: Contribute to the Stack (Recommended)**
717
+
718
+ 1. Fork the repository: [SNAPKITTYWEST/pax-coder](https://github.com/SNAPKITTYWEST/pax-coder).
719
+ 2. Build something useful: a kernel, proof, integration, documentation update,
720
+ test case, deployment adapter, or verification improvement.
721
+ 3. Submit a pull request.
722
+ 4. On merge, you earn a node key for that contribution.
723
+ 5. Email `license@collectivekitty.com` with:
724
+ - your GitHub username,
725
+ - merged pull request link or links,
726
+ - intended use case: research, commercial, or personal.
727
+ 6. Receive your node key: Ed25519 public key registration plus signing
728
+ certificate.
729
+
730
+ **Option 2: Commercial License (Direct)**
731
+
732
+ Email `license@collectivekitty.com` with:
733
+
734
+ - your organization name,
735
+ - intended deployment scope: internal R&D, SaaS, embedded product, or another
736
+ production scope,
737
+ - GPU hardware: RTX 3080, RTX 4090, H100, or equivalent target,
738
+ - estimated kernel volume.
739
+
740
+ After review, approved commercial users receive a commercial node key, license
741
+ terms, and registration path for deployment.
742
+
743
+ ### What Does a Node Key Unlock?
744
+
745
+ | Feature | Public Repository | Commercial Authorization |
746
+ | --- | --- | --- |
747
+ | Clone and verify integrity | βœ“ (anyone) | βœ“ (included) |
748
+ | Generate kernels for testing | βœ“ (anyone) | βœ“ (included) |
749
+ | Deploy to production | βœ— (not authorized) | βœ“ (with node key) |
750
+ | Sign releases | βœ— (not authorized) | βœ“ (with node key) |
751
+ | Embed in products | βœ— (license required) | βœ“ (commercial license) |
752
+ | Support | βœ— (not included) | βœ“ (by tier) |
753
+ | SaaS or cloud deployment | Requires license | Included with commercial license |
754
+
755
+ ### Questions
756
+
757
+ - **How to contribute:** see [`CONTRIBUTING.md`](CONTRIBUTING.md).
758
+ - **Node key details:** see [`SOVEREIGN_NODE_KEY.md`](SOVEREIGN_NODE_KEY.md).
759
+ - **Licensing details:** see [`LICENSE.tri`](LICENSE.tri).
760
+ - **Commercial inquiries:** `license@collectivekitty.com`.
761
+
762
+ ## Commercial and Institutional Use
763
+
764
+ This project is suitable for:
765
+
766
+ - public demonstration and education around verified GPU kernel generation,
767
+ - internal research on verified GPU kernel generation,
768
+ - proof-carrying code experiments,
769
+ - CUDA/PTX training-data development,
770
+ - institutional verification workflows,
771
+ - commercial evaluation under the appropriate license path,
772
+ - and enterprise discussions around `pax-verify` style verification services.
773
+
774
+ PAX-Coder is the public face of the program. Nemotron/Megatron is the internal
775
+ frontier model line for commercial work and is intentionally not released as
776
+ part of this repository.
777
+
778
+ Commercial teams should not treat generated kernels as approved artifacts until
779
+ the verification pipeline has produced current evidence for the exact kernel,
780
+ target GPU, compiler version, proof files, and deployment scope.
781
+
782
+ ## Governance Checklist
783
+
784
+ Before changing claims in this README or publishing a release, check:
785
+
786
+ - Does `lake build` pass?
787
+ - Does the release state the declared axiom basis for the claimed theorem path?
788
+ - Does CUDA/PTX compile for the stated target architecture?
789
+ - Was runtime behavior compared against a functional reference?
790
+ - Are benchmark numbers tied to a reproducible command and hardware target?
791
+ - Does the license statement match `LICENSE.tri`?
792
+ - Does any production claim satisfy the node-key/seal policy?
793
+ - Are generated examples labeled as examples rather than audited proof
794
+ certificates?
795
+
796
+ ## Related Documentation
797
+
798
+ - [`ABOUT.md`](ABOUT.md): short overview.
799
+ - [`docs/USER_GUIDE.md`](docs/USER_GUIDE.md): user workflow and prompt patterns.
800
+ - [`docs/PAX_ARCHITECTURE.md`](docs/PAX_ARCHITECTURE.md): axioms and proof obligations.
801
+ - [`MODEL_CARD.md`](MODEL_CARD.md): model-card draft.
802
+ - [`DATASET_CARD.md`](DATASET_CARD.md): dataset-card draft.
803
+ - [`PAX_CODER_README.md`](PAX_CODER_README.md): commercial integration notes.
804
+ - [`PACKAGE.md`](PACKAGE.md): v1.0.0 package manifest.
805
+ - [`RELEASE_NOTES.md`](RELEASE_NOTES.md): v1.0.0 release notes.
806
+ - [`CHANGELOG.md`](CHANGELOG.md): release history.
807
+ - [`SOVEREIGN_NODE_KEY.md`](SOVEREIGN_NODE_KEY.md): node-key policy.
808
+ - [`CONTRIBUTING.md`](CONTRIBUTING.md): contribution guidance.
809
+
810
+ ## Citation
811
+
812
+ ```bibtex
813
+ @software{pax_coder_2026,
814
+ title = {PAX-Coder: Institutional Program for Proof-Carrying GPU Kernel Generation},
815
+ author = {Parr, Ahmad Ali},
816
+ year = {2026},
817
+ url = {https://github.com/SNAPKITTYWEST/pax-coder}
818
+ }
819
+ ```
820
+
821
+ ## Institutional Standard
822
+
823
+ PAX-Coder should be evaluated by evidence:
824
+
825
+ ```text
826
+ claim -> file -> command -> output -> hardware/toolchain -> license path
827
+ ```
828
 
829
+ If any link is missing, mark the claim as pending. That rule protects the
830
+ institution, the engineering record, and downstream commercial users.