arti-fit 1.0.2__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 (118) hide show
  1. arti_fit-1.0.2/.gitignore +14 -0
  2. arti_fit-1.0.2/AI_ASSISTANCE.md +12 -0
  3. arti_fit-1.0.2/AUTHORS.md +8 -0
  4. arti_fit-1.0.2/CITATION.cff +12 -0
  5. arti_fit-1.0.2/CONTRIBUTING.md +12 -0
  6. arti_fit-1.0.2/LICENSE +21 -0
  7. arti_fit-1.0.2/PKG-INFO +251 -0
  8. arti_fit-1.0.2/README.md +175 -0
  9. arti_fit-1.0.2/SECURITY.md +32 -0
  10. arti_fit-1.0.2/STABILITY.md +67 -0
  11. arti_fit-1.0.2/docs/reference/fit-config.schema.json +317 -0
  12. arti_fit-1.0.2/docs/reference/task-graph.schema.json +86 -0
  13. arti_fit-1.0.2/examples/arti_st_roundtrip.py +50 -0
  14. arti_fit-1.0.2/examples/coord_mask_visibility_recall.py +61 -0
  15. arti_fit-1.0.2/examples/pytorch_dependency_quickstart.py +44 -0
  16. arti_fit-1.0.2/pyproject.toml +129 -0
  17. arti_fit-1.0.2/src/arti/__init__.py +353 -0
  18. arti_fit-1.0.2/src/arti/__main__.py +6 -0
  19. arti_fit-1.0.2/src/arti/_toml.py +12 -0
  20. arti_fit-1.0.2/src/arti/_version.py +3 -0
  21. arti_fit-1.0.2/src/arti/attachment.py +644 -0
  22. arti_fit-1.0.2/src/arti/attachment_config.py +204 -0
  23. arti_fit-1.0.2/src/arti/attachment_hub.py +258 -0
  24. arti_fit-1.0.2/src/arti/attachment_training.py +389 -0
  25. arti_fit-1.0.2/src/arti/backend.py +20 -0
  26. arti_fit-1.0.2/src/arti/blocks.py +88 -0
  27. arti_fit-1.0.2/src/arti/cli.py +1495 -0
  28. arti_fit-1.0.2/src/arti/config.py +152 -0
  29. arti_fit-1.0.2/src/arti/conversation.py +166 -0
  30. arti_fit-1.0.2/src/arti/distinctness.py +157 -0
  31. arti_fit-1.0.2/src/arti/fit/__init__.py +85 -0
  32. arti_fit-1.0.2/src/arti/fit/artifacts.py +1050 -0
  33. arti_fit-1.0.2/src/arti/fit/batch_schema.py +74 -0
  34. arti_fit-1.0.2/src/arti/fit/config.py +371 -0
  35. arti_fit-1.0.2/src/arti/fit/docs.py +302 -0
  36. arti_fit-1.0.2/src/arti/fit/doctor.py +343 -0
  37. arti_fit-1.0.2/src/arti/fit/insertion.py +295 -0
  38. arti_fit-1.0.2/src/arti/fit/metadata.py +41 -0
  39. arti_fit-1.0.2/src/arti/fit/objectives.py +57 -0
  40. arti_fit-1.0.2/src/arti/fit/plugins.py +91 -0
  41. arti_fit-1.0.2/src/arti/fit/profiles.py +42 -0
  42. arti_fit-1.0.2/src/arti/fit/project.py +916 -0
  43. arti_fit-1.0.2/src/arti/fit/runtime.py +134 -0
  44. arti_fit-1.0.2/src/arti/fit/scales.py +33 -0
  45. arti_fit-1.0.2/src/arti/fit/scanner.py +207 -0
  46. arti_fit-1.0.2/src/arti/fit/strategies.py +147 -0
  47. arti_fit-1.0.2/src/arti/functional.py +206 -0
  48. arti_fit-1.0.2/src/arti/init.py +26 -0
  49. arti_fit-1.0.2/src/arti/inspection.py +204 -0
  50. arti_fit-1.0.2/src/arti/integrations/__init__.py +15 -0
  51. arti_fit-1.0.2/src/arti/integrations/qwen.py +257 -0
  52. arti_fit-1.0.2/src/arti/jax/__init__.py +285 -0
  53. arti_fit-1.0.2/src/arti/layered_recall.py +873 -0
  54. arti_fit-1.0.2/src/arti/layers.py +421 -0
  55. arti_fit-1.0.2/src/arti/literal_decoder.py +268 -0
  56. arti_fit-1.0.2/src/arti/literal_fit.py +123 -0
  57. arti_fit-1.0.2/src/arti/membrane.py +189 -0
  58. arti_fit-1.0.2/src/arti/models.py +21 -0
  59. arti_fit-1.0.2/src/arti/nn.py +599 -0
  60. arti_fit-1.0.2/src/arti/outputs.py +20 -0
  61. arti_fit-1.0.2/src/arti/pretrained.py +927 -0
  62. arti_fit-1.0.2/src/arti/pretrained_cli.py +187 -0
  63. arti_fit-1.0.2/src/arti/providers.py +329 -0
  64. arti_fit-1.0.2/src/arti/pulse.py +145 -0
  65. arti_fit-1.0.2/src/arti/py.typed +1 -0
  66. arti_fit-1.0.2/src/arti/recall_topology.py +361 -0
  67. arti_fit-1.0.2/src/arti/recall_ttt.py +624 -0
  68. arti_fit-1.0.2/src/arti/runtime_vocab.py +484 -0
  69. arti_fit-1.0.2/src/arti/serialization.py +658 -0
  70. arti_fit-1.0.2/src/arti/source_integrity.py +375 -0
  71. arti_fit-1.0.2/src/arti/text_bitmap.py +245 -0
  72. arti_fit-1.0.2/src/arti/text_tensor.py +302 -0
  73. arti_fit-1.0.2/src/arti/torch/__init__.py +363 -0
  74. arti_fit-1.0.2/src/arti/torch/blocks.py +5 -0
  75. arti_fit-1.0.2/src/arti/torch/config.py +5 -0
  76. arti_fit-1.0.2/src/arti/torch/cuda.py +92 -0
  77. arti_fit-1.0.2/src/arti/torch/fit.py +19 -0
  78. arti_fit-1.0.2/src/arti/torch/functional.py +27 -0
  79. arti_fit-1.0.2/src/arti/torch/layers.py +19 -0
  80. arti_fit-1.0.2/src/arti/torch/models.py +5 -0
  81. arti_fit-1.0.2/src/arti/torch/outputs.py +5 -0
  82. arti_fit-1.0.2/src/arti/torch/training.py +5 -0
  83. arti_fit-1.0.2/src/arti/training.py +130 -0
  84. arti_fit-1.0.2/src/arti/usage.py +196 -0
  85. arti_fit-1.0.2/src/arti/utils.py +17 -0
  86. arti_fit-1.0.2/src/arti/visual_field.py +168 -0
  87. arti_fit-1.0.2/src/arti/visual_scan.py +407 -0
  88. arti_fit-1.0.2/tests/test_arti_st.py +250 -0
  89. arti_fit-1.0.2/tests/test_attachment.py +164 -0
  90. arti_fit-1.0.2/tests/test_backend_namespaces.py +276 -0
  91. arti_fit-1.0.2/tests/test_blocks.py +16 -0
  92. arti_fit-1.0.2/tests/test_conversation_context.py +80 -0
  93. arti_fit-1.0.2/tests/test_device.py +17 -0
  94. arti_fit-1.0.2/tests/test_fit_api.py +3042 -0
  95. arti_fit-1.0.2/tests/test_fold_module.py +144 -0
  96. arti_fit-1.0.2/tests/test_half_activation.py +54 -0
  97. arti_fit-1.0.2/tests/test_inspection.py +72 -0
  98. arti_fit-1.0.2/tests/test_layered_recall.py +276 -0
  99. arti_fit-1.0.2/tests/test_layers.py +459 -0
  100. arti_fit-1.0.2/tests/test_learned_pulse.py +162 -0
  101. arti_fit-1.0.2/tests/test_literal_decoder.py +135 -0
  102. arti_fit-1.0.2/tests/test_masking.py +41 -0
  103. arti_fit-1.0.2/tests/test_membrane.py +104 -0
  104. arti_fit-1.0.2/tests/test_package_metadata.py +62 -0
  105. arti_fit-1.0.2/tests/test_pulse.py +82 -0
  106. arti_fit-1.0.2/tests/test_recall_refiner.py +129 -0
  107. arti_fit-1.0.2/tests/test_recall_ttt.py +277 -0
  108. arti_fit-1.0.2/tests/test_runtime_vocab.py +213 -0
  109. arti_fit-1.0.2/tests/test_security_boundaries.py +91 -0
  110. arti_fit-1.0.2/tests/test_serialization.py +29 -0
  111. arti_fit-1.0.2/tests/test_source_integrity.py +184 -0
  112. arti_fit-1.0.2/tests/test_text_bitmap.py +70 -0
  113. arti_fit-1.0.2/tests/test_text_tensor.py +150 -0
  114. arti_fit-1.0.2/tests/test_torch_backend_runtime.py +56 -0
  115. arti_fit-1.0.2/tests/test_usage_api.py +105 -0
  116. arti_fit-1.0.2/tests/test_visual_field.py +69 -0
  117. arti_fit-1.0.2/tests/test_visual_scan.py +178 -0
  118. arti_fit-1.0.2/uv.lock +2552 -0
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .pytest_cache/
5
+ .tmp*/
6
+ .venv/
7
+ .uv-cache/
8
+ build/
9
+ dist/
10
+ site/
11
+ .coverage
12
+ htmlcov/
13
+ *.arti.st
14
+ *.lock.json
@@ -0,0 +1,12 @@
1
+ # AI Assistance
2
+
3
+ ARTI's concepts, mechanism definitions, architecture, and final engineering
4
+ decisions are directed by Thiocy.
5
+
6
+ AI-assisted development tools have been used during implementation, testing,
7
+ documentation, code review, and release auditing. Generated suggestions are
8
+ reviewed and accepted or rejected by the human maintainer. AI systems are not
9
+ project authors, do not own copyright, and are not responsible for releases.
10
+
11
+ The human maintainer remains responsible for the correctness, security,
12
+ licensing, and published claims of the project.
@@ -0,0 +1,8 @@
1
+ # Authors
2
+
3
+ ARTI was initiated and designed by Thiocy.
4
+
5
+ - GitHub: [@Thiocy](https://github.com/Thiocy)
6
+
7
+ Additional contributors retain attribution through the project history and
8
+ their accepted contributions.
@@ -0,0 +1,12 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use ARTI in research or software, please cite this project."
3
+ title: "ARTI: Composable Latent Tensor Layers for PyTorch"
4
+ type: software
5
+ authors:
6
+ - name: Thiocy
7
+ website: "https://github.com/Thiocy"
8
+ version: 1.0.2
9
+ date-released: 2026-07-11
10
+ repository-code: "https://github.com/ragnarok-io/ARTI"
11
+ url: "https://github.com/ragnarok-io/ARTI"
12
+ license: MIT
@@ -0,0 +1,12 @@
1
+ # Contributing
2
+
3
+ ARTI is a tensor-first, domain-independent neural-network library.
4
+
5
+ ```bash
6
+ uv sync --extra dev
7
+ uv run --extra dev pytest
8
+ uv build
9
+ ```
10
+
11
+ Keep changes scoped, document public APIs, and add focused tests for shapes,
12
+ masks, gradients, devices, and serialization where applicable.
arti_fit-1.0.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ARTI contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,251 @@
1
+ Metadata-Version: 2.4
2
+ Name: arti-fit
3
+ Version: 1.0.2
4
+ Summary: AI x RT: dynamic latent tensor representation layers for PyTorch.
5
+ Author: Thiocy
6
+ License: MIT
7
+ License-File: AUTHORS.md
8
+ License-File: LICENSE
9
+ Keywords: latent-tensor,neural-networks,pytorch,representation-learning
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: numpy>=1.24
21
+ Requires-Dist: safetensors>=0.4
22
+ Requires-Dist: tomli>=2.0; python_version < '3.11'
23
+ Requires-Dist: torch>=2.2
24
+ Provides-Extra: all
25
+ Requires-Dist: accelerate>=0.33; extra == 'all'
26
+ Requires-Dist: build>=1.2; extra == 'all'
27
+ Requires-Dist: diffusers>=0.30; extra == 'all'
28
+ Requires-Dist: equinox>=0.11.0; extra == 'all'
29
+ Requires-Dist: hatchling>=1.25; extra == 'all'
30
+ Requires-Dist: jax>=0.4.30; extra == 'all'
31
+ Requires-Dist: mkdocs-material>=9.5; extra == 'all'
32
+ Requires-Dist: mkdocs>=1.6; extra == 'all'
33
+ Requires-Dist: mkdocstrings[python]>=0.25; extra == 'all'
34
+ Requires-Dist: numpy>=2.0; extra == 'all'
35
+ Requires-Dist: optax>=0.2.0; extra == 'all'
36
+ Requires-Dist: peft>=0.12; extra == 'all'
37
+ Requires-Dist: pillow>=10.0; extra == 'all'
38
+ Requires-Dist: pytest>=8.0; extra == 'all'
39
+ Requires-Dist: safetensors>=0.4; extra == 'all'
40
+ Requires-Dist: torch>=2.2; extra == 'all'
41
+ Requires-Dist: transformers>=4.51; extra == 'all'
42
+ Provides-Extra: dev
43
+ Requires-Dist: build>=1.2; extra == 'dev'
44
+ Requires-Dist: hatchling>=1.25; extra == 'dev'
45
+ Requires-Dist: numpy>=2.0; extra == 'dev'
46
+ Requires-Dist: pytest>=8.0; extra == 'dev'
47
+ Requires-Dist: torch>=2.2; extra == 'dev'
48
+ Provides-Extra: docs
49
+ Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
50
+ Requires-Dist: mkdocs>=1.6; extra == 'docs'
51
+ Requires-Dist: mkdocstrings[python]>=0.25; extra == 'docs'
52
+ Provides-Extra: font
53
+ Requires-Dist: pillow>=10.0; extra == 'font'
54
+ Provides-Extra: jax
55
+ Requires-Dist: equinox>=0.11.0; extra == 'jax'
56
+ Requires-Dist: jax>=0.4.30; extra == 'jax'
57
+ Requires-Dist: optax>=0.2.0; extra == 'jax'
58
+ Provides-Extra: peft
59
+ Requires-Dist: accelerate>=0.33; extra == 'peft'
60
+ Requires-Dist: peft>=0.12; extra == 'peft'
61
+ Requires-Dist: transformers>=4.51; extra == 'peft'
62
+ Provides-Extra: qwen
63
+ Requires-Dist: accelerate>=0.33; extra == 'qwen'
64
+ Requires-Dist: safetensors>=0.4; extra == 'qwen'
65
+ Requires-Dist: transformers>=4.51; extra == 'qwen'
66
+ Provides-Extra: sd
67
+ Requires-Dist: accelerate>=0.33; extra == 'sd'
68
+ Requires-Dist: diffusers>=0.30; extra == 'sd'
69
+ Requires-Dist: peft>=0.12; extra == 'sd'
70
+ Requires-Dist: pillow>=10.0; extra == 'sd'
71
+ Requires-Dist: safetensors>=0.4; extra == 'sd'
72
+ Requires-Dist: transformers>=4.51; extra == 'sd'
73
+ Provides-Extra: torch
74
+ Requires-Dist: torch>=2.2; extra == 'torch'
75
+ Description-Content-Type: text/markdown
76
+
77
+ # ARTI
78
+
79
+ **AI x RT: composable latent tensor layers for PyTorch.**
80
+
81
+ ARTI is a domain-independent neural-network library for transforming hidden
82
+ tensors at runtime. Its layers work with ordinary tensors and can optionally
83
+ use coordinates, masks, visibility, latent recall, and compact workspaces.
84
+
85
+ ```text
86
+ hidden tensor -> ARTI layer or block -> transformed latent tensor
87
+ ```
88
+
89
+ ARTI does not define a tokenizer, task head, data schema, or business model.
90
+ Applications remain responsible for encoding their context into tensors.
91
+
92
+ Version 1.0.2 is a **Stable Candidate**. The supported 1.x surface is frozen
93
+ for final compatibility verification, but this release does not yet carry an
94
+ LTS commitment. See [Stability](STABILITY.md) and [Security](SECURITY.md).
95
+
96
+ ## Install
97
+
98
+ Add ARTI to a project with [uv](https://docs.astral.sh/uv/):
99
+
100
+ ```bash
101
+ uv add arti-fit
102
+ ```
103
+
104
+ ARTI requires Python 3.10 or newer and PyTorch 2.2 or newer. The consuming
105
+ project chooses the appropriate CPU or CUDA build of PyTorch.
106
+
107
+ The PyPI distribution is named `arti-fit`; the Python import remains `arti`.
108
+
109
+ Optional integrations can be installed as needed:
110
+
111
+ ```bash
112
+ uv sync --extra jax
113
+ uv sync --extra qwen
114
+ uv sync --extra peft
115
+ uv sync --extra sd
116
+ ```
117
+
118
+ ## Use ARTI As A Layer
119
+
120
+ The smallest API behaves like a normal PyTorch layer:
121
+
122
+ ```python
123
+ import arti
124
+ import torch
125
+
126
+ layer = arti.nn.Layer(dim=32)
127
+ x = torch.randn(4, 16, 32)
128
+ mask = torch.ones(4, 16, dtype=torch.bool)
129
+
130
+ out = layer(x, mask=mask)
131
+
132
+ assert out.y.shape == (4, 16, 32)
133
+ assert out.pooled.shape == (4, 32)
134
+ print(out.diagnostics.keys())
135
+ ```
136
+
137
+ For `[B, D]` inputs, ARTI treats each row as a single token and restores the
138
+ original rank on output.
139
+
140
+ Capabilities are opt-in. Enable only the structure carried by the data:
141
+
142
+ ```python
143
+ recall_layer = arti.nn.Layer(dim=32, profile="recall")
144
+ multisource = arti.nn.Layer(dim=32, profile="multisource", coord_dim=4)
145
+ ```
146
+
147
+ ## Compose Recall, Half, And Fold
148
+
149
+ ARTI mechanisms are also available as standalone modules:
150
+
151
+ ```python
152
+ import arti
153
+
154
+ recall = arti.ARTILatentRecallField(hidden_dim=64, slots=8)
155
+ half = arti.nn.Half()
156
+ fold = arti.nn.Fold(k=16, dim=64)
157
+ ```
158
+
159
+ The common Recall branch pattern is deliberately small:
160
+
161
+ ```python
162
+ delta = recall(h, mask, recall=None)[0]
163
+ h = h + half(delta)
164
+ workspace = fold(h, mask=mask)
165
+ ```
166
+
167
+ `Recall` proposes latent traces, `Half` applies feature-strength survival, and
168
+ `Fold` compacts surviving information into a fixed-size workspace. Each module
169
+ can be used independently.
170
+
171
+ ## Attach To An Existing Model
172
+
173
+ ARTI can discover and attach Recall branches without changing the model class:
174
+
175
+ ```python
176
+ import arti
177
+
178
+ model = arti.ARTI.attach(
179
+ model,
180
+ recall={
181
+ "layers": "model.layers.*",
182
+ "rank": 16,
183
+ "slots": 8,
184
+ },
185
+ )
186
+
187
+ print(model.arti.summary())
188
+ model.arti.save("assistant.recall.arti.st")
189
+ ```
190
+
191
+ Attachment configuration supports explicit layer paths, per-layer dimensions,
192
+ independent Recall lines, Half switches, resource previews, and reversible
193
+ removal. Transformers, PEFT, and Diffusers are optional integration boundaries;
194
+ the core package remains PyTorch-first.
195
+
196
+ ## Save And Load Weights
197
+
198
+ ARTI uses SafeTensors with JSON integrity sidecars:
199
+
200
+ ```python
201
+ saved = arti.save(layer, "layer.arti.st")
202
+ loaded = arti.load("layer.arti.st", model=fresh_layer)
203
+
204
+ print(saved.weights_sha256)
205
+ print(loaded.missing_keys, loaded.unexpected_keys)
206
+ ```
207
+
208
+ ARTI 1.x reads compatible format-version 1 artifacts produced by the pre-public
209
+ 0.x line. Legacy `.pt` migration uses PyTorch's restricted tensor-only loader:
210
+
211
+ ```python
212
+ arti.migrate_pt("legacy-state.pt", "layer.arti.st")
213
+ ```
214
+
215
+ Artifact hashes detect modification relative to their lock files; they are not
216
+ publisher signatures. Obtain models and weights from trusted sources.
217
+
218
+ ## Public Modules
219
+
220
+ - `arti.nn`: `Layer`, `Half`, `Fold`, `Pulse`, `RecallRefiner`, and visual workspace modules.
221
+ - `arti`: complete ARTI layers, residual blocks, reference models, attachment, serialization, and diagnostics.
222
+ - `arti.torch`: backend-explicit aliases for PyTorch applications.
223
+ - `arti.jax`: optional functional JAX backend with JIT and gradient support.
224
+ - `arti.functional`: mask, visibility, pooling, coordinate-frame, and activation helpers.
225
+
226
+ Experimental and legacy APIs are identified in their docstrings and are not
227
+ frozen at the same level as the supported core surface.
228
+
229
+ ## Develop
230
+
231
+ ```bash
232
+ git clone https://github.com/ragnarok-io/ARTI.git
233
+ cd ARTI
234
+ uv sync --extra dev
235
+ uv run --extra dev pytest
236
+ uv build
237
+ ```
238
+
239
+ The test suite covers tensor shapes, masks, gradients, serialization, malformed
240
+ artifacts, public API imports, and optional backend boundaries. Contribution
241
+ guidance is in [CONTRIBUTING.md](CONTRIBUTING.md).
242
+
243
+ ## Citation And Authorship
244
+
245
+ ARTI was initiated and designed by [Thiocy](https://github.com/Thiocy).
246
+ Citation metadata is provided in [CITATION.cff](CITATION.cff). The project also
247
+ documents [authorship](AUTHORS.md) and [AI assistance](AI_ASSISTANCE.md).
248
+
249
+ ## License
250
+
251
+ [MIT](LICENSE)
@@ -0,0 +1,175 @@
1
+ # ARTI
2
+
3
+ **AI x RT: composable latent tensor layers for PyTorch.**
4
+
5
+ ARTI is a domain-independent neural-network library for transforming hidden
6
+ tensors at runtime. Its layers work with ordinary tensors and can optionally
7
+ use coordinates, masks, visibility, latent recall, and compact workspaces.
8
+
9
+ ```text
10
+ hidden tensor -> ARTI layer or block -> transformed latent tensor
11
+ ```
12
+
13
+ ARTI does not define a tokenizer, task head, data schema, or business model.
14
+ Applications remain responsible for encoding their context into tensors.
15
+
16
+ Version 1.0.2 is a **Stable Candidate**. The supported 1.x surface is frozen
17
+ for final compatibility verification, but this release does not yet carry an
18
+ LTS commitment. See [Stability](STABILITY.md) and [Security](SECURITY.md).
19
+
20
+ ## Install
21
+
22
+ Add ARTI to a project with [uv](https://docs.astral.sh/uv/):
23
+
24
+ ```bash
25
+ uv add arti-fit
26
+ ```
27
+
28
+ ARTI requires Python 3.10 or newer and PyTorch 2.2 or newer. The consuming
29
+ project chooses the appropriate CPU or CUDA build of PyTorch.
30
+
31
+ The PyPI distribution is named `arti-fit`; the Python import remains `arti`.
32
+
33
+ Optional integrations can be installed as needed:
34
+
35
+ ```bash
36
+ uv sync --extra jax
37
+ uv sync --extra qwen
38
+ uv sync --extra peft
39
+ uv sync --extra sd
40
+ ```
41
+
42
+ ## Use ARTI As A Layer
43
+
44
+ The smallest API behaves like a normal PyTorch layer:
45
+
46
+ ```python
47
+ import arti
48
+ import torch
49
+
50
+ layer = arti.nn.Layer(dim=32)
51
+ x = torch.randn(4, 16, 32)
52
+ mask = torch.ones(4, 16, dtype=torch.bool)
53
+
54
+ out = layer(x, mask=mask)
55
+
56
+ assert out.y.shape == (4, 16, 32)
57
+ assert out.pooled.shape == (4, 32)
58
+ print(out.diagnostics.keys())
59
+ ```
60
+
61
+ For `[B, D]` inputs, ARTI treats each row as a single token and restores the
62
+ original rank on output.
63
+
64
+ Capabilities are opt-in. Enable only the structure carried by the data:
65
+
66
+ ```python
67
+ recall_layer = arti.nn.Layer(dim=32, profile="recall")
68
+ multisource = arti.nn.Layer(dim=32, profile="multisource", coord_dim=4)
69
+ ```
70
+
71
+ ## Compose Recall, Half, And Fold
72
+
73
+ ARTI mechanisms are also available as standalone modules:
74
+
75
+ ```python
76
+ import arti
77
+
78
+ recall = arti.ARTILatentRecallField(hidden_dim=64, slots=8)
79
+ half = arti.nn.Half()
80
+ fold = arti.nn.Fold(k=16, dim=64)
81
+ ```
82
+
83
+ The common Recall branch pattern is deliberately small:
84
+
85
+ ```python
86
+ delta = recall(h, mask, recall=None)[0]
87
+ h = h + half(delta)
88
+ workspace = fold(h, mask=mask)
89
+ ```
90
+
91
+ `Recall` proposes latent traces, `Half` applies feature-strength survival, and
92
+ `Fold` compacts surviving information into a fixed-size workspace. Each module
93
+ can be used independently.
94
+
95
+ ## Attach To An Existing Model
96
+
97
+ ARTI can discover and attach Recall branches without changing the model class:
98
+
99
+ ```python
100
+ import arti
101
+
102
+ model = arti.ARTI.attach(
103
+ model,
104
+ recall={
105
+ "layers": "model.layers.*",
106
+ "rank": 16,
107
+ "slots": 8,
108
+ },
109
+ )
110
+
111
+ print(model.arti.summary())
112
+ model.arti.save("assistant.recall.arti.st")
113
+ ```
114
+
115
+ Attachment configuration supports explicit layer paths, per-layer dimensions,
116
+ independent Recall lines, Half switches, resource previews, and reversible
117
+ removal. Transformers, PEFT, and Diffusers are optional integration boundaries;
118
+ the core package remains PyTorch-first.
119
+
120
+ ## Save And Load Weights
121
+
122
+ ARTI uses SafeTensors with JSON integrity sidecars:
123
+
124
+ ```python
125
+ saved = arti.save(layer, "layer.arti.st")
126
+ loaded = arti.load("layer.arti.st", model=fresh_layer)
127
+
128
+ print(saved.weights_sha256)
129
+ print(loaded.missing_keys, loaded.unexpected_keys)
130
+ ```
131
+
132
+ ARTI 1.x reads compatible format-version 1 artifacts produced by the pre-public
133
+ 0.x line. Legacy `.pt` migration uses PyTorch's restricted tensor-only loader:
134
+
135
+ ```python
136
+ arti.migrate_pt("legacy-state.pt", "layer.arti.st")
137
+ ```
138
+
139
+ Artifact hashes detect modification relative to their lock files; they are not
140
+ publisher signatures. Obtain models and weights from trusted sources.
141
+
142
+ ## Public Modules
143
+
144
+ - `arti.nn`: `Layer`, `Half`, `Fold`, `Pulse`, `RecallRefiner`, and visual workspace modules.
145
+ - `arti`: complete ARTI layers, residual blocks, reference models, attachment, serialization, and diagnostics.
146
+ - `arti.torch`: backend-explicit aliases for PyTorch applications.
147
+ - `arti.jax`: optional functional JAX backend with JIT and gradient support.
148
+ - `arti.functional`: mask, visibility, pooling, coordinate-frame, and activation helpers.
149
+
150
+ Experimental and legacy APIs are identified in their docstrings and are not
151
+ frozen at the same level as the supported core surface.
152
+
153
+ ## Develop
154
+
155
+ ```bash
156
+ git clone https://github.com/ragnarok-io/ARTI.git
157
+ cd ARTI
158
+ uv sync --extra dev
159
+ uv run --extra dev pytest
160
+ uv build
161
+ ```
162
+
163
+ The test suite covers tensor shapes, masks, gradients, serialization, malformed
164
+ artifacts, public API imports, and optional backend boundaries. Contribution
165
+ guidance is in [CONTRIBUTING.md](CONTRIBUTING.md).
166
+
167
+ ## Citation And Authorship
168
+
169
+ ARTI was initiated and designed by [Thiocy](https://github.com/Thiocy).
170
+ Citation metadata is provided in [CITATION.cff](CITATION.cff). The project also
171
+ documents [authorship](AUTHORS.md) and [AI assistance](AI_ASSISTANCE.md).
172
+
173
+ ## License
174
+
175
+ [MIT](LICENSE)
@@ -0,0 +1,32 @@
1
+ # Security Policy
2
+
3
+ ## Supported Version
4
+
5
+ Security fixes are provided for the current public 1.x release line.
6
+
7
+ ## Trust Boundaries
8
+
9
+ - `.arti.st` uses SafeTensors and validates its sidecar hashes. Hashes detect
10
+ accidental or unauthorised modification relative to the supplied lock, but
11
+ they are not a publisher signature. Obtain artifacts from a trusted source.
12
+ - Legacy `.pt` migration and ARTI artifact loaders use PyTorch's restricted
13
+ `weights_only=True` loader. Full pickled Python objects are not supported.
14
+ - Declarative pretrained loading rejects `trust_remote_code=True`. Review and
15
+ instantiate models requiring remote code yourself before passing the model
16
+ object to ARTI.
17
+ - CLI model references in `module:attribute` form intentionally import and run
18
+ local Python factories. Treat such references and their Python environment as
19
+ executable code, not as passive configuration.
20
+ - Downloaded models and optional dependencies remain external supply-chain
21
+ inputs. Pin revisions and dependencies according to your deployment policy.
22
+ - ARTI rejects oversized CLI sample tensors and malformed artifact metadata,
23
+ but callers remain responsible for bounding arbitrary model inputs, sequence
24
+ lengths, batch sizes, and user-selected model dimensions.
25
+ - NaN and infinity values in activation configuration are rejected. NaN or
26
+ infinity in model data follows normal PyTorch propagation semantics.
27
+
28
+ ## Reporting
29
+
30
+ Report suspected vulnerabilities privately to the repository maintainers.
31
+ Do not include secrets, private model weights, or sensitive user data in a
32
+ public issue.
@@ -0,0 +1,67 @@
1
+ # Stability Policy
2
+
3
+ ARTI 1.0.2 is published as a Stable Candidate. This label is a release stage,
4
+ not a separate package version and not an LTS promise.
5
+
6
+ ## Supported 1.x Surface
7
+
8
+ The following contracts are frozen across compatible 1.x releases:
9
+
10
+ - Core tensor contracts for `[B, D]` and `[B, N, D]` inputs.
11
+ - `arti.nn` core layers: `Layer`, `Half`, `Fold`, `Pulse`, and
12
+ `RecallRefiner`.
13
+ - Root core layers: `ARTILayer`, `ARTIResidualBlock`, `ARTISequenceBlock`,
14
+ `ARTIPooledBlock`, and `ARTIClassifier`.
15
+ - `ARTI.attach`, attachment configuration, save/load, and reversible removal.
16
+ - The `arti.st` format-version 1 reader and writer.
17
+ - Mask, coordinate, visibility, output, and diagnostics tensor contracts.
18
+
19
+ Modules and parameters explicitly documented as alpha, experimental, or
20
+ legacy are not frozen at the same level. They will still follow the deprecation
21
+ process below.
22
+
23
+ ## Compatibility
24
+
25
+ - Patch releases fix defects without intentionally breaking supported APIs.
26
+ - Minor 1.x releases may add optional parameters and APIs with compatible
27
+ defaults.
28
+ - Breaking supported APIs requires a new major release.
29
+ - ARTI 1.x reads valid format-version 1 `arti.st` artifacts produced by the
30
+ pre-public 0.x line. Artifact format compatibility is independent of the
31
+ package version.
32
+ - Serialized artifacts must not depend on Python pickle for normal `.arti.st`
33
+ loading.
34
+
35
+ ## Deprecation
36
+
37
+ A supported API is deprecated before removal. Deprecation must include a
38
+ runtime warning, a documented replacement, and coverage in the release notes.
39
+ Removal occurs no earlier than the next major release. Security or correctness
40
+ issues may require an exception, which must be documented.
41
+
42
+ ## Support Matrix
43
+
44
+ | Component | Stable Candidate support |
45
+ | --- | --- |
46
+ | Python | 3.10, 3.11, 3.12 |
47
+ | PyTorch | 2.2 or newer |
48
+ | CPU | Supported |
49
+ | NVIDIA CUDA | Supported through CUDA-enabled PyTorch |
50
+ | JAX | Optional functional backend; smaller surface than PyTorch |
51
+ | Transformers, PEFT, Diffusers | Optional integrations |
52
+ | Artifact format | `arti.st` format version 1 |
53
+
54
+ ## Promotion To Stable
55
+
56
+ The Stable label requires the public CI matrix to pass from a clean checkout,
57
+ wheel and sdist installation checks to pass, the supported API inventory to be
58
+ reviewed, and at least one release-candidate feedback cycle to complete without
59
+ an unresolved compatibility defect.
60
+
61
+ ## Future LTS
62
+
63
+ An LTS release will be declared only with a published maintenance window of at
64
+ least 12 months, security and critical-defect support, a documented Python and
65
+ PyTorch support window, and continued read compatibility for supported
66
+ `arti.st` artifacts. Until that declaration, no ARTI release carries an LTS
67
+ commitment.