{
 "artifacts": [
  {
   "name": "bench_report.json",
   "url": "https://synthcore.org/code/1052/bench_report.json"
  },
  {
   "name": "experiment.py",
   "url": "https://synthcore.org/code/1052/experiment.py"
  },
  {
   "name": "ising_teacher_track.py",
   "url": "https://synthcore.org/code/1052/ising_teacher_track.py"
  },
  {
   "name": "kw_test.py",
   "url": "https://synthcore.org/code/1052/kw_test.py"
  },
  {
   "name": "report.md",
   "url": "https://synthcore.org/code/1052/report.md"
  },
  {
   "name": "report_bench_2026-09-01T232411.md",
   "url": "https://synthcore.org/code/1052/report_bench_2026-09-01T232411.md"
  },
  {
   "name": "results.json",
   "url": "https://synthcore.org/code/1052/results.json"
  },
  {
   "name": "stage2_bench.py",
   "url": "https://synthcore.org/code/1052/stage2_bench.py"
  }
 ],
 "category": "training",
 "description": "Use the exact Kac–Ward conditional sampler as an oracle teacher for a neural autoregressive distribution over planar Ising configurations. At each prefix, supervise the network with the exact next-spin probability rather than only a sampled next spin, then retain the oracle as an evaluation and active-correction mechanism for prefixes where the student is inaccurate. This converts an approximate variational sampler into a calibrated amortized approximation with an exact, independently sampled reference distribution.",
 "download_zip": "https://synthcore.org/download/1052",
 "formulas_latex": [
  "$$P(\\mathbf{s})=\\prod_{i=1}^{N}P_i(s_i\\mid\\mathbf{s}_{\u003ci}),\\qquad q_i(a\\mid x)=\\frac{Z_i(a\\mid x)}{Z_i(+1\\mid x)+Z_i(-1\\mid x)}.$$",
  "$$Z_i(a\\mid x)=\\sum_{\\mathbf{s}_{\u003ei}}e^{-\\beta E(x,a,\\mathbf{s}_{\u003ei})},\\qquad E(\\mathbf{s})=-\\sum_{\\langle i,j\\rangle}J_{ij}s_is_j.$$",
  "$$Z_G=2^{|V|}\\left(\\prod_{e\\in E}\\cosh K_e\\right)\\sqrt{\\det(I-T_G)},\\quad (T_G)_{(u\\to v),(v\\to w)}=\\tanh(K_{uv})e^{i\\theta(v\\to w,u\\to v)}.$$",
  "$$\\mathcal{L}(\\theta)=\\mathbb{E}_{x}\\left[-\\sum_{i=1}^{N}\\sum_{a=\\pm1}q_i(a\\mid x)\\log p_\\theta(a\\mid x)\\right],\\qquad \\mathcal{L}(\\theta)-\\mathcal{L}_{\\min}=\\mathbb{E}_{x,i}\\,\\mathrm{KL}\\big(q_i(\\cdot\\mid x)\\,\\|\\,p_\\theta(\\cdot\\mid x)\\big).$$"
 ],
 "id": 2721,
 "implementation": "1. Integration point: implement a binary autoregressive model, such as a masked MLP, PixelCNN-style network, or Transformer over a raster ordering of the planar lattice. Its output at position i is a logit l_i(x), giving p_theta(s_i=+1|x)=sigmoid(l_i(x)). Build a separate Kac–Ward oracle that accepts a prefix x, constructs the paper's auxiliary planar zero-field graph for the two candidate values s_i=+1 and -1, and returns log Z_i(+1|x) and log Z_i(-1|x). 2. Pseudocode: for each minibatch prefix x and position i, compute q_plus=softmax([logZ_plus,logZ_minus])[0]; obtain p_plus from the network; add -(q_plus*log(p_plus)+(1-q_plus)*log(1-p_plus)) to the loss; periodically sample the next spin from p_theta, query the oracle on the resulting student-generated prefix, and add these off-policy prefixes to a replay buffer. Use stable complex slogdet evaluations rather than explicitly forming determinants. 3. Computed from the paper: the two exact conditional partition functions, auxiliary graph construction, and Kac–Ward matrix. Estimated empirically: student conditional KL, held-out log-likelihood, energy and correlation errors, and sample autocorrelation. 4. First cheap experiment: use 4x4 and 6x6 square lattices with random Gaussian or ±1 couplings at several temperatures, and compare ordinary maximum-likelihood training, sampled-label training, and Kac–Ward soft-label distillation. Draw 10,000 exact oracle configurations for validation and independently generate 10,000 student configurations. The quantitative prediction is that oracle-generated samples have zero lag-k autocorrelation up to finite-sample error, while the distilled model's average conditional KL decreases with training and its held-out log-likelihood gap tracks the accumulated conditional-KL gap. Require mean conditional-probability error below 1e-2 on 4x4 instances before comparing observables. Also measure oracle runtime versus lattice size and test the predicted approximately O(N^{5/2}) scaling; after amortization, student generation should require O(N) sequential outputs.",
 "math_summary": "For spins $s_i\\in\\{-1,+1\\}$, couplings $J_{ij}$, inverse temperature $\\beta$, and energy $E(\\mathbf{s})=-\\sum_{\\langle i,j\\rangle}J_{ij}s_is_j$, the target distribution is $P(\\mathbf{s})=e^{-\\beta E(\\mathbf{s})}/Z$. Under an ordering of the $N$ vertices, the exact chain rule is $P(\\mathbf{s})=\\prod_{i=1}^N P_i(s_i\\mid\\mathbf{s}_{\u003ci})$. For a prefix $x=\\mathbf{s}_{\u003ci}$, define $Z_i(a\\mid x)=\\sum_{\\mathbf{s}_{\u003ei}}\\exp[-\\beta E(x,a,\\mathbf{s}_{\u003ei})]$; then the oracle label is $q_i(a\\mid x)=Z_i(a\\mid x)/(Z_i(+1\\mid x)+Z_i(-1\\mid x))$. The paper evaluates each $Z_i(a\\mid x)$ by adding auxiliary spins and edges so that the boundary fields induced by $x$ become a planar zero-field Ising model. For a zero-field planar graph $G=(V,E)$ with edge weights $K_e=\\beta J_e$, the Kac–Ward expression has the form $Z_G=2^{|V|}\\prod_{e\\in E}\\cosh(K_e)\\sqrt{\\det(I-T_G)}$, where $T_G$ is indexed by directed edges and $(T_G)_{(u\\to v),(v\\to w)}=\\tanh(K_{uv})e^{i\\theta(v\\to w,u\\to v)}$ when $w\\neq u$, with $\\theta$ the signed turning angle. The student minimizes exact conditional cross-entropy, whose excess over its optimum is the expected conditional KL divergence.",
 "math_tags": [
  "statistical-mechanics",
  "graph-theory",
  "linear-algebra",
  "probability"
 ],
 "ml_areas": [
  "optimizer",
  "training-dynamics",
  "loss",
  "sampling"
 ],
 "paper": {
  "arxiv_id": "2608.24382",
  "arxiv_url": "https://arxiv.org/abs/2608.24382",
  "summary_what_math_gives_to_ml": "The paper provides a constructive exact autoregressive factorization for planar Ising spin glasses, despite the fact that conditioning on a prefix creates boundary magnetic fields that normally invalidate zero-field Pfaffian/Kac–Ward evaluation. Its transferable asset is an exact oracle for every conditional probability, obtained by encoding the induced fields in a planarity-preserving auxiliary-spin graph and evaluating the resulting zero-field partition function through a Kac–Ward determinant. The most useful neural-network application is exact teacher distillation and calibration of autoregressive samplers: train a model against oracle conditionals, use exact likelihoods to detect exposure-bias errors, and benchmark generated samples without MCMC uncertainty. The method predicts a sharp zero-KL and zero-autocorrelation reference signature, while its computational cost provides a concrete regime where learned amortization should eventually outperform repeated exact oracle calls.",
  "title": "Exact autoregressive sampling of planar Ising spin glasses via the Kac--Ward theory",
  "year": "2026"
 },
 "ratings": {
  "difficulty": 6,
  "novelty": 7,
  "usefulness": 8
 },
 "solves": [
  "accuracy",
  "sample-efficiency",
  "generalization"
 ],
 "title": "Kac-Ward Exact Teacher for Autoregressive Samplers",
 "url": "https://synthcore.org/idea/2721/kac-ward-exact-teacher-for-autoregressive-samplers",
 "verification": {
  "benchmark": {
   "track": "planar_ising_autoregressive",
   "model": "mlp_tiny",
   "n_seeds": 8,
   "metric_direction": "lower is better",
   "comparison": {
    "baseline_mean": 0.1178522473,
    "idea_mean": 0.1157343183,
    "delta_mean": -0.002117929,
    "per_seed_diffs": [
     -0.003668502,
     -0.0034258962,
     0.0010274425,
     0.0000580251,
     -0.0068804249,
     -0.0085345805,
     -0.0007490665,
     0.00522957
    ],
    "idea_wins": 5,
    "n_pairs": 8,
    "p_value": 0.23005,
    "mde": 0.0037187363,
    "mde_rel_pct": 3.1554,
    "verdict": "no significant win",
    "system_worked": false
   },
   "baseline": {
    "best_cfg": {
     "batch": 128,
     "epochs": 5,
     "lr": 0.01
    },
    "sweep": [
     {
      "cfg": {
       "batch": 128,
       "epochs": 5,
       "lr": 0.001
      },
      "mean": 0.1614346206
     },
     {
      "cfg": {
       "batch": 128,
       "epochs": 5,
       "lr": 0.003
      },
      "mean": 0.1300708577
     },
     {
      "cfg": {
       "batch": 128,
       "epochs": 5,
       "lr": 0.01
      },
      "mean": 0.1225814894
     }
    ],
    "full": {
     "mean": 0.1178522473,
     "std": 0.0178481495,
     "per_seed": [
      0.150730595,
      0.1360894144,
      0.113548927,
      0.0899570212,
      0.1152136326,
      0.1048248708,
      0.1250655949,
      0.1073879227
     ],
     "n": 8
    }
   },
   "idea": {
    "mean": 0.1157343183,
    "std": 0.0174895135,
    "per_seed": [
     0.147062093,
     0.1326635182,
     0.1145763695,
     0.0900150463,
     0.1083332077,
     0.0962902904,
     0.1243165284,
     0.1126174927
    ],
    "n": 8
   },
   "mechanism_signature": {
    "baseline_seed0": {
     "metric": 0.150730595,
     "pred_mean": 0.462284386,
     "q_mse": 0.0357702747
    },
    "confirmed": true,
    "idea_seed0": {
     "metric": 0.147062093,
     "pred_mean": 0.457736522,
     "q_mse": 0.0323526226
    },
    "prediction": "Exact soft conditional labels reduce trained-NN conditional probability MSE versus sampled labels.",
    "q_mse_reduction": 0.0034176521
   },
   "custom_track": {
    "domain": "sequence-level sampling",
    "file": "ising_teacher_track.py",
    "name": "planar_ising_autoregressive"
   }
  },
  "mechanism_confirmed": true,
  "peer_reviewed": false,
  "practical_verdict": "inconclusive",
  "stage1_mechanism_check": {
   "worked": true,
   "confidence": 8,
   "verdict": "Built a tiny planar-Ising autoregressive distillation MVP with exact conditional probabilities by enumeration and a Kac–Ward determinant sanity check. The CE-minus-entropy equals conditional-KL identity held with absolute error below 7e-17, and the half-angle Kac–Ward formula matched enumeration to 1.9e-15 relative error on 3x3. Soft oracle supervision consistently improved conditional KL over sampled-label training, confirming the proposed mechanism in this toy setting.",
   "metrics": {
    "baseline": "Sampled-label conditional KL: 0.02115, 0.03466, 0.03366 at beta 0.2, 0.7, 1.3.",
    "idea": "Soft-oracle conditional KL: 0.0000680, 0.000333, 0.00138 at beta 0.2, 0.7, 1.3; approximately 25x–311x lower than baseline."
   },
   "how_to_run": "python3 experiment.py",
   "files": [
    "experiment.py",
    "results.json",
    "kw_test.py"
   ],
   "limitations": "The conditional oracle uses brute-force enumeration rather than the paper’s auxiliary-graph conditional Kac–Ward construction, so this is only a small-lattice MVP. It does not test 6x6 or larger instances, held-out generalization, replay-based active correction, observables, autocorrelation, or the claimed O(N^{5/2}) Kac–Ward scaling."
  },
  "status": "mech_ok_no_baseline",
  "status_label": "Mechanism confirmed, baseline not beaten",
  "updated_at": "2026-09-02T12:30:10",
  "verdict_source": "deterministic test code (paired-seed permutation statistics)",
  "verification_axes": {
   "benchmark_mechanism": {
    "confirmed": true,
    "tested": true
   },
   "practical_benchmark": {
    "beats_baseline": false,
    "tested": true,
    "verdict": "inconclusive"
   },
   "toy_mechanism_gate": {
    "confirmed": true,
    "tested": true
   }
  }
 }
}
