weightspace 0.1.0__tar.gz → 0.2.0__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 (48) hide show
  1. weightspace-0.2.0/.github/ISSUE_TEMPLATE/bug_report.yml +24 -0
  2. weightspace-0.2.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  3. weightspace-0.2.0/.github/ISSUE_TEMPLATE/feature_request.yml +15 -0
  4. weightspace-0.2.0/.github/dependabot.yml +10 -0
  5. weightspace-0.2.0/.github/pull_request_template.md +7 -0
  6. weightspace-0.2.0/.github/workflows/ci.yml +47 -0
  7. {weightspace-0.1.0 → weightspace-0.2.0}/.github/workflows/publish.yml +4 -2
  8. {weightspace-0.1.0 → weightspace-0.2.0}/.gitignore +1 -0
  9. weightspace-0.2.0/.pre-commit-config.yaml +13 -0
  10. weightspace-0.2.0/CHANGELOG.md +31 -0
  11. weightspace-0.2.0/CITATION.cff +25 -0
  12. weightspace-0.2.0/CODE_OF_CONDUCT.md +7 -0
  13. weightspace-0.2.0/CONTRIBUTING.md +31 -0
  14. weightspace-0.2.0/LICENSE +202 -0
  15. weightspace-0.2.0/NOTICE +16 -0
  16. weightspace-0.1.0/README.md → weightspace-0.2.0/PKG-INFO +84 -8
  17. weightspace-0.1.0/PKG-INFO → weightspace-0.2.0/README.md +42 -41
  18. weightspace-0.2.0/SECURITY.md +11 -0
  19. weightspace-0.2.0/docs/README.md +10 -0
  20. weightspace-0.2.0/docs/concepts.md +50 -0
  21. weightspace-0.2.0/docs/probes.md +26 -0
  22. weightspace-0.2.0/docs/providers.md +40 -0
  23. weightspace-0.2.0/llms.txt +42 -0
  24. {weightspace-0.1.0 → weightspace-0.2.0}/pyproject.toml +14 -4
  25. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/__init__.py +1 -1
  26. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/adapters.py +1 -1
  27. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/agent.py +12 -2
  28. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/cli.py +3 -0
  29. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/llm/__init__.py +7 -3
  30. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/llm/anthropic.py +22 -5
  31. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/llm/base.py +14 -1
  32. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/llm/openai.py +78 -1
  33. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/probes.py +2 -1
  34. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/render.py +4 -2
  35. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/sandbox.py +4 -2
  36. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/space.py +1 -1
  37. {weightspace-0.1.0 → weightspace-0.2.0}/tests/test_agent.py +6 -0
  38. {weightspace-0.1.0 → weightspace-0.2.0}/tests/test_llm.py +49 -1
  39. weightspace-0.1.0/.github/workflows/ci.yml +0 -14
  40. {weightspace-0.1.0 → weightspace-0.2.0}/examples/fix_quadrants.py +0 -0
  41. {weightspace-0.1.0 → weightspace-0.2.0}/examples/hf_reduce_loops.py +0 -0
  42. {weightspace-0.1.0 → weightspace-0.2.0}/examples/read_which_task.py +0 -0
  43. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/llm/mock.py +0 -0
  44. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/prompts.py +0 -0
  45. {weightspace-0.1.0 → weightspace-0.2.0}/src/weightspace/tasks.py +0 -0
  46. {weightspace-0.1.0 → weightspace-0.2.0}/tests/conftest.py +0 -0
  47. {weightspace-0.1.0 → weightspace-0.2.0}/tests/test_render.py +0 -0
  48. {weightspace-0.1.0 → weightspace-0.2.0}/tests/test_space.py +0 -0
@@ -0,0 +1,24 @@
1
+ name: Bug report
2
+ description: Something doesn't work as documented
3
+ labels: [bug]
4
+ body:
5
+ - type: textarea
6
+ id: what
7
+ attributes:
8
+ label: What happened
9
+ description: What you ran, what you expected and what you got. Include the traceback.
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: repro
14
+ attributes:
15
+ label: Minimal reproduction
16
+ description: A short script, ideally with `wsp.ScriptedLLM` so it runs without an API key.
17
+ render: python
18
+ - type: input
19
+ id: versions
20
+ attributes:
21
+ label: Versions
22
+ description: weightspace, Python, torch / transformers, LLM provider and model
23
+ validations:
24
+ required: true
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Security issue
4
+ url: https://github.com/leofmarciano/weightspace/security/advisories/new
5
+ about: Report vulnerabilities privately.
@@ -0,0 +1,15 @@
1
+ name: Feature request
2
+ description: A new adapter, provider, tool or experiment
3
+ labels: [enhancement]
4
+ body:
5
+ - type: textarea
6
+ id: problem
7
+ attributes:
8
+ label: What are you trying to do
9
+ validations:
10
+ required: true
11
+ - type: textarea
12
+ id: proposal
13
+ attributes:
14
+ label: Proposal
15
+ description: The API you'd like, or how you'd implement it.
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: monthly
7
+ - package-ecosystem: pip
8
+ directory: /
9
+ schedule:
10
+ interval: monthly
@@ -0,0 +1,7 @@
1
+ ## What and why
2
+
3
+ ## How it was tested
4
+
5
+ - [ ] `ruff check . && ruff format --check .`
6
+ - [ ] `pytest`
7
+ - [ ] Added a `CHANGELOG.md` entry (if user-facing)
@@ -0,0 +1,47 @@
1
+ name: ci
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ pull_request:
6
+ concurrency:
7
+ group: ci-${{ github.ref }}
8
+ cancel-in-progress: true
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: actions/setup-python@v7
15
+ with:
16
+ python-version: "3.12"
17
+ - run: pip install torch --index-url https://download.pytorch.org/whl/cpu
18
+ - run: pip install -e ".[all,dev]"
19
+ - run: ruff check . && ruff format --check .
20
+ - run: mypy src/weightspace
21
+ test:
22
+ runs-on: ${{ matrix.os }}
23
+ strategy:
24
+ fail-fast: false
25
+ matrix:
26
+ os: [ubuntu-latest]
27
+ python: ["3.10", "3.11", "3.12", "3.13"]
28
+ include:
29
+ - os: macos-latest
30
+ python: "3.12"
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+ - uses: actions/setup-python@v7
34
+ with:
35
+ python-version: ${{ matrix.python }}
36
+ - run: pip install torch --index-url https://download.pytorch.org/whl/cpu
37
+ - run: pip install -e ".[all,dev]"
38
+ - run: pytest -q
39
+ build:
40
+ runs-on: ubuntu-latest
41
+ steps:
42
+ - uses: actions/checkout@v4
43
+ - uses: actions/setup-python@v7
44
+ with:
45
+ python-version: "3.12"
46
+ - run: pip install build twine
47
+ - run: python -m build && twine check --strict dist/*
@@ -8,11 +8,11 @@ jobs:
8
8
  runs-on: ubuntu-latest
9
9
  steps:
10
10
  - uses: actions/checkout@v4
11
- - uses: actions/setup-python@v5
11
+ - uses: actions/setup-python@v7
12
12
  with:
13
13
  python-version: "3.11"
14
14
  - run: pip install build && python -m build
15
- - uses: actions/upload-artifact@v4
15
+ - uses: actions/upload-artifact@v7
16
16
  with:
17
17
  name: dist
18
18
  path: dist/
@@ -28,3 +28,5 @@ jobs:
28
28
  name: dist
29
29
  path: dist/
30
30
  - uses: pypa/gh-action-pypi-publish@release/v1
31
+ with:
32
+ skip-existing: true
@@ -7,3 +7,4 @@ dist/
7
7
  runs/
8
8
  *.npz
9
9
  *.safetensors
10
+ .mypy_cache/
@@ -0,0 +1,13 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.17.3
4
+ hooks:
5
+ - id: ruff
6
+ - id: ruff-format
7
+ - repo: https://github.com/pre-commit/pre-commit-hooks
8
+ rev: v6.0.0
9
+ hooks:
10
+ - id: end-of-file-fixer
11
+ - id: trailing-whitespace
12
+ - id: check-yaml
13
+ - id: check-added-large-files
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/).
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.2.0] - 2026-11-03
8
+
9
+ ### Added
10
+ - `openresponses:<model>` backend (`OpenResponses`) for the [Open Responses](https://www.openresponses.org) spec (OpenAI Responses API), replaying encrypted reasoning between turns. `openai-responses:` is kept as an alias.
11
+ - `speed=` on `Session`, `wsp.read/fix/write/improve` and backends (CLI `--speed` / `--fast`) for provider fast mode: Anthropic `speed`, OpenAI `service_tier`. Saved in `result.json`.
12
+ - `usage.thinking_tokens` is recorded for Anthropic models.
13
+ - `llms.txt` with a short usage guide for coding agents.
14
+ - Exp. 8 replication harness for Qwen3.5-0.8B in `experiments/exp8`.
15
+ - Open-source project files, docs and a wider CI matrix.
16
+
17
+ ### Changed
18
+ - Anthropic `thinking=False` falls back to `effort="low"` on models that can't disable thinking (Opus 5.5).
19
+
20
+ ## [0.1.0] - 2026-11-03
21
+
22
+ ### Added
23
+ - `WeightSpace` with NumPy, PyTorch, Hugging Face, SafeTensors and `.pt` stores; tracked edits, diffs, checkpoints and sparse patches.
24
+ - `read`, `fix`, `write` and `improve` sessions with a persistent Python sandbox, budgeted probes and text mode.
25
+ - OpenAI-compatible (OpenAI, OpenRouter, vLLM, SGLang, Ollama) and Anthropic backends.
26
+ - `thinking` switch (off / low / medium / high / xhigh / max), with adaptive thinking and prompt caching on Anthropic.
27
+ - `weightspace` CLI and examples.
28
+
29
+ [Unreleased]: https://github.com/leofmarciano/weightspace/compare/v0.2.0...HEAD
30
+ [0.2.0]: https://github.com/leofmarciano/weightspace/compare/v0.1.0...v0.2.0
31
+ [0.1.0]: https://github.com/leofmarciano/weightspace/releases/tag/v0.1.0
@@ -0,0 +1,25 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use weightspace, please cite it as below, along with the original paper."
3
+ title: "weightspace: a framework for LLM-driven weight-space programming"
4
+ authors:
5
+ - name: "Marciano Theory SI"
6
+ - family-names: "Marciano"
7
+ given-names: "Leonardo"
8
+ license: Apache-2.0
9
+ repository-code: "https://github.com/leofmarciano/weightspace"
10
+ date-released: "2026-11-03"
11
+ version: "0.2.0"
12
+ keywords:
13
+ - weight-space-programming
14
+ - interpretability
15
+ - model-editing
16
+ references:
17
+ - type: article
18
+ title: "Sparks of Weight-Space Programming"
19
+ authors:
20
+ - family-names: "Takehi"
21
+ - family-names: "Teoh"
22
+ - family-names: "Zhang"
23
+ - family-names: "Khattab"
24
+ year: 2026
25
+ url: "https://rikiyat.github.io/blog/weight-space-programming/"
@@ -0,0 +1,7 @@
1
+ # Code of Conduct
2
+
3
+ This project follows the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
4
+
5
+ In short: be respectful, assume good faith, and keep discussions about the work. Harassment, insults and personal attacks are not tolerated.
6
+
7
+ Report unacceptable behaviour to the maintainer at leonardo.marciano@toolzz.me. Reports are handled confidentially, and maintainers may remove comments, commits or contributors that break these rules.
@@ -0,0 +1,31 @@
1
+ # Contributing
2
+
3
+ Thanks for helping out. Bug reports, new adapters, providers and experiments are all welcome.
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ git clone https://github.com/leofmarciano/weightspace && cd weightspace
9
+ pip install -e ".[all,dev]"
10
+ pre-commit install # optional: runs ruff on every commit
11
+ ```
12
+
13
+ ## Before opening a PR
14
+
15
+ ```bash
16
+ ruff check . && ruff format --check .
17
+ pytest
18
+ ```
19
+
20
+ Tests run offline: use `wsp.ScriptedLLM` or a fake client instead of real API calls. Don't commit API keys, model weights or large run artifacts (`runs/` is ignored).
21
+
22
+ ## Conventions
23
+
24
+ - Commit messages and PR titles follow [Conventional Commits](https://www.conventionalcommits.org/) in English: `feat(adapters): ...`, `fix: ...`, `docs: ...`, `test: ...`, `ci: ...`.
25
+ - Keep PRs small and focused, and add a test for any behaviour change.
26
+ - New LLM providers subclass `weightspace.llm.LLM`; new weight formats implement the `Store` interface in `space.py`.
27
+ - Add a line to `CHANGELOG.md` under "Unreleased".
28
+
29
+ ## Releases
30
+
31
+ Maintainers bump `version` in `pyproject.toml`, move the changelog entries under the new version, and push a `vX.Y.Z` tag. The `publish` workflow uploads to PyPI with Trusted Publishing.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,16 @@
1
+ weightspace
2
+ Copyright 2026 Marciano Theory SI
3
+
4
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ This project implements the method described in "Sparks of Weight-Space
7
+ Programming" (Takehi, Teoh, Zhang, Khattab, 2026),
8
+ https://rikiyat.github.io/blog/weight-space-programming/. The paper's code,
9
+ logs and checkpoints are not redistributed here.
10
+
11
+ It builds on third-party work:
12
+
13
+ - NumPy (BSD-3-Clause), PyTorch (BSD-style), Hugging Face Transformers and
14
+ safetensors (Apache-2.0).
15
+ - OpenAI and Anthropic Python SDKs (Apache-2.0 / MIT), used as optional
16
+ LLM backends.
@@ -1,4 +1,64 @@
1
- # weightspace
1
+ Metadata-Version: 2.5
2
+ Name: weightspace
3
+ Version: 0.2.0
4
+ Summary: Weight-space programming: let an LLM read and write neural network weights directly.
5
+ Project-URL: Homepage, https://marcianotheory.com
6
+ Project-URL: Repository, https://github.com/leofmarciano/weightspace
7
+ Project-URL: Issues, https://github.com/leofmarciano/weightspace/issues
8
+ Project-URL: Changelog, https://github.com/leofmarciano/weightspace/blob/main/CHANGELOG.md
9
+ Author: Marciano Theory SI
10
+ License: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: interpretability,llm,model-editing,pytorch,weights
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: numpy>=1.24
20
+ Provides-Extra: all
21
+ Requires-Dist: anthropic>=0.40; extra == 'all'
22
+ Requires-Dist: openai>=1.40; extra == 'all'
23
+ Requires-Dist: safetensors>=0.4; extra == 'all'
24
+ Requires-Dist: torch>=2.1; extra == 'all'
25
+ Requires-Dist: transformers>=4.40; extra == 'all'
26
+ Provides-Extra: anthropic
27
+ Requires-Dist: anthropic>=0.40; extra == 'anthropic'
28
+ Provides-Extra: dev
29
+ Requires-Dist: mypy>=1.10; extra == 'dev'
30
+ Requires-Dist: pre-commit>=3; extra == 'dev'
31
+ Requires-Dist: pytest>=8; extra == 'dev'
32
+ Requires-Dist: ruff>=0.5; extra == 'dev'
33
+ Provides-Extra: hf
34
+ Requires-Dist: safetensors>=0.4; extra == 'hf'
35
+ Requires-Dist: torch>=2.1; extra == 'hf'
36
+ Requires-Dist: transformers>=4.40; extra == 'hf'
37
+ Provides-Extra: openai
38
+ Requires-Dist: openai>=1.40; extra == 'openai'
39
+ Provides-Extra: torch
40
+ Requires-Dist: torch>=2.1; extra == 'torch'
41
+ Description-Content-Type: text/markdown
42
+
43
+ <h1 align="center">weightspace</h1>
44
+
45
+ <p align="center"><b>Let an LLM read and edit a neural network's weights directly.</b></p>
46
+
47
+ <p align="center">
48
+ <a href="https://pypi.org/project/weightspace/"><img alt="PyPI" src="https://img.shields.io/pypi/v/weightspace"></a>
49
+ <a href="https://github.com/leofmarciano/weightspace/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/leofmarciano/weightspace/actions/workflows/ci.yml/badge.svg"></a>
50
+ <a href="LICENSE"><img alt="License: Apache 2.0" src="https://img.shields.io/badge/license-Apache%202.0-2ea44f"></a>
51
+ <img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-3776ab">
52
+ </p>
53
+
54
+ <p align="center">
55
+ <a href="#quick-start">Quick start</a> ·
56
+ <a href="docs/README.md">Docs</a> ·
57
+ <a href="#examples">Examples</a> ·
58
+ <a href="experiments/exp8">Exp. 8 replication</a> ·
59
+ <a href="https://rikiyat.github.io/blog/weight-space-programming/">Paper</a> ·
60
+ <a href="https://marcianotheory.com">Marciano Theory</a>
61
+ </p>
2
62
 
3
63
  A small Python framework for **weight-space programming**: an LLM reads and edits a neural network's weights directly, by reasoning about what each part computes, instead of training it.
4
64
 
@@ -12,12 +72,12 @@ Based on [Sparks of Weight-Space Programming](https://rikiyat.github.io/blog/wei
12
72
  - **Budgeted forward passes.** You decide how the network may be run (scores, rollouts, generations, attention maps only...) by writing a `probe`, and how many times.
13
73
  - **Edit tracking.** Every run reports exactly how many weights changed, and exports a sparse patch.
14
74
  - **Text mode.** For small networks: dump every weight into the prompt and get one reply back, no tools (like the paper's first experiments).
15
- - **Providers.** OpenAI-compatible APIs (OpenAI, OpenRouter, vLLM, Ollama) and Anthropic, or your own `LLM` class.
75
+ - **Providers.** OpenAI-compatible APIs (OpenAI, OpenRouter, vLLM, Ollama), [Open Responses](https://www.openresponses.org) (`openresponses:<model>`) and Anthropic, or your own `LLM` class.
16
76
 
17
77
  ## Install
18
78
 
19
79
  ```bash
20
- pip install -e ".[all]" # or pick: .[torch] .[hf] .[openai] .[anthropic]
80
+ pip install "weightspace[all]" # or pick: [torch] [hf] [openai] [anthropic]
21
81
  export OPENAI_API_KEY=... # or ANTHROPIC_API_KEY / OPENROUTER_API_KEY
22
82
  ```
23
83
 
@@ -73,11 +133,14 @@ With thinking off, the provider's reasoning is disabled and the LLM is told to g
73
133
  | Backend | off | on |
74
134
  |---|---|---|
75
135
  | OpenAI | `reasoning_effort="none"` (`OpenAIChat(..., off_effort="minimal")` for gpt-5) | `reasoning_effort=<level>` |
136
+ | Open Responses | `reasoning.effort="none"` | `reasoning.effort=<level>` |
76
137
  | OpenRouter | `reasoning.enabled=false` | `reasoning.effort=<level>` |
77
138
  | vLLM / SGLang (Qwen3 etc.) | `OpenAIChat(..., thinking_style="chat_template")` → `enable_thinking=false` | `enable_thinking=true` |
78
- | Anthropic | `thinking.type="disabled"` | extended thinking with a 2k / 8k / 16k token budget |
139
+ | Anthropic | `thinking.type="disabled"`; on Opus 5.5, where thinking is always on, `effort="low"` instead | adaptive thinking with `effort=<level>` on newer models such as Opus 5.5; older models fall back to a token budget |
79
140
 
80
- CLI: `--no-thinking` or `--thinking low|medium|high`. The setting is saved in `result.json`, so you can compare runs with and without thinking.
141
+ CLI: `--no-thinking` or `--thinking low|medium|high|xhigh|max`. The setting is saved in `result.json`, so you can compare runs with and without thinking.
142
+
143
+ `speed="fast"` (CLI `--fast`) turns on the provider's fast mode for the editing LLM: same model, faster output, higher price. See [providers](docs/providers.md#fast-mode).
81
144
 
82
145
  ## Probes
83
146
 
@@ -139,10 +202,23 @@ weightspace fix model.safetensors "..." --llm anthropic:claude-sonnet-4-5 --save
139
202
 
140
203
  The system prompt tells the LLM not to train, fit weights to data, or run the network inside the sandbox; the only way to run it is the budgeted probes. The sandbox never holds the model object, but it is not a security boundary: code runs in your process, and an LLM could still multiply matrices by hand. Check transcripts if the rules matter for your experiment, as the paper's authors did.
141
204
 
142
- ## Development
205
+ ## Contributing
206
+
207
+ Issues and PRs are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for setup and conventions, [SECURITY.md](SECURITY.md) to report vulnerabilities, and [CHANGELOG.md](CHANGELOG.md) for releases.
143
208
 
144
209
  ```bash
145
210
  pip install -e ".[all,dev]"
146
- pytest
147
- ruff check . && ruff format --check .
211
+ pytest && ruff check . && mypy src/weightspace
148
212
  ```
213
+
214
+ ## Citation
215
+
216
+ If you use weightspace in research, cite the original paper and this repository ([CITATION.cff](CITATION.cff)).
217
+
218
+ ## License
219
+
220
+ Apache 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
221
+
222
+ ---
223
+
224
+ <p align="center">Marciano Theory SI</p>