Skip to content

Add Watts-Strogatz small-world reservoir initializer - #574

Merged
ChrisRackauckas merged 3 commits into
SciML:masterfrom
aviralgarg05:feat/small-world-269
Nov 17, 2026
Merged

ChrisRackauckas merged 3 commits into
SciML:masterfrom
aviralgarg05:feat/small-world-269

Conversation

@aviralgarg05

Copy link
Copy Markdown
Contributor

Closes #269

This adds small_world, a Watts-Strogatz reservoir initializer with sampled connection weights, spectral-radius scaling, and the standard initializer call forms.

The implementation validates the matrix shape, neighbour count, and rewiring probability. It supports sparse output through the existing extension mechanism.

Tests cover deterministic seeded output, lattice and rewired topology properties, radius scaling, sparse output, fallback API calls, and invalid inputs.

Testing:

  • Pkg.test()
  • Runic --check on the changed files

@MartinuzziFrancesco

Copy link
Copy Markdown
Collaborator

implementation looks ok, the docstrings need to be in line with the ones of the other initializers (examples...) and then wired in here

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #574

Reviewed head: 407c672
Raw SHA-256: f7c974987984143561bbf522908af707b9865e97640cf681e5c5aa907fe70bdb
Source SHA-256: 38df635374e9ff0a93df04c22a58ca1590d022757beaaaf1c11711b48dc29529
Source: standard-review-v1 (harness-log)
Reviewer session: devin-list:relic-danger
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes

Risk assessment

  • Risk: medium-low (ML7)
  • Verdict: CHANGES
  • Reviewed head: 407c672

Review report

VERDICT: CHANGES
Round: 2
Head: 407c672
Slot: 1
CI: CI unreadable; review only; merge gates unchanged
Session: devin-list:relic-danger
Reviewer: Devin 3000.12.57; model: fusion-gpt-6-1-sol-high-sidekick-swe-2-medium

Risk

medium-low (ML7: additive, opt-in exported reservoir initializer; existing calls and defaults are unchanged. The documentation blocker is resolved, but the Float16 topology blocker remains.)

Blocking findings

  • [P2] Preserve selected connections when generating Float16 weights (src/inits/inits_reservoir.jl:180-184). The preceding round's numerical blocker remains unresolved; the delta changes documentation only. Confirmed again by running small_world(Xoshiro(56), Float16, 20, 20; num_neighbors=4, rewiring_probability=0): the result has 78 nonzeros rather than the analytically required 20 * 4 = 80, and its support is asymmetric. W[13,14] and W[15,14] are zero, whereas their reverse connections are 0.3535 and 0.7896. The probe checks the entire ring support against cyclic distance, independently of the implementation, and fails three assertions; Float32/Float64 controls pass. The weight expression 2u - 1 permits zero weights on selected edges, silently changing the promised topology. Generate nonzero weights for selected edges and add a deterministic Float16 topology regression; the current initializer tests do not cover that type for small_world. <ref_snippet file=" lines="180-184" />

  • Blocking priorities: P2

  • Deferred P2 issues: None supplied or verified in this code-only review.

Non-blocking findings

None. No additional defects found in the documentation delta.

What I ran

All commands export TMPDIR=<local path> and preserve the inherited layered JULIA_DEPOT_PATH. Here S=<local path>.

  • Inspected the supplied preceding-round review, delta since 628e5bb3537ac412a75308619c432afff6302452, whole PR diff, affected source/tests/docs, and applicable review instructions. git diff --check origin/master...HEAD exits 0. Newest-commit Agent-Harness and Agent-Model trailers are absent, so both author attribution fields are unknown.
  • julia --version: julia version 1.12.4. uv run --locked python --version: Python 3.13.13, with warning that --locked has no effect outside a project. No Julia interpreter pin, Manifest, Python project or uv.lock is tracked; scratch-only Julia manifests capture the resolved dependencies. devin list --format json identifies this session as relic-danger. Evidence: $S/interpreter-session.log.
  • Created an exact-head scratch clone using git clone --shared --no-hardlinks; retained Git metadata for Documenter's source links without making any commits. Ran GROUP=Core julia --project="$S/head" -e 'using Pkg; Pkg.instantiate(); Pkg.test()': exit 0, all nine Core files pass, totaling 1,369 assertions, including 945 initializer assertions. Evidence: $S/core-tests.log.
  • julia --project="$S/head" "$S/delta_probes.jl": exit 1, 13 assertions pass and three fail. Both new documented examples and the Float32/Float64 analytic ring controls pass; only the unresolved Float16 support checks fail. Evidence: <ref_file file=" /> and $S/delta-probes.log.
  • From $S/head, with GitHub/Documenter credentials and CI environment variables unset, ran julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()', then julia --project=docs docs/make.jl: both exit 0. Doctests, exported-docstring checks and HTML rendering complete. The new api/inits/small_world/index.html exists and contains the initializer documentation. Only HTML-size/SVG-fallback warnings occur; Documenter explicitly skips deployment. The preceding documentation blocker is resolved. Evidence: $S/docs-setup.log, $S/docs-build.log, $S/head/docs/build/.
  • Verified the scratch source, tests, documentation inputs and root project match the reviewed head. Generated manifests, assets and HTML remain in scratch. The original checkout remains clean at the requested head. All verification commands have finished; no commits, pushes or GitHub actions were performed.

What I did not verify

  • Other test groups, QA, formatting/spelling checks, GPU paths, other Julia versions/platforms or documentation deployment.
  • A project-locked Python interpreter is unavailable because this Julia repository declares none; the requested uv command is diagnostic only.
  • CI results, author execution claims, issue deferrals, PR body/comments or any earlier same-head review/rating. No author risk rating was read. Review scope remained the supplied delta and unresolved preceding-round blockers.

AUTHOR_GRADE: {"task": "feature", "score": 3, "difficulty": 3, "rounds": 2, "author_harness": "unknown", "author_model": "unknown", "note": "The documentation delta resolves the missing-export build failure: the actual docs build and Core suite pass. An independent analytic-ring probe still reproduces the preceding Float16 topology defect, with 78 connections instead of 80 and asymmetric support."}

Head link: 407c672


🤖 Posted by an AI agent — harness: Devin 3000.12.57 · model: fusion-gpt-6-1-sol-high-sidekick-swe-2-medium
Conversation: local session devin-list:relic-danger (no session URL)

Avoid zero edge weights so finite-precision sampling retains the selected graph support. Cover the regression with a deterministic Float16 ring test.
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #574

Reviewed head: 2c634eb
Raw SHA-256: 5897d97bb28b034c2f7a82a7b1d7b9b64be36369fbc4b0cae06df8dbe0ce4f06
Source SHA-256: 3cae9dd73a23e4a13ce3e62251968e78513c135f98e1d0c5a5dfde76bc6b851a
Source: standard-review-v1 (harness-log)
Reviewer session: devin-list:nimble-lightyear
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes

Risk assessment

  • Risk: medium-low (ML7)
  • Verdict: MERGE
  • Reviewed head: 2c634eb

Review report

VERDICT: MERGE
Round: 3
Head: 2c634eb
Slot: 1
CI: CI unreadable; review only; merge gates unchanged
Session: devin-list:nimble-lightyear
Reviewer: Devin 3000.12.57; model: fusion-gpt-6-1-sol-high-sidekick-swe-2-medium

Risk

medium-low (ML7: additive, opt-in exported initializer; existing calls and defaults are unchanged. The delta resolves the preceding Float16 topology blocker with a discriminating regression.)

Blocking findings

None. Confirmed by running: the preceding Float16 reproducer now has all 80 required connections and exactly matches the analytic ring support.

  • Blocking priorities: None

Non-blocking findings

None found in the delta. The zero-weight replacement at src/inits/inits_reservoir.jl:180-182 and regression at test/inits_tests.jl:91-96 address the unresolved preceding finding without weakening assertions.

What I ran

Commands export TMPDIR=<local path> and preserve the inherited layered JULIA_DEPOT_PATH. Here S=<local path>.

  • Read the supplied previous-head review, supplied delta, entire git diff origin/master...HEAD, affected source/tests/docs, and applicable instructions/risk criteria. Findings remain scoped to the delta and unresolved prior blocker. git diff --check origin/master...HEAD exits 0. Newest-commit Agent-Harness/Agent-Model trailers are absent.
  • devin list --format json identifies this session as nimble-lightyear. julia --version reports julia version 1.12.4. uv run --locked python --version reports Python 3.13.13 and warns that --locked has no effect outside a project. No Julia interpreter pin, Manifest, Python project or uv.lock is tracked.
  • Created an exact-head scratch clone. GROUP=Core julia --project="$S/head" -e 'using Pkg; Pkg.instantiate(); Pkg.test()' exits 0: all nine Core test files pass, totaling 1,371 assertions, including 947 initializer assertions. Only expected deprecation warnings appear. Evidence: $S/core-tests.log; resolved environment retained at $S/head/Manifest.toml.
  • julia --project="$S/head" "$S/delta_probes.jl" --prior --regression-only exits 1 with three failed assertions: 78 rather than 80 nonzeros, asymmetric support, and disagreement with the analytic cyclic-distance ring. This executes the actual preceding-head initializer definition, renamed only to coexist with the current method, using unchanged helpers. The saved preceding source matches git show 407c672f1d73f32dac01e578b8049051fa7560ff:src/inits/inits_reservoir.jl by SHA-256. Evidence: $S/delta-probes-before.log.
  • julia --project="$S/head" "$S/delta_probes.jl" exits 0: the same three regression assertions pass; the previously absent entries are both 0.0008183. Another 2,448 topology assertions pass across Float16/Float32/Float64, 17 seeds, zero/partial/full rewiring, and radii 0.25/1/4. Expectations use analytic ring support, fixed edge count, no self-loops and symmetric support, not recorded implementation outputs. All 39 sparse-output and Float32/Float64 preceding-head equality/RNG controls pass. Evidence: $S/delta-probes-head.log; probe source: <ref_file file=" />.
  • Verified scratch tracked source/tests/docs/project match the reviewed head and the original checkout remains clean at the requested head. All verification processes have finished. No checkout edits, commits, pushes or GitHub actions were performed.

What I did not verify

  • CI, author execution claims, issue deferrals, PR body/comments, or any earlier same-head review/rating; no author risk rating was read.
  • Other test groups, QA, formatter/spelling tools, GPU paths, other Julia versions/platforms, or documentation builds/deployment. Documentation is unchanged by this delta; the supplied previous-head review reports its earlier blocker resolved.
  • A project-locked interpreter/dependency environment is unavailable because none is committed. Julia checks use the declared project with a scratch-resolved Manifest; the requested uv command is diagnostic, not evidence of a Python project environment.

AUTHOR_GRADE: {"task": "feature", "score": 4, "difficulty": 3, "rounds": 3, "author_harness": "unknown", "author_model": "unknown", "note": "The delta resolves the preceding Float16 topology defect: the same independent analytic-ring assertions fail on the preceding initializer and pass on this head. All 1371 Core assertions and 2490 targeted probe assertions pass; existing tested Float32/Float64 results and RNG state remain unchanged."}

Head link: 2c634eb


🤖 Posted by an AI agent — harness: Devin 3000.12.57 · model: fusion-gpt-6-1-sol-high-sidekick-swe-2-medium
Conversation: local session devin-list:nimble-lightyear (no session URL)

@ChrisRackauckas
ChrisRackauckas merged commit 720ce6f into SciML:master Nov 17, 2026
57 of 59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Small world (Watts-Strogatz) initializer

4 participants