| Family | Method | Why it struggles |
|---|---|---|
| Exact inference | Expectation–Maximization | E-step exact only for special structure (e.g. HMMs) — intractable for a combinatorial state space |
| Variational | Variational inference | maximizes an ELBO bound, not the likelihood — needs a tractable posterior over combinatorial states |
| Variational autoencoders | learn artificial continuous latents — not the mechanistic state you want | |
| Search | Local search | ignores the shared model across observations |
| Reinforcement learning | Naive policy gradient | collapses to the single highest-reward state |
| GFlowNets | aim to sample in proportion to a fixed reward — not to maximize a likelihood |
Gap: none of these directly maximize over a discrete, combinatorial state space.
Key question: What actions should an agent take to maximize a reward signal?
| Concept | In RL |
|---|---|
| State | current situation |
| Action | transitions |
| Policy | picks the next action |
| Trajectory | path |
| Reward | scores terminal state |
| Objective |
Policy gradient (REINFORCE): — gradient through only, not the fixed reward .
Policy gradient (REINFORCE):
| Concept | In RL | In GReinSS |
|---|---|---|
| State | current situation | same as RL |
| Action | transitions | same as RL |
| Policy | picks the next action | same as RL |
| Trajectory | path | same, terminal |
| Reward | scores terminal state | use ??? |
| Objective |
actions extend ; we infer its terminal state
Key question: How to set rewards such that ?
Train with a policy gradient using the dynamically rescaled reward
what we optimize
how we optimize it
Theorem 1 (Unbiased policy gradient). With the dynamically changing reward , the policy gradient is an unbiased estimator of .
Example: Two measurements and . States .
Parameters:
Objective:
Fixed rewards
:
is linear in the policy ⇒ all mass on the best,
✗
Dynamic rewards
:
⇒ balances
✓
The sample → score → update cycle of RL, run with a reward that changes as learns:
Dynamic reward — the boxed denominator is re-estimated by sampling each iteration.
Repeat until convergence:
You supply only two things:
Recover binary sets from noisy real-valued measurements. Trains live in ~10 s.
Problem. , observe
if , else .
You'll write:
def log_pr_x_given_g(state, obs):
return -0.5*np.sum((obs-state)**2)/sigma**2
…then train_model_off_policy(...).
Shared structure: Each = a union of a few reusable subsets, so a shared pools across observations.
Watch for:
● true set ● noisy observation — rounding at ½ flips the ◯ circled elements.
1-hidden-layer MLP —
Linear()→ LeakyReLU →Linear()— run once per step: read the partial set, then add an element or stop.
add-logits + one stop; weights shared across steps.
Illegal (already-added) moves masked.
With a larger, dispersed state space: sampling rarely hits a terminal state explaining any , so most trajectories earn no reward and learning stalls.

Off-policy sampling: If the policy rarely samples states explaining any , learning stalls — sample where the data says to look:
Theorem 2 (Optimal off-policy proposal). The unbiased, variance-minimizing sampling proposal is :
is intractable → sample a tractable (for sets: favor element by ), then reweight by .
Exact — unbiased for the data log-likelihood gradient, for any proposal :
Set problem — pick an observation uniformly, then bias each step by its log-odds:
Batch estimate over (the denominator in is re-estimated each batch):
On-policy: . Self-normalize (divide by ) to cut variance.
Reconstruct latent directed graphs from start/end points of random walks. Pre-trained.
Problem. = directed graph (10 nodes, 90 edges); we see only the endpoints of walks. : shifted-Laplacian.
Shared structure: Each = a random thresholded subgraph of one Erdős–Rényi base graph.
Watch for:

● latent graph ● GReinSS — dashed = observed (start→end); paths never seen.
Latent sets — noisy measurements

Latent graphs — walk endpoints

| Method | Family | Max. ? |
|---|---|---|
| GReinSS | RL | |
| Naive policy gradient | RL | |
| GFlowNets | RL | |
| VAE / autoregressive / diffusion + EM | Variational + EM | ≈ |
| Local search | Search |
States

Measurements generated from

is typically large and combinatorial — graphs, strings, sets, …

Good fit ✓
Reach elsewhere ✗
Recipe: ① write a generator for · ② write · ③ train_model_off_policy ·
④ simpleInference. (optional) add an off-policy proposal for hard instances.
Code + notebook: code/README.md, tutorial/GReinSS_demo.ipynb
Recipe: generator for + likelihood → train → infer
Questions? · melkebir@illinois.edu
GReinSS tutorial — NCI Spring School on Algorithmic Cancer Biology Speaker notes are in HTML comments like this one. Live-demo hand-offs are marked "→ NOTEBOOK".
Laser pointer: replace the mouse arrow with a red dot on every slide of the interactive deck (just preview / marp --html). No effect in the PDF/PNG exports (static images have no cursor).
* Hands-on tutorial on GReinSS. * Problem: infer hidden combinatorial states from noisy, indirect measurements. * Plan: idea → theorem → live training. * Goal: apply it to your own problem.
* Pattern: hidden structure S, indirect obs X, known likelihood Pr(X|S). * Trees, CNA sets, isoforms — all fit. * Self-supervised: measurement known, state unknown.
* Model Pr(S|θ); each S* emits an X. * Problem 1: LEARN θ jointly (shared model couples observations). * Problem 2: INFER best state per observation. * Everything today serves these two.
* Four families: exact, variational, search, RL. * EM: exact E-step only for special structure (HMMs); combinatorial → intractable. * VI: bounds the likelihood (ELBO); needs a tractable posterior. * VAE: latents are artificial ℝ^d, not your state. * Local search: per-observation, no sharing. * Naive PG / GFlowNet: closest cousins — fail next. * All miss the same target: max joint likelihood.
* Generic episodic RL. * Policy builds a trajectory; reward scores it; maximize EXPECTED reward. * Three arrows: sample → score → gradient nudge. * REINFORCE: weight each log-prob gradient by reward; no gradient through reward. * Next slides = this loop, new reward.
> **Key question:** Can we adapt reward function $r(\tau)$ to optimize data likelihood $\Pr(X_{1:N}\mid \theta)$?
* Same diagram, re-labeled — machinery unchanged. * Terminal state S(τ) is the object; policy is a neural net. * Only new piece: the reward (orange); objective = data log-likelihood. * Pivot: max expected reward ≡ max likelihood. * Exact reward → next slide (denominator is the trick).
* What we optimize = how we optimize (policy gradient, rescaled reward). * Numerator Pr(Xi|τ): how well τ explains Xi. * Denominator Pr(Xi|θ): total prob of Xi — rescales each obs. * Theorem 1: unbiased for log-likelihood gradient; reward held constant.
Policy $\theta\equiv\Pr(\tau\mid\theta)$ over $\tau_1,\tau_2,\tau_3$ ($\tau_j$ builds $S_j$); marginal $\Pr(X_i\mid\theta)=\sum_\tau\Pr(\tau\mid\theta)\,\Pr(X_i\mid\tau)$.
> Reward **shrinks as it succeeds** ⇒ the policy covers *every* observation.
* Bars = Pr(τ|θ); each panel is the θ* its reward selects. * Fixed reward: linear → all mass on τ1, θ*=(1,0,0); Pr(X2)=0, L=0. * Dynamic reward: maximizes L; balances τ1,τ2 → θ*=(.5,.5,0), L=.0375. * Denominator = automatic load-balancing. * Reproduced numerically in the notebook's final section.
* RL cycle + our reward: sample → score → update θ. * New vs vanilla RL: denominator Pr(Xi|θ) re-estimated by sampling each iteration. * Covered state → bigger denominator → smaller reward (load balancing). * You supply only: generator for S + likelihood Pr(X|S). * Notebook: write those two, call train.
* SWITCH TO JUPYTER. * Load obs → Pr(X|S) one line → build net → train ~200 epochs → infer → vs thresholding. * Punchline: shared structure denoises, beats per-pixel rounding.
* The "generator" you supply is this small MLP — one hidden layer (64 units). * Each step: read the current partial set (0/1 vector) → U+1 logits: add element j, or stop. * Illegal moves (re-adding an element) are masked to -inf before the softmax → π_θ(a_t | s_t). * No recurrence — same weights every step; the grown set is fed back in (the dashed loop). Rolling out defines Pr(S|θ). * Keep it on sets; the point is how simple the generator is — the reward does the work.
**Watch for:** on-policy median $F_1$ *below* thresholding · off-policy median $F_1=\mathbf{0.938}$ · the same sets recovered.
* Merges off-policy theorem + Demo 2 hand-off. * Concept: sample toward states that fit each obs (Theorem 2 = optimal, min-variance); importance sampling stays unbiased. * Biology: domain knowledge proposes candidates (e.g. CNNaive in CNRein). * SWITCH TO JUPYTER (Demo 2): |U|=1000; on-policy scores WORSE than thresholding (needle in a haystack). * Off-policy proposal (pre-trained) → sets recovered. * Thm 2 if asked: sample where the data points, not blindly. * Pr(τ|Xi,θ) = Bayes: policy prior reweighted by likelihood. * (1/N)Σi: equal effort per observation. * Optimal = samples land where the gradient's mass is; unbiased via importance sampling. * Intractable → approximate: (Xij−½)/σ² for sets, CNNaive in CNRein.
* BACKUP slide (skip in 30 min; good for Q&A). Full off-policy estimator. * w(τ)=Pr(τ|θ)/q(τ): importance weight, product of per-step ratios (free during rollout). * r(τ): dynamic reward (Thm 1), rescaled by Pr(Xi|θ). * Pr(Xi|θ): importance-weighted batch average, re-estimated each iteration. * q=Pr(τ|θ) (w≡1) → collapses to on-policy loop. * Any q unbiased; Thm 2's q minimizes variance. Self-normalize to cut variance.
$(L+I)^{-1}$.
* SWITCH TO JUPYTER (Demo 3). Pre-trained checkpoint (heavier model). * Load model → simpleInference → compare to ground truth → F1 + visualize. * Ground truth: Erdős–Rényi base (p=½), per-graph thresholded subgraph → shared structure. * Obs = (start,end) of k random walks; Pr(X|S) = shifted-Laplacian (L+I)^{-1}. * Cartoon = 6 nodes; real = 10 nodes / 90 edges.
* Same four families, scored on: maximizes joint likelihood? Only GReinSS. * GFlowNets: sample ∝ FIXED reward; we rescale every iteration (Thm 1) → equals data log-likelihood. * Two state types, one method. * Sets: only GReinSS scales to |U|=1000; baselines plateau. * Graphs: GReinSS wins when data is poor (k=10); naive PG → empty graph (F1=0).
* Two requirements: incremental generator + likelihood. * Have those? Four-line recipe — as in the notebook.
* One reward formula, clean theorem. * Beats standard tools on simulations and real isoform data. * Drop-in for discrete latent-state problems in cancer genomics. * Try it on your own Pr(X|S).