|
Download server/docs/policy_lp_reduction.md from lylybig8/mdm_coverage: direct link, hf CLI and curl.
- Browser
- Download file 9.5 kB
-
https://huggingface.co/datasets/lylybig8/mdm_coverage/resolve/main/server/docs/policy_lp_reduction.md
- Command line
-
hf download hf://datasets/lylybig8/mdm_coverage/server/docs/policy_lp_reduction.md
-
curl -L -o policy_lp_reduction.md https://huggingface.co/datasets/lylybig8/mdm_coverage/resolve/main/server/docs/policy_lp_reduction.md
9.5 kB
| # E3: fixed-oracle optimal randomized execution policies | |
| This experiment computes a **floating-point optimum for each fixed oracle**. | |
| It does not optimize the oracle over a KL ball, numerically establish a minimax | |
| exponent, or certify exact optimality with rational or interval arithmetic. | |
| The oracle is held fixed when the number of permitted rounds changes. | |
| ## Model and admissible interface | |
| There are `n` pairs. Under the target, `A_i` are independent fair bits, | |
| `E_i ~ Bernoulli(tau)` independently, and `B_i = A_i xor E_i`. The oracle has | |
| the same independent fair representative bits, while the mismatch vector is | |
| a positive mixture of iid Bernoulli laws. More generally the reduction below | |
| applies to a positive finite-exchangeable mismatch law. | |
| A policy chooses the entire next subset of hidden coordinates before any new | |
| outcome is drawn. Chosen coordinates are sampled independently from the oracle's | |
| conditional heads at the **pre-round context**. Values are irrevocable. The | |
| policy may depend on its full observed history, use private randomness, complete | |
| open pairs, expose either orientation of fresh pairs, or co-sample both endpoints. | |
| Empty rounds are allowed; a completed output is absorbing. A policy must finish | |
| by round `K`. This is not an adaptive-within-batch, rejection, remasking, or | |
| head-correction interface. | |
| ## Controlled aggregation | |
| The aggregate state is `(c,m,o)`: the number of completed pairs, their mismatch | |
| count, and the number of pairs with exactly one revealed coordinate. There are | |
| `f = n-c-o` fresh pairs. An action `(u,v,b)` completes `u` open pairs, co-samples | |
| `v` fresh pairs, and reveals one endpoint in `b` other fresh pairs. The constraints | |
| are `0 <= u <= o`, `v >= 0`, `b >= 0`, and `v+b <= f`. | |
| The posterior mismatch probability in an open pair is | |
| ``` | |
| p(c,m) = sum_j omega_j theta_j^(m+1) (1-theta_j)^(c-m) | |
| / sum_j omega_j theta_j^m (1-theta_j)^(c-m). | |
| ``` | |
| Single revealed endpoints are fair and convey no mismatch information. A fresh | |
| co-sampled pair has mismatch probability `1/2`, since both heads are fair and | |
| sampled independently. Conditional on the chosen action, the frozen-head rule | |
| therefore gives independent `X ~ Binomial(u,p(c,m))` and `Y ~ Binomial(v,1/2)`, and | |
| ``` | |
| (c',m',o') = (c+u+v, m+X+Y, o-u+b). | |
| ``` | |
| This formula holds conditional on any literal history and action inducing the | |
| aggregate state and action; it is not merely a target-distribution identity. | |
| For the last round, completion requires `(u,v,b) = (o,f,0)`. | |
| ## Why this preserves the optimum, including private randomization | |
| 1. For any admissible full-history policy, condition its current aggregate | |
| action on its current aggregate state and round. The resulting randomized | |
| Markov policy preserves the distributions of all aggregate states by | |
| induction, because the transition formula above is controlled-lumpable. | |
| In particular it preserves the terminal mismatch-count distribution. Data | |
| processing says count TV is at most the original full-output TV. | |
| 2. Conversely, lift a count-state policy by selecting uniformly among the | |
| literal subsets with the requested pair counts, and choosing the endpoint | |
| of each singleton birth by an independent fair coin. The target and oracle | |
| are invariant under pair permutations, simultaneous flips of both endpoints | |
| of any pair, and swaps of a pair's endpoints. The lifted dynamics are | |
| equivariant under this group, starting from the empty context. Consequently | |
| its full-output distribution is invariant. The full-output group orbits | |
| are characterized exactly by the total mismatch count. Both target and | |
| lifted output are uniform within each orbit, so their full TV equals the | |
| TV of their mismatch-count distributions. | |
| 3. These two inequalities show equality between the optimum over aggregate | |
| randomized Markov policies and the optimum over all allowed full-history, | |
| privately randomized literal policies, for this **fixed fair oracle**. | |
| The result is about marginal output laws. Averaging the TV errors of deterministic | |
| policies would generally give a different and incorrect optimization problem. | |
| ## Occupation LP and independent checks | |
| There is a nonnegative variable for each reachable `(round,state,action)`. | |
| State-flow equalities impose the initial empty context and the transition law. | |
| The terminal probabilities `q_m` are linear functions of final-round occupancies. | |
| Auxiliary nonnegative `d_m` obey `d_m >= q_m-P_m` and `d_m >= P_m-q_m`, where | |
| `P_m = Binomial(n,tau)(m)`. Minimize `sum_m d_m/2`. | |
| The implementation records solver status, primal flow residual, nonnegativity, | |
| terminal mass, L1-constraint residual, objective recalculated from terminal | |
| probabilities, dual slack violation, and primal-dual objective gap. The dual | |
| objective uses equality and inequality right-hand sides and the solver's dual | |
| marginals; all variable lower bounds are zero and all upper bounds infinite. | |
| These are floating-point diagnostics, not an exact lower-bound certificate. | |
| The native HiGHS option `threads=1` is passed through SciPy (some SciPy versions | |
| emit a warning that this native option is forwarded rather than recognized by | |
| the wrapper). BLAS/OpenMP environment thread limits should also be set by the | |
| runner. | |
| Positive-mass state occupancies are normalized into an explicit randomized | |
| policy. Its output is recomputed by a separate forward routine that uses direct | |
| mixture powers and explicit binomial-product sums, rather than reusing the LP's | |
| cached log-posterior/convolution transition arrays. Unvisited states use the | |
| first lexicographic legal action. The recovered output must match the LP output | |
| within a stated numerical tolerance. | |
| For `n <= 2` the independent literal-coordinate LP enumerates all complete bit | |
| vectors, forms the entire oracle law, obtains each coordinate head by conditioning | |
| that full law on a partial bit assignment, and enumerates all hidden-coordinate | |
| subsets. It never uses `(c,m,o)` to construct states, heads, or transitions. The | |
| terminal objective is full-bit-vector TV. Its optimum is checked against the | |
| aggregate LP. It shares only the generic occupation-LP assembly and solver. | |
| A separate regression uses `n=1`, `K=2`, target mismatch probability `1/4`, and | |
| oracle mismatch probability `1/8`. Serial completion and co-sampling have errors | |
| `1/8` and `1/4` separately. Their mixture with probabilities `2/3` and `1/3` has | |
| exact target marginal output and zero TV. Both LP formulations must recover zero | |
| error; aggregate action occupancies must imply those mixture weights. | |
| ## Frozen experiment grid and baselines | |
| The default grid is `n in {2,4,6,8}` and `K in {2,3,4}`, `tau=1/4`, `w=1/8`, | |
| `Delta=1/4`, `lambda=0.2`. Two fixed oracles are used: | |
| - Single alternative: weights `(1-w,w)` at `(tau,tau+Delta)`. | |
| - Fair two-level ladder: weights `(1-w,w/2,w/2)` at | |
| `(tau,tau+Delta,tau+Delta*(w/2)*lambda)`. | |
| The two-level ladder is **not rebuilt from `K`**. Actual joint `KL(P||R)` and | |
| joint TV are reported for every `n`; neither is inferred from the contamination | |
| weight. Matching `w` and `Delta` across the two models does not match their KL or | |
| initial drift, and the output includes the initial drift explicitly. | |
| Baselines expose one representative endpoint of every pair in round one, then | |
| complete uniformly selected open pairs in subsequent rounds. An all-`A` first | |
| round has the same full-output law here: the representative bits are independent | |
| fair bits and the completion process depends only on mismatch counts. Uniform | |
| pair selection (or a hidden uniformly random pair permutation) makes terminal | |
| count TV equal full TV. Deterministic labeled batch assignments should not be | |
| mistaken for this randomized comparison. | |
| - Equal: cumulative completions `ceil(n*j/(K-1))`. | |
| - Geometric heuristic: cumulative completions `floor(n**(j/(K-1)))`. This is a | |
| comparison schedule, not an assertion that this rounding instantiates every | |
| constant in the paper's upper-bound theorem. | |
| - Best fixed completion grid: every nondecreasing integer prefix in `[0,n]`, | |
| followed by completion of all `n` pairs. For `K=3`, this is exactly the complete | |
| grid of fixed pilot sizes. For `K>3`, it is the analogous fixed completion | |
| schedule class, not a new all-policy optimum. | |
| Within each oracle and dimension, optimal TV must not increase with `K`, and the | |
| LP optimum must not exceed any feasible baseline. The grid is deliberately | |
| small. A 250,000 state-action guard and a per-case solver limit of 120 seconds | |
| prevent accidental expansion. No large-dimensional all-policy claim follows | |
| from these numerical optima. | |
| ## Invocation and output | |
| ``` | |
| python src/e3_policy_lp.py --config configs/experiment_config.json --output results/e3 | |
| ``` | |
| The JSON configuration section `e3` accepts `n_values`, `rounds`, `tau`, `w`, | |
| `delta`, `ladder_lambda`, `time_limit_seconds`, `state_action_limit`, and | |
| `literal_n_values`. The main output is `e3_results.json`, incrementally updated, | |
| when `--output` is a directory. Passing a `.json` filename writes that file | |
| directly and stores policies in a sibling `<filename-stem>_policies/` directory. | |
| The top-level `cases` list contains each result. `--validate-only` runs the | |
| randomization regression and both oracles at `n=2`, `K=2,3`, including independent | |
| literal-coordinate checks. Recovered positive-mass policies are retained. | |
| Errors are preserved | |
| in the result rather than silently dropping failed cases. If any case fails a | |
| check, the process exits nonzero and the result status records this. | |