neurarch 0.2.0 → 0.3.0

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.
@@ -0,0 +1,44 @@
1
+ # yaml-language-server: $schema=https://neurarch.com/schema/neurarch-policy-v1.json
2
+ #
3
+ # A repository policy for the neurarch pre-checks. Copy to the repo root.
4
+ # Full reference: README.md, "A policy the repo checks in".
5
+ version: 1
6
+
7
+ # Presets first, in order; this file wins. neurarch>strict promotes borderline
8
+ # memory and expired waivers to blocks; neurarch>advisory blocks nothing.
9
+ extends:
10
+ - neurarch>recommended
11
+ # - github>your-org/neurarch-policy#v1 # an org preset: default.yml at the tag
12
+ # - local>policies/training.yml # a file in this repo
13
+
14
+ defaults:
15
+ gpu: h100 # the card a check assumes when the command names none
16
+ cards: [h100, a100-80g] # the fleet a fit is judged against
17
+ headroom: 1.15 # multiplier on a predicted peak
18
+ seq_len: 4096 # tokens per sample when the command names none
19
+
20
+ budget:
21
+ max_params: 70B
22
+ max_cost_per_run_usd: 2000
23
+ cards_allowed: [h100, a100]
24
+
25
+ engines: [vllm, sglang]
26
+
27
+ rules:
28
+ layout/pipeline-bubble: block # off | info | warn | block
29
+ serve/rope-static: off
30
+ "memory/*": block # a wildcard re-levels warnings and blocks, never info notes
31
+
32
+ waivers:
33
+ - rule: layout/stage-imbalance
34
+ path: "recipes/qwen3/**"
35
+ owner: "@li"
36
+ reason: "LM head stage measured at 1.17x on our cluster; rebalance lands with the v2 recipe"
37
+ created: 2026-10-14
38
+ expires: 2026-12-15
39
+ - rule: serve/context-over-derived
40
+ model: "Qwen/*"
41
+ cluster: "staging-*"
42
+ owner: "@ana"
43
+ reason: "YaRN x4 validated to 131k on our eval set"
44
+ # no created: the git blame date of this entry. No expires: created + 30 days.
@@ -0,0 +1,69 @@
1
+ # .github/workflows/neurarch-attest.yml
2
+ #
3
+ # Runs a pre-check and publishes its record as a signed attestation, so anyone
4
+ # holding the model's files can later ask GitHub which pre-check ran on them,
5
+ # with which tool and tables, and what it concluded:
6
+ #
7
+ # gh attestation verify Qwen3-8B/config.json -R <owner>/<repo> \
8
+ # --predicate-type https://in-toto.io/attestation/test-result/v0.1
9
+ #
10
+ # The record is an in-toto Statement v1 with in-toto's test-result predicate
11
+ # (PASSED / WARNED / FAILED plus the rule lists); the Neurarch detail rides in
12
+ # the predicate's `neurarchPrecheck` field, described by
13
+ # https://neurarch.com/schema/precheck-attestation-v1.json. Its subjects are
14
+ # the model's files, hashed and named the way OpenSSF model-transparency
15
+ # (`model_signing`) hashes and names them, and the first subject is the same
16
+ # root digest `model_signing sign` signs. A model signature and this record
17
+ # therefore point at the same bytes.
18
+ #
19
+ # actions/attest builds its own statement, so the step below hands it our
20
+ # subjects (as a checksums file) and our predicate (as a file); nothing is
21
+ # re-derived. Attestations on a private repo need GitHub Enterprise Cloud;
22
+ # public repos work on any plan.
23
+ name: neurarch signed pre-check
24
+ on:
25
+ push:
26
+ branches: [main]
27
+ pull_request:
28
+
29
+ permissions:
30
+ contents: read
31
+ id-token: write # Sigstore signs with the job's OIDC identity
32
+ attestations: write # store the attestation on this repository
33
+
34
+ jobs:
35
+ precheck:
36
+ runs-on: ubuntu-latest
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+ - uses: actions/setup-node@v4
40
+ with:
41
+ node-version: 22
42
+ - name: Serving pre-check, recorded
43
+ # A failed check still writes its record (result FAILED) and fails the
44
+ # job afterwards; the record of a refusal is evidence too.
45
+ run: |
46
+ npx --yes neurarch serve-check Qwen/Qwen3-8B --gpu l4 --gpus 4 \
47
+ --attest precheck.intoto.json --cyclonedx precheck.cdx.json \
48
+ --attest-url "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
49
+ -- vllm serve Qwen/Qwen3-8B -tp 4 --max-model-len 32768
50
+ # With the checkpoint on the runner, hash the files you will deploy
51
+ # instead of reading the Hub: add `--model-dir ./Qwen3-8B`.
52
+ - name: Split the record for actions/attest
53
+ if: ${{ !cancelled() && hashFiles('precheck.intoto.json') != '' }}
54
+ run: |
55
+ jq '.predicate' precheck.intoto.json > precheck.predicate.json
56
+ jq -r '.subject[] | "\(.digest.sha256) \(.name)"' precheck.intoto.json > precheck.subjects.txt
57
+ - uses: actions/attest@v4
58
+ if: ${{ !cancelled() && hashFiles('precheck.intoto.json') != '' }}
59
+ with:
60
+ subject-checksums: precheck.subjects.txt
61
+ predicate-type: https://in-toto.io/attestation/test-result/v0.1
62
+ predicate-path: precheck.predicate.json
63
+ - uses: actions/upload-artifact@v4
64
+ if: ${{ !cancelled() && hashFiles('precheck.intoto.json') != '' }}
65
+ with:
66
+ name: neurarch-precheck
67
+ path: |
68
+ precheck.intoto.json
69
+ precheck.cdx.json
@@ -0,0 +1,40 @@
1
+ # .github/workflows/neurarch-precheck.yml
2
+ #
3
+ # Runs the pre-checks on every pull request under the repo's .neurarch.yml and
4
+ # uploads SARIF, so a finding shows as a code scanning alert on the line the
5
+ # pull request changed. Code scanning needs a public repo, or GitHub Code
6
+ # Security on a private one.
7
+ name: neurarch pre-check
8
+ on: pull_request
9
+
10
+ permissions:
11
+ contents: read
12
+ security-events: write # upload-sarif
13
+
14
+ jobs:
15
+ precheck:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0 # git blame dates waivers; the diff anchors results
21
+ - uses: actions/setup-node@v4
22
+ with:
23
+ node-version: 22
24
+ - name: Changed lines
25
+ run: git diff -U0 "origin/${{ github.base_ref }}...HEAD" > changes.diff
26
+ - name: Layout pre-check
27
+ run: |
28
+ mkdir -p sarif
29
+ npx --yes neurarch layout Qwen/Qwen3-8B --tp 4 --pp 4 --dp 8 --micro 1 --global-batch 512 \
30
+ --source recipes/qwen3/train.sh --changed-lines changes.diff --sarif sarif/layout.sarif
31
+ - name: Serving pre-check
32
+ if: always()
33
+ run: |
34
+ npx --yes neurarch serve-check Qwen/Qwen3-8B --gpu l4 --gpus 4 \
35
+ --source deploy/serve.sh --changed-lines changes.diff --sarif sarif/serve.sarif \
36
+ --cmd "$(grep -h '^vllm serve' deploy/serve.sh)"
37
+ - uses: github/codeql-action/upload-sarif@v3
38
+ if: always() # upload even when a check failed the job
39
+ with:
40
+ sarif_file: sarif # a directory: one file per check, one category each
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neurarch",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "The pre-check for an open-weight model change, before it takes a GPU or traffic: training peak memory, the smallest card that holds it and what a run costs, whether a parallel layout is legal and balanced (`neurarch layout`), whether a serving launch will start (`neurarch serve-check`), and whether the data fits the config, all read from a Hugging Face config or a traced graph. `neurarch rightsize jobs.csv` puts each past job's request next to what it needed.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -16,9 +16,12 @@
16
16
  "files": [
17
17
  "bin",
18
18
  "engine.bundle.mjs",
19
+ "policy.bundle.mjs",
20
+ "attest.bundle.mjs",
19
21
  "examples",
20
22
  "README.md",
21
- "LICENSE"
23
+ "LICENSE",
24
+ "NOTICE"
22
25
  ],
23
26
  "engines": {
24
27
  "node": ">=18"