pragmatiq 0.1.0b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. pragmatiq-0.1.0b1/.github/ISSUE_TEMPLATE/bug_report.yml +54 -0
  2. pragmatiq-0.1.0b1/.github/ISSUE_TEMPLATE/feature_request.yml +45 -0
  3. pragmatiq-0.1.0b1/.github/dependabot.yml +14 -0
  4. pragmatiq-0.1.0b1/.github/pull_request_template.md +19 -0
  5. pragmatiq-0.1.0b1/.github/workflows/ci.yml +113 -0
  6. pragmatiq-0.1.0b1/.github/workflows/docs.yml +40 -0
  7. pragmatiq-0.1.0b1/.github/workflows/release.yml +33 -0
  8. pragmatiq-0.1.0b1/.gitignore +45 -0
  9. pragmatiq-0.1.0b1/AGENTS.md +79 -0
  10. pragmatiq-0.1.0b1/CHANGELOG.md +49 -0
  11. pragmatiq-0.1.0b1/CITATION.cff +34 -0
  12. pragmatiq-0.1.0b1/CLAUDE.md +79 -0
  13. pragmatiq-0.1.0b1/CODE_OF_CONDUCT.md +34 -0
  14. pragmatiq-0.1.0b1/CONTRIBUTING.md +117 -0
  15. pragmatiq-0.1.0b1/LICENSE +202 -0
  16. pragmatiq-0.1.0b1/MODEL_CARD.md +194 -0
  17. pragmatiq-0.1.0b1/NOTICE +13 -0
  18. pragmatiq-0.1.0b1/PKG-INFO +1025 -0
  19. pragmatiq-0.1.0b1/README.md +959 -0
  20. pragmatiq-0.1.0b1/SECURITY.md +30 -0
  21. pragmatiq-0.1.0b1/configs/data/aggregates.example.yaml +44 -0
  22. pragmatiq-0.1.0b1/configs/data/synthetic.yaml +43 -0
  23. pragmatiq-0.1.0b1/configs/data/tokenizer.yaml +24 -0
  24. pragmatiq-0.1.0b1/configs/data/tokenizer_nemotron.yaml +25 -0
  25. pragmatiq-0.1.0b1/configs/finetune/aml_gnn.yaml +11 -0
  26. pragmatiq-0.1.0b1/configs/finetune/credit.yaml +11 -0
  27. pragmatiq-0.1.0b1/configs/finetune/fraud.yaml +11 -0
  28. pragmatiq-0.1.0b1/configs/model/large.yaml +10 -0
  29. pragmatiq-0.1.0b1/configs/model/medium.yaml +10 -0
  30. pragmatiq-0.1.0b1/configs/model/small.yaml +10 -0
  31. pragmatiq-0.1.0b1/configs/pretrain.yaml +16 -0
  32. pragmatiq-0.1.0b1/configs/pretrain_nano.yaml +15 -0
  33. pragmatiq-0.1.0b1/demo/app.py +95 -0
  34. pragmatiq-0.1.0b1/deploy/Dockerfile +11 -0
  35. pragmatiq-0.1.0b1/deploy/docker-compose.yaml +69 -0
  36. pragmatiq-0.1.0b1/deploy/grafana/dashboards/dashboards.yaml +10 -0
  37. pragmatiq-0.1.0b1/deploy/grafana/datasources/prometheus.yaml +10 -0
  38. pragmatiq-0.1.0b1/deploy/prometheus/prometheus.yml +7 -0
  39. pragmatiq-0.1.0b1/deploy/triton/Dockerfile +33 -0
  40. pragmatiq-0.1.0b1/deploy/triton/model_repository/pragmatiq_embedder/1/model.py +53 -0
  41. pragmatiq-0.1.0b1/deploy/triton/model_repository/pragmatiq_embedder/config.pbtxt +46 -0
  42. pragmatiq-0.1.0b1/docs/architecture.md +402 -0
  43. pragmatiq-0.1.0b1/docs/assets/README.md +11 -0
  44. pragmatiq-0.1.0b1/docs/assets/pragmatiq-logo.png +0 -0
  45. pragmatiq-0.1.0b1/docs/assets/pragmatiq-logo.svg +5 -0
  46. pragmatiq-0.1.0b1/docs/assets/pragmatiq-mark.png +0 -0
  47. pragmatiq-0.1.0b1/docs/assets/pragmatiq-mark.svg +5 -0
  48. pragmatiq-0.1.0b1/docs/assets/pragmatiq-social.png +0 -0
  49. pragmatiq-0.1.0b1/notebooks/01_quickstart_and_data.ipynb +142 -0
  50. pragmatiq-0.1.0b1/notebooks/02_tokenize_and_embed.ipynb +170 -0
  51. pragmatiq-0.1.0b1/notebooks/03_finetune_and_probe.ipynb +106 -0
  52. pragmatiq-0.1.0b1/notebooks/04_aml_gnn.ipynb +162 -0
  53. pragmatiq-0.1.0b1/pragmatiq/__init__.py +14 -0
  54. pragmatiq-0.1.0b1/pragmatiq/api.py +613 -0
  55. pragmatiq-0.1.0b1/pragmatiq/cli.py +258 -0
  56. pragmatiq-0.1.0b1/pragmatiq/data/__init__.py +0 -0
  57. pragmatiq-0.1.0b1/pragmatiq/data/collate.py +303 -0
  58. pragmatiq-0.1.0b1/pragmatiq/data/dataset.py +266 -0
  59. pragmatiq-0.1.0b1/pragmatiq/data/parallel_tokenize.py +416 -0
  60. pragmatiq-0.1.0b1/pragmatiq/data/schema.py +175 -0
  61. pragmatiq-0.1.0b1/pragmatiq/data/sharding.py +315 -0
  62. pragmatiq-0.1.0b1/pragmatiq/data/synthetic/__init__.py +11 -0
  63. pragmatiq-0.1.0b1/pragmatiq/data/synthetic/calibrate.py +127 -0
  64. pragmatiq-0.1.0b1/pragmatiq/data/synthetic/config.py +132 -0
  65. pragmatiq-0.1.0b1/pragmatiq/data/synthetic/episodes.py +316 -0
  66. pragmatiq-0.1.0b1/pragmatiq/data/synthetic/generate.py +432 -0
  67. pragmatiq-0.1.0b1/pragmatiq/data/synthetic/labels.py +148 -0
  68. pragmatiq-0.1.0b1/pragmatiq/data/synthetic/personas.py +253 -0
  69. pragmatiq-0.1.0b1/pragmatiq/data/synthetic/report.py +106 -0
  70. pragmatiq-0.1.0b1/pragmatiq/data/synthetic/simulator.py +934 -0
  71. pragmatiq-0.1.0b1/pragmatiq/data/synthetic/world.py +701 -0
  72. pragmatiq-0.1.0b1/pragmatiq/data/tokenizer.py +1006 -0
  73. pragmatiq-0.1.0b1/pragmatiq/experiments/__init__.py +6 -0
  74. pragmatiq-0.1.0b1/pragmatiq/experiments/compare.py +23 -0
  75. pragmatiq-0.1.0b1/pragmatiq/experiments/run.py +159 -0
  76. pragmatiq-0.1.0b1/pragmatiq/experiments/tracking.py +104 -0
  77. pragmatiq-0.1.0b1/pragmatiq/inference/__init__.py +10 -0
  78. pragmatiq-0.1.0b1/pragmatiq/inference/benchmark.py +102 -0
  79. pragmatiq-0.1.0b1/pragmatiq/inference/embedder.py +58 -0
  80. pragmatiq-0.1.0b1/pragmatiq/inference/explain.py +96 -0
  81. pragmatiq-0.1.0b1/pragmatiq/inference/export.py +370 -0
  82. pragmatiq-0.1.0b1/pragmatiq/inference/multitask.py +111 -0
  83. pragmatiq-0.1.0b1/pragmatiq/models/__init__.py +21 -0
  84. pragmatiq-0.1.0b1/pragmatiq/models/embeddings.py +118 -0
  85. pragmatiq-0.1.0b1/pragmatiq/models/gnn.py +488 -0
  86. pragmatiq-0.1.0b1/pragmatiq/models/heads.py +112 -0
  87. pragmatiq-0.1.0b1/pragmatiq/models/layers.py +175 -0
  88. pragmatiq-0.1.0b1/pragmatiq/models/lora.py +110 -0
  89. pragmatiq-0.1.0b1/pragmatiq/models/pragmatiq.py +338 -0
  90. pragmatiq-0.1.0b1/pragmatiq/models/text_encoder.py +113 -0
  91. pragmatiq-0.1.0b1/pragmatiq/progress.py +73 -0
  92. pragmatiq-0.1.0b1/pragmatiq/registry.py +100 -0
  93. pragmatiq-0.1.0b1/pragmatiq/training/__init__.py +14 -0
  94. pragmatiq-0.1.0b1/pragmatiq/training/autoconfig.py +130 -0
  95. pragmatiq-0.1.0b1/pragmatiq/training/finetuner.py +141 -0
  96. pragmatiq-0.1.0b1/pragmatiq/training/masking.py +128 -0
  97. pragmatiq-0.1.0b1/pragmatiq/training/optim.py +218 -0
  98. pragmatiq-0.1.0b1/pragmatiq/training/pretrainer.py +593 -0
  99. pragmatiq-0.1.0b1/pragmatiq/training/probe.py +257 -0
  100. pragmatiq-0.1.0b1/pragmatiq/training/uplift.py +180 -0
  101. pragmatiq-0.1.0b1/pragmatiq/validate.py +202 -0
  102. pragmatiq-0.1.0b1/pyproject.toml +85 -0
  103. pragmatiq-0.1.0b1/scripts/benchmarks/multitask_probe.py +65 -0
  104. pragmatiq-0.1.0b1/scripts/deploy_serving.sh +118 -0
  105. pragmatiq-0.1.0b1/scripts/docs_drift_check.py +52 -0
  106. pragmatiq-0.1.0b1/scripts/docs_facts.py +156 -0
  107. pragmatiq-0.1.0b1/scripts/gates/_env.sh +23 -0
  108. pragmatiq-0.1.0b1/scripts/gates/gate_1.sh +87 -0
  109. pragmatiq-0.1.0b1/scripts/gates/gate_2.sh +45 -0
  110. pragmatiq-0.1.0b1/scripts/gates/gate_3.sh +48 -0
  111. pragmatiq-0.1.0b1/scripts/gates/gate_4.sh +37 -0
  112. pragmatiq-0.1.0b1/scripts/gates/gate_5.sh +72 -0
  113. pragmatiq-0.1.0b1/scripts/gates/gate_6.sh +92 -0
  114. pragmatiq-0.1.0b1/scripts/gates/gate_7.sh +85 -0
  115. pragmatiq-0.1.0b1/scripts/gates/gate_8.sh +60 -0
  116. pragmatiq-0.1.0b1/scripts/gates/run_full_validation.sh +97 -0
  117. pragmatiq-0.1.0b1/scripts/runpod_launch.py +216 -0
  118. pragmatiq-0.1.0b1/tests/__init__.py +0 -0
  119. pragmatiq-0.1.0b1/tests/baselines/credit_gbdt.py +131 -0
  120. pragmatiq-0.1.0b1/tests/test_api_guards.py +34 -0
  121. pragmatiq-0.1.0b1/tests/test_autoconfig.py +95 -0
  122. pragmatiq-0.1.0b1/tests/test_benchmark.py +38 -0
  123. pragmatiq-0.1.0b1/tests/test_byo_realdata.py +123 -0
  124. pragmatiq-0.1.0b1/tests/test_embeddings.py +36 -0
  125. pragmatiq-0.1.0b1/tests/test_finetuner.py +63 -0
  126. pragmatiq-0.1.0b1/tests/test_generator_signal.py +136 -0
  127. pragmatiq-0.1.0b1/tests/test_gnn.py +209 -0
  128. pragmatiq-0.1.0b1/tests/test_inference.py +275 -0
  129. pragmatiq-0.1.0b1/tests/test_models.py +378 -0
  130. pragmatiq-0.1.0b1/tests/test_multitask.py +55 -0
  131. pragmatiq-0.1.0b1/tests/test_nemotron_variant.py +160 -0
  132. pragmatiq-0.1.0b1/tests/test_optim_convergence.py +46 -0
  133. pragmatiq-0.1.0b1/tests/test_progress.py +93 -0
  134. pragmatiq-0.1.0b1/tests/test_registry_cli.py +100 -0
  135. pragmatiq-0.1.0b1/tests/test_runs_compare.py +20 -0
  136. pragmatiq-0.1.0b1/tests/test_sharding_dataset.py +405 -0
  137. pragmatiq-0.1.0b1/tests/test_synthetic_generate.py +212 -0
  138. pragmatiq-0.1.0b1/tests/test_synthetic_labels.py +149 -0
  139. pragmatiq-0.1.0b1/tests/test_synthetic_world.py +155 -0
  140. pragmatiq-0.1.0b1/tests/test_text_encoder.py +28 -0
  141. pragmatiq-0.1.0b1/tests/test_tokenize_parallel.py +399 -0
  142. pragmatiq-0.1.0b1/tests/test_tokenizer.py +355 -0
  143. pragmatiq-0.1.0b1/tests/test_training.py +661 -0
  144. pragmatiq-0.1.0b1/tests/test_truncation.py +122 -0
  145. pragmatiq-0.1.0b1/tests/test_uplift.py +83 -0
  146. pragmatiq-0.1.0b1/tests/test_validate.py +151 -0
  147. pragmatiq-0.1.0b1/website/.gitignore +26 -0
  148. pragmatiq-0.1.0b1/website/README.md +38 -0
  149. pragmatiq-0.1.0b1/website/app/(home)/layout.tsx +6 -0
  150. pragmatiq-0.1.0b1/website/app/(home)/page.tsx +140 -0
  151. pragmatiq-0.1.0b1/website/app/api/search/route.ts +7 -0
  152. pragmatiq-0.1.0b1/website/app/apple-icon.png +0 -0
  153. pragmatiq-0.1.0b1/website/app/docs/[[...slug]]/page.tsx +63 -0
  154. pragmatiq-0.1.0b1/website/app/docs/layout.tsx +11 -0
  155. pragmatiq-0.1.0b1/website/app/global.css +67 -0
  156. pragmatiq-0.1.0b1/website/app/icon.png +0 -0
  157. pragmatiq-0.1.0b1/website/app/layout.tsx +88 -0
  158. pragmatiq-0.1.0b1/website/app/llms-full.txt/route.ts +10 -0
  159. pragmatiq-0.1.0b1/website/app/llms.mdx/docs/[[...slug]]/route.ts +23 -0
  160. pragmatiq-0.1.0b1/website/app/llms.txt/route.ts +8 -0
  161. pragmatiq-0.1.0b1/website/app/og/docs/[...slug]/route.tsx +28 -0
  162. pragmatiq-0.1.0b1/website/app/robots.ts +12 -0
  163. pragmatiq-0.1.0b1/website/app/sitemap.ts +16 -0
  164. pragmatiq-0.1.0b1/website/components/mdx.tsx +38 -0
  165. pragmatiq-0.1.0b1/website/components/ui/ApiReference.tsx +27 -0
  166. pragmatiq-0.1.0b1/website/components/ui/Badge.tsx +27 -0
  167. pragmatiq-0.1.0b1/website/components/ui/DecisionCard.tsx +41 -0
  168. pragmatiq-0.1.0b1/website/components/ui/ModelSizes.tsx +52 -0
  169. pragmatiq-0.1.0b1/website/components/ui/ParamTable.tsx +75 -0
  170. pragmatiq-0.1.0b1/website/components/viz/ArchitectureExplorer.tsx +158 -0
  171. pragmatiq-0.1.0b1/website/components/viz/TokenizationWalkthrough.tsx +167 -0
  172. pragmatiq-0.1.0b1/website/content/docs/about.mdx +37 -0
  173. pragmatiq-0.1.0b1/website/content/docs/concepts/aml-graph.mdx +52 -0
  174. pragmatiq-0.1.0b1/website/content/docs/concepts/architecture.mdx +118 -0
  175. pragmatiq-0.1.0b1/website/content/docs/concepts/meta.json +4 -0
  176. pragmatiq-0.1.0b1/website/content/docs/concepts/model-sizes.mdx +30 -0
  177. pragmatiq-0.1.0b1/website/content/docs/concepts/nemotron.mdx +51 -0
  178. pragmatiq-0.1.0b1/website/content/docs/decisions/decisions-log.mdx +49 -0
  179. pragmatiq-0.1.0b1/website/content/docs/decisions/meta.json +4 -0
  180. pragmatiq-0.1.0b1/website/content/docs/decisions/paper-fidelity.mdx +38 -0
  181. pragmatiq-0.1.0b1/website/content/docs/decisions/reproducibility.mdx +47 -0
  182. pragmatiq-0.1.0b1/website/content/docs/get-started/install.mdx +52 -0
  183. pragmatiq-0.1.0b1/website/content/docs/get-started/meta.json +4 -0
  184. pragmatiq-0.1.0b1/website/content/docs/get-started/quickstart.mdx +106 -0
  185. pragmatiq-0.1.0b1/website/content/docs/index.mdx +43 -0
  186. pragmatiq-0.1.0b1/website/content/docs/meta.json +3 -0
  187. pragmatiq-0.1.0b1/website/content/docs/reference/api.mdx +32 -0
  188. pragmatiq-0.1.0b1/website/content/docs/reference/cli.mdx +36 -0
  189. pragmatiq-0.1.0b1/website/content/docs/reference/configuration.mdx +43 -0
  190. pragmatiq-0.1.0b1/website/content/docs/reference/data-contract.mdx +65 -0
  191. pragmatiq-0.1.0b1/website/content/docs/reference/gates.mdx +36 -0
  192. pragmatiq-0.1.0b1/website/content/docs/reference/meta.json +4 -0
  193. pragmatiq-0.1.0b1/website/content/docs/tutorials/aml-gnn.mdx +54 -0
  194. pragmatiq-0.1.0b1/website/content/docs/tutorials/bring-your-own-data.mdx +66 -0
  195. pragmatiq-0.1.0b1/website/content/docs/tutorials/data-pipeline.mdx +61 -0
  196. pragmatiq-0.1.0b1/website/content/docs/tutorials/evaluate.mdx +65 -0
  197. pragmatiq-0.1.0b1/website/content/docs/tutorials/meta.json +4 -0
  198. pragmatiq-0.1.0b1/website/content/docs/tutorials/pretrain.mdx +85 -0
  199. pragmatiq-0.1.0b1/website/content/docs/tutorials/serve.mdx +67 -0
  200. pragmatiq-0.1.0b1/website/data/facts.json +379 -0
  201. pragmatiq-0.1.0b1/website/lib/cn.ts +1 -0
  202. pragmatiq-0.1.0b1/website/lib/layout.shared.tsx +20 -0
  203. pragmatiq-0.1.0b1/website/lib/shared.ts +25 -0
  204. pragmatiq-0.1.0b1/website/lib/source.ts +37 -0
  205. pragmatiq-0.1.0b1/website/next.config.mjs +10 -0
  206. pragmatiq-0.1.0b1/website/package.json +37 -0
  207. pragmatiq-0.1.0b1/website/pnpm-lock.yaml +4137 -0
  208. pragmatiq-0.1.0b1/website/postcss.config.mjs +7 -0
  209. pragmatiq-0.1.0b1/website/proxy.ts +29 -0
  210. pragmatiq-0.1.0b1/website/public/brand/logo.png +0 -0
  211. pragmatiq-0.1.0b1/website/public/brand/mark.png +0 -0
  212. pragmatiq-0.1.0b1/website/public/brand/social.png +0 -0
  213. pragmatiq-0.1.0b1/website/source.config.ts +27 -0
  214. pragmatiq-0.1.0b1/website/tsconfig.json +35 -0
  215. pragmatiq-0.1.0b1/website/vercel.json +4 -0
@@ -0,0 +1,54 @@
1
+ name: Bug report
2
+ description: Report a reproducible problem in pragmatiq.
3
+ title: "[Bug]: "
4
+ labels: ["bug"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for helping improve pragmatiq.
10
+
11
+ pragmatiq is an independent implementation inspired by the PRAGMA paper
12
+ (arXiv 2604.08649) and is not affiliated with or endorsed by Revolut.
13
+
14
+ Please do not include real customer data, secrets, or private banking records.
15
+ - type: textarea
16
+ id: summary
17
+ attributes:
18
+ label: Summary
19
+ description: What happened?
20
+ validations:
21
+ required: true
22
+ - type: textarea
23
+ id: reproduce
24
+ attributes:
25
+ label: Steps to reproduce
26
+ description: Include the smallest command or code snippet that reproduces the issue.
27
+ placeholder: |
28
+ 1. Run ...
29
+ 2. Observe ...
30
+ validations:
31
+ required: true
32
+ - type: textarea
33
+ id: expected
34
+ attributes:
35
+ label: Expected behavior
36
+ validations:
37
+ required: true
38
+ - type: textarea
39
+ id: environment
40
+ attributes:
41
+ label: Environment
42
+ description: OS, Python version, PyTorch version, install extras, CPU/GPU.
43
+ placeholder: |
44
+ - OS:
45
+ - Python:
46
+ - PyTorch:
47
+ - Install command:
48
+ validations:
49
+ required: true
50
+ - type: textarea
51
+ id: logs
52
+ attributes:
53
+ label: Logs or traceback
54
+ render: shell
@@ -0,0 +1,45 @@
1
+ name: Feature request
2
+ description: Suggest an improvement or extension for pragmatiq.
3
+ title: "[Feature]: "
4
+ labels: ["enhancement"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for sharing an idea.
10
+
11
+ pragmatiq is an independent implementation inspired by the PRAGMA paper
12
+ (arXiv 2604.08649) and is not affiliated with or endorsed by Revolut.
13
+ - type: textarea
14
+ id: problem
15
+ attributes:
16
+ label: Problem
17
+ description: What workflow, research question, or user need would this solve?
18
+ validations:
19
+ required: true
20
+ - type: textarea
21
+ id: proposal
22
+ attributes:
23
+ label: Proposed solution
24
+ description: Describe the smallest useful version of the feature.
25
+ validations:
26
+ required: true
27
+ - type: dropdown
28
+ id: area
29
+ attributes:
30
+ label: Area
31
+ options:
32
+ - Synthetic data
33
+ - Tokenizer
34
+ - Model architecture
35
+ - Training or finetuning
36
+ - Inference or serving
37
+ - AML graph
38
+ - Documentation
39
+ - Other
40
+ validations:
41
+ required: true
42
+ - type: textarea
43
+ id: alternatives
44
+ attributes:
45
+ label: Alternatives considered
@@ -0,0 +1,14 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ groups:
8
+ python-dependencies:
9
+ patterns:
10
+ - "*"
11
+ - package-ecosystem: "github-actions"
12
+ directory: "/"
13
+ schedule:
14
+ interval: "weekly"
@@ -0,0 +1,19 @@
1
+ > pragmatiq is an independent implementation inspired by the PRAGMA paper
2
+ > (arXiv 2604.08649) and is not affiliated with or endorsed by Revolut.
3
+
4
+ ## Summary
5
+
6
+ -
7
+
8
+ ## Verification
9
+
10
+ - [ ] `pytest tests/ -x -q`
11
+ - [ ] `ruff check . && mypy pragmatiq`
12
+ - [ ] Relevant gate: `bash scripts/gates/gate_<N>.sh`
13
+
14
+ ## Notes
15
+
16
+ - [ ] I updated docs/tests for user-visible behavior changes.
17
+ - [ ] I did not add logic to `pragmatiq/cli.py`; CLI changes delegate to `pragmatiq/api.py`.
18
+ - [ ] Randomized behavior has explicit seed handling.
19
+ - [ ] New docs/assets have clear provenance and do not use Revolut trademarks, Revolut trade dress, or paper figures without attribution.
@@ -0,0 +1,113 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ workflow_dispatch:
9
+
10
+ concurrency:
11
+ group: ci-${{ github.workflow }}-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ quality:
16
+ runs-on: ubuntu-latest
17
+ timeout-minutes: 20
18
+ steps:
19
+ - uses: actions/checkout@v6
20
+ - uses: actions/setup-python@v6
21
+ with:
22
+ python-version: "3.11"
23
+ cache: pip
24
+ - name: Install (CPU torch)
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install torch --index-url https://download.pytorch.org/whl/cpu
28
+ pip install -e ".[dev]"
29
+ - name: Ruff
30
+ run: ruff check pragmatiq tests
31
+ - name: Mypy
32
+ run: mypy pragmatiq
33
+ - name: Pytest smoke
34
+ run: >
35
+ pytest
36
+ tests/test_models.py
37
+ tests/test_registry_cli.py
38
+ tests/test_tokenizer.py
39
+ tests/test_validate.py
40
+ tests/test_synthetic_world.py
41
+ tests/test_synthetic_labels.py
42
+ tests/test_synthetic_generate.py
43
+ tests/test_sharding_dataset.py
44
+ tests/test_gnn.py::TestGraphBuilder
45
+ tests/test_gnn.py::TestHandcrafted
46
+ tests/test_training.py::TestOptim
47
+ tests/test_training.py::TestPretrainer::test_checkpoint_contains_required_state
48
+ tests/test_training.py::TestPretrainer::test_tokenizer_mismatch_refused
49
+ tests/test_training.py::TestProbe::test_embed_records_notebook_api
50
+ -q
51
+ -x
52
+ --durations=10
53
+
54
+ python-compat:
55
+ runs-on: ubuntu-latest
56
+ timeout-minutes: 10
57
+ strategy:
58
+ matrix:
59
+ python-version: ["3.12"]
60
+ steps:
61
+ - uses: actions/checkout@v6
62
+ - uses: actions/setup-python@v6
63
+ with:
64
+ python-version: ${{ matrix.python-version }}
65
+ cache: pip
66
+ - name: Install (CPU torch)
67
+ run: |
68
+ python -m pip install --upgrade pip
69
+ pip install torch --index-url https://download.pytorch.org/whl/cpu
70
+ pip install -e ".[dev]"
71
+ - name: Compatibility smoke tests
72
+ run: >
73
+ pytest
74
+ tests/test_models.py
75
+ tests/test_registry_cli.py
76
+ tests/test_tokenizer.py
77
+ tests/test_validate.py
78
+ tests/test_synthetic_world.py
79
+ -q
80
+
81
+ gates:
82
+ # Run the CI-scale acceptance gates on pushes and pull requests, so a PR can
83
+ # never merge a red gate.
84
+ runs-on: ubuntu-latest
85
+ needs: [quality, python-compat]
86
+ timeout-minutes: 60
87
+ steps:
88
+ - uses: actions/checkout@v6
89
+ - uses: actions/setup-python@v6
90
+ with:
91
+ python-version: "3.11"
92
+ cache: pip
93
+ - name: Install
94
+ run: |
95
+ python -m pip install --upgrade pip
96
+ pip install torch --index-url https://download.pytorch.org/whl/cpu
97
+ pip install -e ".[dev,gnn,serve]"
98
+ - name: Gate 1 (synthetic data)
99
+ run: bash scripts/gates/gate_1.sh
100
+ - name: Gate 2 (tokenizer)
101
+ run: bash scripts/gates/gate_2.sh
102
+ - name: Gate 3 (sharding / padding-equivalence)
103
+ run: bash scripts/gates/gate_3.sh
104
+ - name: Gate 4 (model)
105
+ run: bash scripts/gates/gate_4.sh
106
+ - name: Gate 5 (training / resume / probe)
107
+ run: bash scripts/gates/gate_5.sh
108
+ - name: Gate 6 (AML GNN ablation)
109
+ run: bash scripts/gates/gate_6.sh
110
+ - name: Gate 7 (inference / serving)
111
+ run: bash scripts/gates/gate_7.sh
112
+ - name: Gate 8 (validate / nano e2e / packaging)
113
+ run: bash scripts/gates/gate_8.sh
@@ -0,0 +1,40 @@
1
+ name: docs-site
2
+
3
+ # Build the documentation site and verify its facts have not drifted from the code.
4
+ on:
5
+ push:
6
+ branches: [main]
7
+ paths: ['website/**', 'scripts/docs_facts.py', 'scripts/docs_drift_check.py', 'pragmatiq/**']
8
+ pull_request:
9
+ paths: ['website/**', 'scripts/docs_facts.py', 'scripts/docs_drift_check.py', 'pragmatiq/**']
10
+
11
+ jobs:
12
+ drift-check:
13
+ # facts.json must match what the library emits today (model sizes, config defaults,
14
+ # gate list, API surface), so the docs cannot silently fall out of sync with the code.
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: '3.11'
21
+ - run: pip install -e ".[dev]"
22
+ - run: python scripts/docs_drift_check.py
23
+
24
+ build:
25
+ runs-on: ubuntu-latest
26
+ defaults:
27
+ run:
28
+ working-directory: website
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+ - uses: pnpm/action-setup@v4
32
+ with:
33
+ version: 10
34
+ - uses: actions/setup-node@v4
35
+ with:
36
+ node-version: 22
37
+ cache: pnpm
38
+ cache-dependency-path: website/pnpm-lock.yaml
39
+ - run: pnpm install --frozen-lockfile
40
+ - run: pnpm build
@@ -0,0 +1,33 @@
1
+ name: publish
2
+
3
+ # Build and publish pragmatiq to PyPI when a GitHub Release is published.
4
+ #
5
+ # Uses PyPI Trusted Publishing (OIDC) — no API token/secret required. One-time setup:
6
+ # on https://pypi.org/manage/project/pragmatiq/settings/publishing/, add a trusted
7
+ # publisher for owner `dynamiq-ai`, repo `pragmatiq`, workflow `release.yml`,
8
+ # environment `pypi`. A pre-release version (e.g. 0.1.0b1) publishes as a pre-release.
9
+ on:
10
+ release:
11
+ types: [published]
12
+
13
+ jobs:
14
+ pypi:
15
+ runs-on: ubuntu-latest
16
+ environment: pypi
17
+ permissions:
18
+ id-token: write # required for Trusted Publishing
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: '3.11'
24
+ - name: Build sdist + wheel
25
+ run: |
26
+ python -m pip install --upgrade build
27
+ python -m build
28
+ - name: Verify metadata
29
+ run: |
30
+ python -m pip install --upgrade twine
31
+ twine check dist/*
32
+ - name: Publish to PyPI
33
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,45 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ .venv/
9
+ venv/
10
+
11
+ # Tooling caches
12
+ .claude/
13
+ .pytest_cache/
14
+ .mypy_cache/
15
+ .ruff_cache/
16
+ .coverage
17
+ htmlcov/
18
+
19
+ # Project artifacts (anchored to repo root so they never shadow the
20
+ # pragmatiq/data/ source package or pragmatiq/.../runs modules)
21
+ /runs/
22
+ /data/
23
+ /outputs/
24
+ *.parquet
25
+ *.lmdb
26
+ realism_report.html
27
+ /wandb/
28
+
29
+ # Notebooks
30
+ .ipynb_checkpoints/
31
+
32
+ # Secrets / local env — never commit
33
+ .env
34
+ .env.*
35
+ !.env.example
36
+ *.key
37
+ secrets/
38
+
39
+ # OS / editors
40
+ .DS_Store
41
+ .idea/
42
+ .vscode/
43
+
44
+ # Internal spec — kept locally, not published
45
+ docs/SPEC.md
@@ -0,0 +1,79 @@
1
+ # pragmatiq — project memory
2
+
3
+ pragmatiq is an independent open-source implementation inspired by PRAGMA
4
+ (arXiv 2604.08649) by Dynamiq.
5
+ The ONLY spec is **docs/SPEC.md** — read it from disk; never trust chat context
6
+ over the file. Subagents must read docs/SPEC.md before reviewing anything.
7
+
8
+ ## Current phase
9
+
10
+ > **current phase: 8 (polish). All gates 1-8 green at CI scale; gate-6 also
11
+ > confirmed at full scale on GPU (12k accounts × 3 seeds: a≈0.50, c≈0.85). The
12
+ > phase-6 AML ablation demonstrates relational recovery: money mules are ordinary
13
+ > accounts whose only signal is ring membership in the transfer graph, so an
14
+ > isolated embedding is at chance (a≈0.50) while a graph-aware model recovers them
15
+ > (c≈0.85). On these structurally-distinctive synthetic rings the signal is
16
+ > largely transfer-graph degree, so hand-crafted degree is a strong baseline and
17
+ > (b)>(c) is not claimed. Gate 8 is the CPU pipeline smoke test; gate 5 is the
18
+ > performance gate. See MODEL_CARD.md and notebooks/04.**
19
+
20
+ Phases & gates: see docs/SPEC.md. Gate scripts live in `scripts/gates/gate_N.sh`.
21
+ Never start phase N+1 with a red gate N.
22
+
23
+ ## Public code hygiene (non-negotiable)
24
+
25
+ This repository is public, production-grade open source. Everything that ships in
26
+ git — code comments, docstrings, commit messages, README, MODEL_CARD, CHANGELOG,
27
+ notebooks, gate scripts — must read as a clean first version written by its
28
+ authors, not as a record of how it was fixed:
29
+
30
+ - Comments and docstrings explain WHAT the code does and its forward-looking design
31
+ rationale. They never describe prior behavior, bug history, or any review/audit
32
+ process — avoid "was X, now Y", "previously/old/used to", "fixed", "byte-identical
33
+ to before", an AUC a removed bug scored, "the audit/verification found …", etc.
34
+ - Commit messages and the CHANGELOG describe v1 capabilities, not defect fixes.
35
+ - This is v1: there is no prior release. Do NOT add backwards-compatibility shims,
36
+ legacy fallbacks, or "for older …" branches.
37
+ - Keep working notes, edit history, and learnings under `outputs/` (gitignored) —
38
+ never in tracked files.
39
+
40
+ ## Commands
41
+
42
+ ```bash
43
+ pip install -e ".[dev]" # editable install + test deps
44
+ pytest tests/ -x -q # full suite
45
+ pytest tests/test_<module>.py -q # one module
46
+ bash scripts/gates/gate_1.sh # phase-1 acceptance gate (etc.)
47
+ ruff check . && mypy pragmatiq # lint + types
48
+ ```
49
+
50
+ Gate scripts honor `PRAGMATIQ_GATE_FULL=1` for full-scale runs (100k users,
51
+ 8 cores); default is CI scale (small N, throughput extrapolation).
52
+
53
+ ## Non-negotiable global rules
54
+
55
+ 1. All logic lives in the library (`pragmatiq/`); `cli.py` (Typer) only parses args
56
+ and calls `pragmatiq/api.py` functions.
57
+ 1. Every randomized component takes an explicit seed; same seed → byte-identical
58
+ output (CI-enforced for the generator).
59
+ 1. Checkpoints store model + optimizer + LR scheduler + sampler position + RNG
60
+ states, and embed the tokenizer hash + resolved config. `from_pretrained()`
61
+ refuses to run with a mismatched tokenizer (clear error message).
62
+ 1. Unseen keys/values at inference map to [UNK] with a logged warning — never a
63
+ KeyError.
64
+ 1. Everything must run on CPU (slow but correct). CUDA paths are accelerations,
65
+ not requirements. Use flash-attn varlen if available, else fall back to SDPA
66
+ with an attention mask built from cu_seqlens.
67
+ 1. Write tests alongside each module; type-hint the public API; docstrings on
68
+ every public function.
69
+ 1. Public API layering: `pragmatiq/api.py` exposes `synthesize / tokenize / pretrain / finetune / embed / probe`; notebooks get
70
+ `PragmaModel.from_pretrained(run)` and `model.embed_records(list_of_dicts)`
71
+ (plain dicts, no shard pipeline needed interactively).
72
+ 1. Extension points via `pragmatiq/registry.py` decorators —
73
+ `@register_head(name)`, `@register_masker(name)`, `@register_value_encoder(name)`
74
+ — configs reference components by name so engineers customize without forking.
75
+
76
+ ## Attribution (must appear in every README/doc)
77
+
78
+ > pragmatiq is an independent implementation inspired by the PRAGMA paper
79
+ > (arXiv 2604.08649) and is not affiliated with or endorsed by Revolut.
@@ -0,0 +1,49 @@
1
+ # Changelog
2
+
3
+ > pragmatiq is an independent implementation inspired by the PRAGMA paper
4
+ > (arXiv 2604.08649) and is not affiliated with or endorsed by Revolut.
5
+
6
+ All notable changes to pragmatiq are documented in this file. This project
7
+ follows [Semantic Versioning](https://semver.org); 0.x releases are pre-1.0 and
8
+ the public API may change.
9
+
10
+ ## [0.1.0b1] — Public beta
11
+
12
+ First public (beta) release: an end-to-end, CPU-first toolkit for behavioral
13
+ banking foundation models.
14
+
15
+ ### Added
16
+ - **Synthetic data** — a deterministic, agent-based banking simulator (events,
17
+ profiles, transfers, and causal fraud / credit-default / AML / churn / LTV
18
+ labels with strict eval-point truncation), an HTML realism report, and
19
+ `synth calibrate` for fitting the generator to aggregate statistics.
20
+ - **Tokenizer & data pipeline** — a key–value–time tokenizer (percentile-binned
21
+ numerics, categorical/BPE values, calendar + log-second time features, `[UNK]`
22
+ fallbacks), parquet sharding with an LMDB user index, and padding-free varlen
23
+ batching under a token budget.
24
+ - **Model** — PRAGMA-style encoders with shared/tied key–value embeddings,
25
+ TimeRoPE continuous-time positions, per-event independent encoding, profile and
26
+ history encoders, and a tied MLM head; `small`/`medium`/`large` presets plus a
27
+ CPU-friendly `nano` size.
28
+ - **Training & adaptation** — pretraining on Lightning Fabric (Muon + AdamW,
29
+ cosine schedule, fully resumable checkpoints), a gradient-boosting probe
30
+ (ROC-AUC + PR-AUC vs a same-classifier raw-count baseline; logistic/LightGBM
31
+ selectable), LoRA fine-tuning, and a registry for swappable heads, maskers, and
32
+ value encoders.
33
+ - **Hands-off scale** — gradient accumulation, multi-node DDP, and a `config="auto"`
34
+ sizer that picks the batch and schedule from the data + device, so a run scales
35
+ from 1M to 26M records without tuning.
36
+ - **PRAGMA+Nemotron variant** — an optional, switchable text pathway that embeds
37
+ high-cardinality text fields with a frozen text encoder and reconstructs them
38
+ with MSE; off by default, so the BPE path is byte-identical.
39
+ - **AML over the transfer graph** — a GraphSAGE node classifier and the
40
+ three-way relational-recovery ablation (isolated embedding vs graph-aware node
41
+ features); see MODEL_CARD.md and `notebooks/04`.
42
+ - **Inference & serving** — a batch embedder, integrated-gradients event
43
+ attribution, ONNX export, a Triton serving image that installs pragmatiq, a
44
+ turnkey `deploy_serving.sh`, monitoring (Prometheus + Grafana), and a Streamlit demo.
45
+ - **Documentation** — a modern docs/educational site (Next.js + Fumadocs) at
46
+ pragmatiq.getdynamiq.ai, with interactive visualizers and a facts drift-check.
47
+ - **Engineering** — CPU-first throughout (CUDA and flash-attn are accelerations),
48
+ a typed public API, notebooks, a model card, and CI (ruff + mypy + pytest +
49
+ acceptance gates).
@@ -0,0 +1,34 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use pragmatiq, please cite the software and the PRAGMA paper that inspired it."
3
+ type: software
4
+ title: "pragmatiq: an open-source PRAGMA-inspired banking foundation model stack"
5
+ version: "0.1.0"
6
+ license: Apache-2.0
7
+ authors:
8
+ - name: "Dynamiq"
9
+ email: "support@getdynamiq.ai"
10
+ repository-code: "https://github.com/dynamiq-ai/pragmatiq"
11
+ url: "https://github.com/dynamiq-ai/pragmatiq"
12
+ abstract: >-
13
+ pragmatiq is an independent implementation inspired by the PRAGMA paper
14
+ (arXiv 2604.08649) and is not affiliated with or endorsed by Revolut.
15
+ references:
16
+ - type: article
17
+ title: "PRAGMA: Revolut Foundation Model"
18
+ authors:
19
+ - name: "Maxim Ostroukhov"
20
+ - name: "Ruslan Mikhailov"
21
+ - name: "Vladimir Iashin"
22
+ - name: "Artem Sokolov"
23
+ - name: "Andrei Akshonov"
24
+ - name: "Vitaly Protasov"
25
+ - name: "Dmitrii Beloborodov"
26
+ - name: "Vince Mullin"
27
+ - name: "Roman Yokunda Enzmann"
28
+ - name: "Georgios Kolovos"
29
+ - name: "Jason Renders"
30
+ - name: "Pavel Nesterov"
31
+ - name: "Anton Repushko"
32
+ doi: "10.48550/arXiv.2604.08649"
33
+ url: "https://arxiv.org/abs/2604.08649"
34
+ year: 2026
@@ -0,0 +1,79 @@
1
+ # pragmatiq — project memory
2
+
3
+ pragmatiq is an independent open-source implementation inspired by PRAGMA
4
+ (arXiv 2604.08649) by Dynamiq.
5
+ The ONLY spec is **docs/SPEC.md** — read it from disk; never trust chat context
6
+ over the file. Subagents must read docs/SPEC.md before reviewing anything.
7
+
8
+ ## Current phase
9
+
10
+ > **current phase: 8 (polish). All gates 1-8 green at CI scale; gate-6 also
11
+ > confirmed at full scale on GPU (12k accounts × 3 seeds: a≈0.50, c≈0.85). The
12
+ > phase-6 AML ablation demonstrates relational recovery: money mules are ordinary
13
+ > accounts whose only signal is ring membership in the transfer graph, so an
14
+ > isolated embedding is at chance (a≈0.50) while a graph-aware model recovers them
15
+ > (c≈0.85). On these structurally-distinctive synthetic rings the signal is
16
+ > largely transfer-graph degree, so hand-crafted degree is a strong baseline and
17
+ > (b)>(c) is not claimed. Gate 8 is the CPU pipeline smoke test; gate 5 is the
18
+ > performance gate. See MODEL_CARD.md and notebooks/04.**
19
+
20
+ Phases & gates: see docs/SPEC.md. Gate scripts live in `scripts/gates/gate_N.sh`.
21
+ Never start phase N+1 with a red gate N.
22
+
23
+ ## Public code hygiene (non-negotiable)
24
+
25
+ This repository is public, production-grade open source. Everything that ships in
26
+ git — code comments, docstrings, commit messages, README, MODEL_CARD, CHANGELOG,
27
+ notebooks, gate scripts — must read as a clean first version written by its
28
+ authors, not as a record of how it was fixed:
29
+
30
+ - Comments and docstrings explain WHAT the code does and its forward-looking design
31
+ rationale. They never describe prior behavior, bug history, or any review/audit
32
+ process — avoid "was X, now Y", "previously/old/used to", "fixed", "byte-identical
33
+ to before", an AUC a removed bug scored, "the audit/verification found …", etc.
34
+ - Commit messages and the CHANGELOG describe v1 capabilities, not defect fixes.
35
+ - This is v1: there is no prior release. Do NOT add backwards-compatibility shims,
36
+ legacy fallbacks, or "for older …" branches.
37
+ - Keep working notes, edit history, and learnings under `outputs/` (gitignored) —
38
+ never in tracked files.
39
+
40
+ ## Commands
41
+
42
+ ```bash
43
+ pip install -e ".[dev]" # editable install + test deps
44
+ pytest tests/ -x -q # full suite
45
+ pytest tests/test_<module>.py -q # one module
46
+ bash scripts/gates/gate_1.sh # phase-1 acceptance gate (etc.)
47
+ ruff check . && mypy pragmatiq # lint + types
48
+ ```
49
+
50
+ Gate scripts honor `PRAGMATIQ_GATE_FULL=1` for full-scale runs (100k users,
51
+ 8 cores); default is CI scale (small N, throughput extrapolation).
52
+
53
+ ## Non-negotiable global rules
54
+
55
+ 1. All logic lives in the library (`pragmatiq/`); `cli.py` (Typer) only parses args
56
+ and calls `pragmatiq/api.py` functions.
57
+ 1. Every randomized component takes an explicit seed; same seed → byte-identical
58
+ output (CI-enforced for the generator).
59
+ 1. Checkpoints store model + optimizer + LR scheduler + sampler position + RNG
60
+ states, and embed the tokenizer hash + resolved config. `from_pretrained()`
61
+ refuses to run with a mismatched tokenizer (clear error message).
62
+ 1. Unseen keys/values at inference map to [UNK] with a logged warning — never a
63
+ KeyError.
64
+ 1. Everything must run on CPU (slow but correct). CUDA paths are accelerations,
65
+ not requirements. Use flash-attn varlen if available, else fall back to SDPA
66
+ with an attention mask built from cu_seqlens.
67
+ 1. Write tests alongside each module; type-hint the public API; docstrings on
68
+ every public function.
69
+ 1. Public API layering: `pragmatiq/api.py` exposes `synthesize / tokenize / pretrain / finetune / embed / probe`; notebooks get
70
+ `PragmaModel.from_pretrained(run)` and `model.embed_records(list_of_dicts)`
71
+ (plain dicts, no shard pipeline needed interactively).
72
+ 1. Extension points via `pragmatiq/registry.py` decorators —
73
+ `@register_head(name)`, `@register_masker(name)`, `@register_value_encoder(name)`
74
+ — configs reference components by name so engineers customize without forking.
75
+
76
+ ## Attribution (must appear in every README/doc)
77
+
78
+ > pragmatiq is an independent implementation inspired by the PRAGMA paper
79
+ > (arXiv 2604.08649) and is not affiliated with or endorsed by Revolut.
@@ -0,0 +1,34 @@
1
+ # Code of Conduct
2
+
3
+ > pragmatiq is an independent implementation inspired by the PRAGMA paper
4
+ > (arXiv 2604.08649) and is not affiliated with or endorsed by Revolut.
5
+
6
+ ## Our pledge
7
+
8
+ We pledge to make participation in pragmatiq welcoming, respectful, and
9
+ constructive for contributors and users regardless of background, identity,
10
+ experience level, or affiliation.
11
+
12
+ ## Expected behavior
13
+
14
+ - Be respectful and assume good intent.
15
+ - Keep technical debate focused on evidence, reproducibility, and project goals.
16
+ - Avoid sharing private customer data, credentials, or proprietary banking
17
+ records in issues, pull requests, discussions, or examples.
18
+ - Credit prior work clearly, including the PRAGMA paper when discussing the
19
+ methods that inspired this implementation.
20
+
21
+ ## Unacceptable behavior
22
+
23
+ - Harassment, threats, discriminatory language, or personal attacks.
24
+ - Publishing private information without explicit permission.
25
+ - Misrepresenting pragmatiq as affiliated with, endorsed by, sponsored by, or
26
+ officially connected to Revolut.
27
+ - Uploading copyrighted third-party assets, Revolut trademarks, Revolut trade
28
+ dress, or copied paper figures without permission and attribution.
29
+
30
+ ## Enforcement
31
+
32
+ Report concerns to `support@getdynamiq.ai`. Maintainers may remove content, close
33
+ threads, restrict participation, or take other reasonable action to protect the
34
+ project and its community.