TwinSoc: the twin's soc face (imperfect response, drifting truth) - #23
Merged
Merged
Conversation
…(cycle 1)
TwinSoc <: AbstractSoc wrapping a DigitalTwin, in the Piccolo extension
alongside MockSoc. execute! translates through the same envelope path the
mock runs, acquires rebuild the QuantumSystem from the twin's CURRENT truth
via the record's family field (families kwarg — dispatch, not registry), and
the response runs the record's readout confusion (unwrapped from the vault
{value, estimate, note} form, rows = true states, q = Cᵀ p) with binomial
shot sampling seeded from the twin's own rng (one draw per shot). IQ blobs
packed exactly the way MockSoc packs them. Toy family record fixture
(test/fixtures/twins/toy.md) + the family-seam testitem (#20).
The constructor's seams are guarded and tested: family dispatch names the
record's family and the known builders; the confusion is unwrapped from the
vault {value, estimate, note} wrapper with squareness, non-negativity, and
row-stochasticity validated (rows = true states); shots ≥ 1, dt ≥ 0; and a
measurement dimension that disagrees with the record's confusion errors at
respond time, naming the family (#20).
…le 3) Seeded statistical pin: 40 acquires × 512 shots against the golden pulse. Every blob is exactly counts/shots (dyadic multiples of 1/512, summing to 1); the empirical mean centers on the exact confusion-remap response within 4σ/√K; the deviation scale matches binomial(512, q) at rtol 0.25; every seeded blob deviates from the exact response and stays within 5σ. The exact center q comes from the pre-implementation direct-rollout capture (#20).
…(cycle 4) Each acquire measures the truth as it stands, then ages the twin by dt (advance-after): acquire k measures truth at twin-time (k-1)·dt, so the FIRST acquire sees the record's pristine truth and each subsequent acquire sees truth one dt further along. dt = 0 (the default) skips the advance entirely — no drift draws consumed, no scheduled jumps fired. Pinned: the Ramp ladder's two acquires against the same pulse equal the captured direct-rollout blobs at ω=1.0 and ω=1.1 (== exact), truth moves while belief never does, and a JumpSchedule at t=0 with dt=0 never fires (#20).
…e 5) With drift off and exact response, TwinSoc's forward model equals a direct QuantumSystem rollout through the same measurement function, pinned == with no tolerance three ways: (a) the pre-implementation golden capture from the direct rollout + the record's confusion; (b) the direct forward model recomputed in-test from public pieces (same translation, played-pulse reconstruction, rollout, measurement fn, confusion expression); (c) the degenerate-twin relationship demonstrated — the direct rollout's raw populations are bit-exact MockSoc's existing golden blobs on this very pulse and system, so TwinSoc with identity confusion and dt=0 would BE the mock; the confusion is the only difference. MockSoc itself untouched (#20).
…ks (cycle 6) The full stochastic path (OU drift ON, dt=1, 64 shots, two knots, six acquires) is pinned three ways: same seed → identical sequences across fresh process objects; different seed → different sequences; and the implemented rng-draw order is golden-pinned == (per acquire: shot uniforms — knots in order, shots in order — then the drift draws in plan order; the twin's ONE StableRNG drives both). :TwinSoc joins the config check's Piccolo-extension type list — base mode asserts it absent from the base surface, piccolo mode asserts it reachable — and test/configurations/twinsoc_replay_check.jl runs the fixed seeded sequence in a FRESH PROCESS for the byte-identical cross-process check (two invocations, diff empty — verified). src/ unchanged on this branch (#20).
…approx (1e-13) This branch carries BOTH the TwinSoc feature (#20) and the golden-stability repair for S1-landed code — MockSoc's golden literal is main-fragile on rotated ubuntu-latest runners until this lands on main; correct scope per the director. Causal record (from CI logs): PR #19's green run 33320865313 and PR #23's red run 33344813818 ran the SAME Julia 1.12.7, same resolution (DataInterpolations 8.10.0, Piccolo 2.0.2, SciMLBase 3.34.0, StaticArrays 1.9.19), same golden code — different outcome nine hours apart. The remaining variable is runner hardware rotation in the ubuntu-latest pool (Xeon/EPYC families; Julia multi-microarch cloning + OpenBLAS kernel selection exercise different vectorized paths per CPU; FMA-fusion moves last ulps). A julia-version pin is therefore proven useless — the tolerance treatment is the only robust answer to the class. The fix: the six captured-value literal comparisons (MockSoc golden; the TwinSoc equivalence golden literal + its pops-to-MockSoc-golden literals; the drift test's two captured blobs) carry isapprox(rtol=1e-13, atol=1e-15) — ~200x above the largest observed ulp delta (5.1e-16 rel, run 33344813818), ~4 orders below any semantic forward-model change (>=1e-9) — with the provenance recorded at each site. Within-process comparisons all stay ==: the in-test direct mirror (CI proved it box-immune on the failing run), every replay/determinism pin, and the static/drift identity pins. No CI.yml change, no deletions, no skips. Verified: suite green on Julia 1.12.5 (349/349) AND 1.12.7 (349/349); base-only config check HOLDS (#20, S1 repair).
aarontrowbridge
marked this pull request as ready for review
August 31, 2026 01:41
This was referenced Aug 31, 2026
aarontrowbridge
referenced
this pull request
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #20
The twin has a face: TwinSoc wraps a DigitalTwin behind the soc verbs — translate, roll the CURRENT-truth system, respond with the record readout-confusion remap plus binomial shot sampling, and drift between acquires (advance-after, dt default static).
Verification (director-run): full suite 349/349; base-only HOLDS 204; fresh-process replay byte-identical (sha256 cddd8faa); tree clean, six TDD-cycle commits.