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

docs: add proper model card for PAX-Coder

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