astro-weights
Small course corrections for open LLMs.
Agent-driven weight-space edits, exported as standard LoRA adapters.
Docs · PyPI · Changelog · Contributing
The goal: an agent proposes small, targeted low-rank edits to a model's weights, and the ones that hold up under paired tests are saved as plain PEFT LoRA adapters. Today (0.1.0) the library covers the edit core (build low-rank edits, save and load them as LoRA adapters, apply them to transformers models), difference-of-means directions with a split-half gate, and paired eval statistics. LoRA is the output format because every serving stack already loads it (transformers, PEFT, vLLM, llama.cpp and the rest), so an edit needs no custom runtime: ship the adapter, load it like any other, and drop it to get the base model back.
Status: pre-alpha. 0.0.9 is on PyPI. The API will change without notice until 1.0.
Install
pip install astro-weights
To apply edits to transformers models, add the hf extra (pulls in torch, transformers and peft):
pip install "astro-weights[hf]"
Quick look
Build a rank-1 edit with numpy and save it as a LoRA adapter:
import numpy as np
from astro_weights.edits import Edit, masked_rank1
from astro_weights.export import save_peft
W0 = np.random.default_rng(0).standard_normal((16, 48), dtype=np.float32)
u = np.eye(16, dtype=np.float32)[0]
mask = np.ones(48, dtype=np.float32)
delta = masked_rank1("model.layers.1.mlp.down_proj", W0, u, mask, alpha=0.5)
save_peft(Edit(deltas=(delta,), base_model="org/name"), "my-edit")
Summarize and verify the saved adapter:
astro-weights inspect my-edit
Apply it to a transformers model (hf extra), and remove it again:
from astro_weights.export import load_peft
from astro_weights.runners.hf import apply, remove
peft_model = apply(model, load_peft("my-edit")) # model: a transformers causal LM
model = remove(peft_model) # base weights were never modified
apply also finds layers named differently, as in text-only and multimodal loads of one checkpoint: see How-to: apply across model classes.
Development
git clone https://github.com/astro-weights/astro-weights
cd astro-weights
uv sync
uv run pytest
See CONTRIBUTING.md for the full set of checks and how to send a pull request.
Citation
If you use astro-weights in your work, please cite it. The metadata is in CITATION.cff; on GitHub, use Cite this repository in the sidebar.
License
The logo is based on the Noto Emoji "person astronaut" glyph, Copyright Google LLC, Apache-2.0. See docs/assets/LOGO-LICENSE.md.
Metadata
Release files for astro-weights 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| astro_weights-0.1.0.tar.gz | 50.9 kB | With provenance | Details for astro_weights-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| astro_weights-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for astro_weights-0.1.0-py3-none-any.whl |
Total release size: 110.9 kB
Release files / astro_weights-0.1.0.tar.gz
| Download URL | astro_weights-0.1.0.tar.gz |
|---|---|
| Size | 50.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9f4c1bc103624f42c8a782771e4ff439fea4f3a8e28eced1eebf38eb599ff79
|
|
BLAKE2b-256 checksum How to use checksums |
4d63ab8b9a86083e15ca4c41047920be5736d0db8a0db5baf5d9e2bbf3f8e88a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logRelease files / astro_weights-0.1.0-py3-none-any.whl
| Download URL | astro_weights-0.1.0-py3-none-any.whl |
|---|---|
| Size | 60.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ebe080c7986dd91cc42d1ef51024b25cadbc871f48d5e67e2cd7e4f184895a09
|
|
BLAKE2b-256 checksum How to use checksums |
3c5a7ab3cc3816669d0c125ad3f3ffc2a9c685df18feca0c264b930a4ad5b79f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logSecurity for astro-weights 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for astro_weights-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.