Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
784 changes: 784 additions & 0 deletions tracks/qmc/solutions/frustration-free/challenge-15/DESIGN.md

Large diffs are not rendered by default.

1,000 changes: 1,000 additions & 0 deletions tracks/qmc/solutions/frustration-free/challenge-15/PLAN.md

Large diffs are not rendered by default.

1,390 changes: 1,390 additions & 0 deletions tracks/qmc/solutions/frustration-free/challenge-15/PRODUCTION_DESIGN.md

Large diffs are not rendered by default.

2,960 changes: 2,960 additions & 0 deletions tracks/qmc/solutions/frustration-free/challenge-15/PRODUCTION_PLAN.md

Large diffs are not rendered by default.

162 changes: 162 additions & 0 deletions tracks/qmc/solutions/frustration-free/challenge-15/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Challenge 15: finite-sphere projected-Pfaffian core

This package implements the auditable core calculation for the finite-size
lowest-`L=2` sector gap at Laughlin filling `ν=1/3`. It uses one
sector-conditioned projected-Pfaffian parameter tree for `L=0` and `L=2`.

## Environment

The supported interpreter is CPython 3.12. From this directory:

```bash
uv sync
uv run python -c \
"import jax; print(jax.default_backend(), jax.config.x64_enabled)"
uv run pytest -q
```

`jax.config.x64_enabled` must be `True`. CPU execution is supported. A GPU run
requires a matching CUDA-enabled `jaxlib`; the runtime provenance in every
artifact records the backend and x64 state.

## Commands and restart

All subcommands accept `--config PATH` with a JSON object. Command-line values
override the corresponding JSON fields. The canonical JSON SHA256 is stored in
each artifact.

```bash
uv run python -m challenge15.cli oracle \
--particles 6 \
--output ../../../results/frustration-free/challenge-15/oracle-n6

uv run python -m challenge15.cli train \
--particles 6 --ranks 1,2,4 --seeds 0,1,2,3,4 --steps 100 \
--output ../../../results/frustration-free/challenge-15/n6

uv run python -m challenge15.cli train \
--config n6.json --output ../../../results/frustration-free/challenge-15/n6 \
--resume

uv run python -m challenge15.cli evaluate \
--checkpoint ../../../results/frustration-free/challenge-15/n6/checkpoint.json \
--oracle ../../../results/frustration-free/challenge-15/oracle-n6/result.json \
--output ../../../results/frustration-free/challenge-15/n6

uv run python -m challenge15.cli verify \
--artifact ../../../results/frustration-free/challenge-15/n6/evaluation.json

uv run python -m challenge15.cli report \
--evaluation ../../../results/frustration-free/challenge-15/n6/evaluation.json \
--output ../../../results/frustration-free/challenge-15/n6

uv run python -m challenge15.cli manifest \
--n6 ../../../results/frustration-free/challenge-15/n6/evaluation.json \
--n7 ../../../results/frustration-free/challenge-15/n7/evaluation.json \
--n8 ../../../results/frustration-free/challenge-15/n8/evaluation.json \
--output ../../../results/frustration-free/challenge-15/final
```

Training publishes a verified atomic checkpoint after each rank/seed. A resume
is rejected unless its complete canonical configuration hash matches. Each
checkpoint includes the shared parameters, Adam state, every PRNG split,
paired-batch hashes, optimizer diagnostics, source hashes, Git revision,
runtime versions, and input hashes. Unique sibling partials are file-fsynced,
verified, atomically replaced, and followed by parent-directory fsync.
Every load recomputes the training-configuration digest, record coverage,
serialized-state hashes, completed identities, and rank-parent lineage.
It also recomputes the execution fingerprint over all package sources,
`pyproject.toml`, `uv.lock`, Python, JAX, jaxlib, Flax, Optax, NumPy, SciPy,
SymPy, and h5py versions, x64, backend, platform, and schema policy. Stale code
or runtime artifacts fail closed.

## Physical and numerical conventions

- `2Q = 3(N-1)`, with north-chart holomorphic monopole spinors.
- Orbital order follows increasing `2m`; determinant order follows increasing
integer bit patterns with ascending creation operators.
- Distances are physical sphere chords
`r_ij = 2 sqrt(Q) l_B sin(gamma_ij/2)`.
- Energies are in `E_C = e²/(4π ε₀ ε l_B)`.
- The reported gap is `Δ₂ = E(L=2)-E(L=0)`, not necessarily the absolute
lowest neutral excitation.
- The sparse M=0 low-energy scan separately reports the absolute excitation
energy and its integer `L`; it resolves energy-degenerate subspaces with
`L²` and fails closed on ambiguous classification.
- One parameter tree is optimized with `w₀E₀+w₂E₂` on paired sector batches.
There are no private sector models.

For `N≤8`, exact coefficient-space evaluation reports energy, overlap, true
projected-Hamiltonian variance `Var(H_LLL)`, exact angular-momentum residuals,
quadrature changes, and projected carrier-span singular values. Coordinate VMC
reports a bare Coulomb potential estimator and its sampling variance. That
sampling variance is never labeled as `Var(H_LLL)`.

## Fail-closed gates

Ranks are nested as `1,2,4,...`. Two consecutive doublings must each satisfy

```text
|delta E_L| + 2 sigma_diff <= 1e-4 E_C
|delta Delta_2| + 2 sigma_diff <= 0.002 Delta_2
```

Exact rank analysis requires identical seed sets at every adjacent rank and
uses `sigma_diff=0` by contract. Stochastic analysis is separate: it requires
at least two identically paired seeds and computes uncertainty from paired
differences, retaining covariance. Missing pairs fail closed rather than
returning zero uncertainty. Increased noise makes the left-hand side larger
and can never relax a gate. Where exact overlaps exist, their change must be at
most `1e-3`. These tolerances, two required doublings, and the minimum four of
five seed gate are immutable. Any missing `(rank, seed)`, failed numerical
gate, or unavailable gate leaves the system explicitly pending.

Smoke optimization uses generated coordinate batches, not an accept/reject
sampler. Its acceptance-rate fields are therefore JSON `null`; step energies,
norms, and gradient norms are explicitly labeled as pre-update diagnostics.

The production target-sector solver uses a basis-invariant thin `D×r`
canonicalization with lexicographic row pivots and only `r×r` gauge matrices;
it never forms a `D×D` projector. Its immutable symmetry gates are a Gram
defect at most `1e-12`, an `L²` target residual at most `1e-11`, and a
reconstructed generator/ladder intertwining residual at most `1e-11`. All
three diagnostics, pivots, and the linear-storage bound are persisted and
recomputed when an oracle cache is restored.

Production proceeds in order `N=6`, then `N=7`, then `N=8`; a later size is not
accepted without a hash- and provenance-bound accepted artifact for the prior
size. The final manifest remains pending unless all three semantic evaluations
validate. Full determinant-space dimensions
are 8,008, 50,388, and 319,770 respectively. Exact construction, sector
diagonalization, repeated projected-carrier expansion, and doubled quadrature
dominate memory and wall time. Carrier rank, determinant block size, and
quadrature order must be reported with peak RSS and elapsed time.

**N=6-8 production acceptance is pending.** Passing every immutable numerical,
statistical, provenance, and cross-size gate would establish the finite-size
lowest-L=2 sector gap. It is not a chiral-graviton claim; that requires the
separate metric-response acceptance plan.

## Audited production controllers

The sole operator entry point is `challenge15 production-orchestrate-size`.
Low-level Slurm, transfer, deployment, and scientific commands are internal
create-only state-machine contracts.

- Qdeshell uses `dzagnormal`, account `giggleliu`, QOS
`user_jiangweiqi`, and one A800 80 GB GPU per five-way seed array task.
The approved result root is
`/work/share/giggleliu/jiangweiqi/results/challenge15`.
- LASG02 uses `ihicnormal`, account `chenkun2025`, QOS
`user_student090`, 24 CPUs, and 80000 MiB. The approved result root is
`/public/home/student090/results/challenge15`.
- WUZH02 remains inactive. `discover_wuzh02.py` fails closed unless complete,
explicitly labelled scheduler, capacity, Python 3.12, project-root, and
result-root evidence is supplied.
- `xh5-jiangweiqi` is only a documented fallback (account `giggleliu`, QOS
`user_jiangweiqi`; available GPU families include 3090, 3080, and V100).
No production controller role or exact partition profile is approved by the
immutable design, so the orchestrator does not submit there.

Remote `sbatch --test-only`, final deployment receipts, runtime attestations,
and scientific jobs are deferred until the final clean source freeze.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"payload":{"burn_in_sweeps":2000,"chains_per_sector":32,"checkpoint_interval_steps":100,"draws_per_update":16,"final_evaluation_burn_in_sweeps":5000,"final_evaluation_chains_per_sector":32,"final_evaluation_draws_per_chain":4096,"final_evaluation_thinning_sweeps":4,"learning_rate":0.001,"optimizer":"adam","pilot_sweeps":500,"reequilibration_sweeps_after_update":4,"refresh_log_amplitudes_after_update":true,"schedule_version":"fixed-v1","steps":10000,"thinning_sweeps":2,"walkers_per_chain":32,"weight_l0":0.5,"weight_l2":0.5},"payload_sha256":"361a7820ae48588f1b7cdbd65f73474aa23a891a7bfddd727178f655ce38043f","schema":"challenge15.production-vmc-config.v1"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"payload":{"burn_in_sweeps":2000,"chains_per_sector":32,"checkpoint_interval_steps":100,"draws_per_update":16,"final_evaluation_burn_in_sweeps":5000,"final_evaluation_chains_per_sector":32,"final_evaluation_draws_per_chain":4096,"final_evaluation_thinning_sweeps":4,"learning_rate":0.001,"optimizer":"adam","pilot_sweeps":500,"reequilibration_sweeps_after_update":4,"refresh_log_amplitudes_after_update":true,"schedule_version":"fixed-v1","steps":10000,"thinning_sweeps":2,"walkers_per_chain":32,"weight_l0":0.5,"weight_l2":0.5},"payload_sha256":"361a7820ae48588f1b7cdbd65f73474aa23a891a7bfddd727178f655ce38043f","schema":"challenge15.production-vmc-config.v1"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"payload":{"burn_in_sweeps":2000,"chains_per_sector":32,"checkpoint_interval_steps":100,"draws_per_update":16,"final_evaluation_burn_in_sweeps":5000,"final_evaluation_chains_per_sector":32,"final_evaluation_draws_per_chain":4096,"final_evaluation_thinning_sweeps":4,"learning_rate":0.001,"optimizer":"adam","pilot_sweeps":500,"reequilibration_sweeps_after_update":4,"refresh_log_amplitudes_after_update":true,"schedule_version":"fixed-v1","steps":10000,"thinning_sweeps":2,"walkers_per_chain":32,"weight_l0":0.5,"weight_l2":0.5},"payload_sha256":"361a7820ae48588f1b7cdbd65f73474aa23a891a7bfddd727178f655ce38043f","schema":"challenge15.production-vmc-config.v1"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"payload":{"burn_in_sweeps":2000,"chains_per_sector":32,"checkpoint_interval_steps":100,"draws_per_update":16,"final_evaluation_burn_in_sweeps":5000,"final_evaluation_chains_per_sector":32,"final_evaluation_draws_per_chain":4096,"final_evaluation_thinning_sweeps":4,"learning_rate":0.001,"optimizer":"adam","pilot_sweeps":500,"reequilibration_sweeps_after_update":4,"refresh_log_amplitudes_after_update":true,"schedule_version":"fixed-v1","steps":10000,"thinning_sweeps":2,"walkers_per_chain":32,"weight_l0":0.5,"weight_l2":0.5},"payload_sha256":"361a7820ae48588f1b7cdbd65f73474aa23a891a7bfddd727178f655ce38043f","schema":"challenge15.production-vmc-config.v1"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
[[ "$#" == 2 && "$1" == "--output-dir" ]] || { printf '%s\n' "usage: build_source_bundle.sh --output-dir PATH" >&2; exit 2; }
ROOT="$(cd -- "$(dirname -- "$0")/../.." && pwd -P)"
OUT="$2"
[[ "$OUT" = /* && ! -e "$OUT" ]] || { printf '%s\n' "output must be a new absolute path" >&2; exit 2; }
mkdir -m 700 -- "$OUT"
(cd "$ROOT" && {
printf '%s\n' src production pyproject.toml uv.lock |
LC_ALL=C sort > "$OUT/MEMBERS"
tar --sort=name --mtime='UTC 1970-01-01' --owner=0 --group=0 --numeric-owner \
-cf "$OUT/source.tar" src production pyproject.toml uv.lock
})
sha256sum -- "$OUT/source.tar" "$OUT/MEMBERS" | LC_ALL=C sort -k2 > "$OUT/SHA256SUMS"
sync -f "$OUT/SHA256SUMS"
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/usr/bin/env bash
set -euo pipefail
die() { printf '%s\n' "$*" >&2; exit 2; }
BUNDLE_ROOT= BUNDLE_SHA256= WHEELHOUSE= REQUIREMENTS= DESTINATION_ROOT= DRY_RUN_RECEIPT= OUTPUT_DIR= PROFILE=
while (($#)); do
case "$1" in
--bundle-root|--bundle) BUNDLE_ROOT="$2"; shift 2 ;;
--bundle-sha256) BUNDLE_SHA256="$2"; shift 2 ;;
--wheelhouse) WHEELHOUSE="$2"; shift 2 ;;
--requirements) REQUIREMENTS="$2"; shift 2 ;;
--destination-root) DESTINATION_ROOT="$2"; shift 2 ;;
--dry-run-receipt) DRY_RUN_RECEIPT="$2"; shift 2 ;;
--output-dir) OUTPUT_DIR="$2"; shift 2 ;;
--profile) PROFILE="$2"; shift 2 ;;
*) die "unexpected argument: $1" ;;
esac
done
for value in BUNDLE_ROOT BUNDLE_SHA256 WHEELHOUSE REQUIREMENTS DESTINATION_ROOT DRY_RUN_RECEIPT OUTPUT_DIR PROFILE; do
[[ "${!value:-}" ]] || die "missing deployment argument: $value"
done
[[ -d "$BUNDLE_ROOT" && ! -L "$BUNDLE_ROOT" ]] || die "bundle root must be a regular directory"
COMPUTED_BUNDLE_SHA="$(
cd "$BUNDLE_ROOT"; shopt -s globstar nullglob; files=()
for member in **/*; do [[ -f "$member" && ! -L "$member" ]] && files+=("$member"); done
printf '%s\0' "${files[@]}" | sort -z | xargs -0 sha256sum -- |
sha256sum | awk '{print $1}'
)"
[[ "$COMPUTED_BUNDLE_SHA" == "$BUNDLE_SHA256" ]] ||
die "bundle SHA256 mismatch"
(cd -- "$BUNDLE_ROOT" && sha256sum -c -- SHA256SUMS)
PROFILE_SHA="$(jq -er '.payload_sha256' "$PROFILE")"
[[ "$PROFILE_SHA" == "$(jq -er '.payload.profile_sha256' "$DRY_RUN_RECEIPT")" ]] ||
die "dry-run profile mismatch"
APPROVED_ROOT="$(jq -er '.payload.approved_project_root' "$PROFILE")"
[[ "$DESTINATION_ROOT" == "$APPROVED_ROOT" ]] ||
die "deployment root is not profile-bound"
[[ "$DESTINATION_ROOT" == "$(jq -er '.payload.destination' "$DRY_RUN_RECEIPT")" ]] ||
die "dry-run destination mismatch"
[[ "$BUNDLE_SHA256" == "$(jq -er '.payload.bundle_sha256' "$DRY_RUN_RECEIPT")" ]] ||
die "dry-run bundle mismatch"
jq -e '.payload.scheduler_test | length > 0 and
all(.[]; .argv[0:2] == ["sbatch","--test-only"] and
(.script_sha256 | test("^[0-9a-f]{64}$")))' "$DRY_RUN_RECEIPT" >/dev/null ||
die "dry-run scheduler test evidence mismatch"
DRY_INTERPRETER="$(jq -er '.payload.interpreter' "$DRY_RUN_RECEIPT")"
[[ -x "$DRY_INTERPRETER" &&
"$(sha256sum -- "$DRY_INTERPRETER" | awk '{print $1}')" == "$(jq -er '.payload.interpreter_sha256' "$DRY_RUN_RECEIPT")" ]] ||
die "dry-run interpreter tuple is stale"
FINAL="$DESTINATION_ROOT/$BUNDLE_SHA256"
RECEIPT="$OUTPUT_DIR/$BUNDLE_SHA256.json"
validate_existing() {
[[ -d "$FINAL" && ! -L "$FINAL" && -x "$FINAL/venv/bin/python" ]] ||
die "existing deployment is incomplete"
[[ "$(jq -er '.payload.bundle_sha256' "$RECEIPT")" == "$BUNDLE_SHA256" &&
"$(jq -er '.payload.profile_sha256' "$RECEIPT")" == "$PROFILE_SHA" &&
"$(jq -er '.payload.deployment_root' "$RECEIPT")" == "$FINAL" ]] ||
die "existing deployment receipt mismatch"
[[ -s "$FINAL/.deployment-sha256s" ]] ||
die "existing deployment byte manifest is missing"
(cd "$FINAL" && sha256sum -c -- .deployment-sha256s)
[[ "$(sha256sum -- "$FINAL/venv/bin/python" | awk '{print $1}')" ==
"$(jq -er '.payload.interpreter_sha256' "$RECEIPT")" ]] ||
die "existing deployment interpreter changed"
[[ "$(sha256sum -- "$FINAL"/.built-wheel/challenge15_nqs-*.whl | awk 'NR==1 {print $1}')" ==
"$(jq -er '.payload.installed_wheel_sha256' "$RECEIPT")" ]] ||
die "existing deployed wheel changed"
}
if [[ -s "$RECEIPT" ]]; then validate_existing; printf '%s\n' "$RECEIPT"; exit 0; fi
PARTIAL="$DESTINATION_ROOT/.partial.$BUNDLE_SHA256.$(cat /proc/sys/kernel/random/uuid)"
mkdir -m 700 -p -- "$DESTINATION_ROOT" "$OUTPUT_DIR"
if [[ -d "$FINAL" && ! -L "$FINAL" ]]; then
INTERPRETER="$FINAL/venv/bin/python"
[[ -x "$INTERPRETER" ]] || die "promoted deployment is incomplete"
INTERPRETER_SHA="$(sha256sum -- "$INTERPRETER" | awk '{print $1}')"
INSTALLED_WHEEL_SHA="$(sha256sum -- "$FINAL"/.built-wheel/challenge15_nqs-*.whl | awk 'NR==1 {print $1}')"
[[ -s "$FINAL/.deployment-sha256s" ]] ||
die "promoted deployment byte manifest is missing"
(cd "$FINAL" && sha256sum -c -- .deployment-sha256s)
else
mkdir -m 700 -- "$PARTIAL"
trap 'rm -rf -- "$PARTIAL"' EXIT
tar -xf "$BUNDLE_ROOT/source.tar" -C "$PARTIAL"
PYTHON312="$(command -v python3.12 || true)"
[[ "$PYTHON312" = /* ]] || die "absolute CPython 3.12 interpreter is unavailable"
"$PYTHON312" -m venv "$PARTIAL/venv"
INTERPRETER="$PARTIAL/venv/bin/python"
"$INTERPRETER" -m pip install --no-index --require-hashes --only-binary=:all: \
--find-links "$WHEELHOUSE" -r "$REQUIREMENTS"
mkdir -- "$PARTIAL/.built-wheel"
"$INTERPRETER" -m pip wheel --no-index --no-deps --no-build-isolation \
--wheel-dir "$PARTIAL/.built-wheel" "$PARTIAL"
PACKAGE_WHEELS=("$PARTIAL"/.built-wheel/challenge15_nqs-*.whl)
[[ "${#PACKAGE_WHEELS[@]}" == 1 && -f "${PACKAGE_WHEELS[0]}" ]] ||
die "deployment did not build exactly one project wheel"
"$INTERPRETER" -m pip install --no-index --no-deps "${PACKAGE_WHEELS[0]}"
INSTALLED_WHEEL_SHA="$(sha256sum -- "${PACKAGE_WHEELS[0]}" | awk '{print $1}')"
INTERPRETER_SHA="$(sha256sum -- "$INTERPRETER" | awk '{print $1}')"
(cd "$PARTIAL"; shopt -s globstar nullglob; files=()
for member in **/*; do
[[ -f "$member" && ! -L "$member" && "$member" != .deployment-sha256s ]] &&
files+=("$member")
done
printf '%s\0' "${files[@]}" | sort -z | xargs -0 sha256sum -- > .deployment-sha256s
sync -f .deployment-sha256s)
mv -T -- "$PARTIAL" "$FINAL"
sync -f "$DESTINATION_ROOT"
trap - EXIT
fi
[[ ! -e "$RECEIPT" ]] || die "deployment receipt exists"
PAYLOAD="$(jq -Scn --arg dry "$(jq -er '.payload_sha256' "$DRY_RUN_RECEIPT")" \
--arg profile "$PROFILE_SHA" --arg bundle "$BUNDLE_SHA256" --arg root "$FINAL" \
--arg interpreter "$FINAL/venv/bin/python" --arg ih "$INTERPRETER_SHA" \
--arg wheel "$INSTALLED_WHEEL_SHA" \
'{dry_run_receipt_sha256:$dry,profile_sha256:$profile,bundle_sha256:$bundle,deployment_root:$root,interpreter:$interpreter,interpreter_sha256:$ih,installed_wheel_sha256:$wheel,deployed_at_utc:(now|todateiso8601)}')"
PAYLOAD_SHA="$(printf '%s' "$PAYLOAD" | sha256sum | awk '{print $1}')"
jq -Scn --argjson payload "$PAYLOAD" --arg sha "$PAYLOAD_SHA" \
'{schema:"challenge15.deployment-receipt.v1",payload:$payload,payload_sha256:$sha}' > "$RECEIPT"
sync -f "$RECEIPT"
sync -f "$OUTPUT_DIR"
printf '%s\n' "$RECEIPT"
Loading