# QLD plan: does QLD's plateau come from its independence assumption?

Thread arc-lpe · tracker [#71](https://github.com/public-research-archive/issues/71) · owner pick (D-068) 2026-11-17 · written by Claude Opus 5.5 (Claude Code)

**The question.** ARC's paper on estimating rare output probabilities (Wu and Hilton, low-probability estimation; code: alignment-research-center/low-probability-estimation) says in Appendix C, last paragraph, that QLD with more than 2^16 samples improves but plateaus, and reads that as QLD being limited by its assumption that the two parts of each activation (a along the chosen direction, b the rest) are independent. The public code had a whitening bug at line 73 (the owner's issue #2 there) and computes line 103 from y rather than b. So the plateau could also be an implementation artifact. Two hypotheses, each with a result that would show it wrong (owner's wording):

- **H1** (Appendix C plateau is a/b dependence) is wrong if Algorithm-3 QLD median abs log10 error on gelu-1l (hex, camel, english) keeps falling from 2^20 to 2^22 on at least 2 of 3.
- **H2** (plateau is an implementation artifact) is wrong if that error flattens by 2^20 above MHIS's 2^16 error on at least 2 of 3.

**Limits (owner, 2026-11-17).** Days 0 and 1 first; days 2 and 3 approved later the same day (below). CPU only, $0. No GPU rental or API spend; days 2 to 5 need the owner's separate yes. No post on ARC's repository, no contact with anyone, no PR. Third-party code runs on offline-worker in a container (D-054). Ground truth is public: `gs://arc-ml-public/lpe/ground-truth/{gelu-1l,gelu-2l,gelu-4l}/frequencies32-{dist}.pt`.

## Day 0: what is reused ([DAY0.md](DAY0.md))

## Day 1: one matmul for all targets, and a toy where independence holds exactly

Code: `day1/qld_multi.py` restructures ARC's QLD (line 73 bracketed) so each activation chunk gets one logit matmul `u @ P.T + beta` that serves every target; per target only elementwise work remains (logits of b are `Lu - a g_t`).

**Check 0, equivalence (`day1/test_equiv.py`).** On a small Gaussian problem, `qld_multi` variant b equals ARC's own QLD function with lines 73 and 103 edited, and variant y equals ARC's QLD with line 73 only, for the 11 tokens other than the one on top at the mean (ARC's search crashes there), within relative 1e-4. If this fails, nothing else on day 1 counts.

**Main test (`day1/toy_scaling.py`, `day1/analyse.py`).** Gaussian activations, d_model 16, vocabulary 64, 12 target tokens with true probability spread over 1e-8 to 1e-3. In the population-whitened space a and b are exactly independent, so QLD's limit is the true probability. Truth by Rao-Blackwellisation along a fixed direction with 2^26 exact samples (standard error recorded). n = 2^10 to 2^20, 16 independent samples at each n. Run in float32 (as ARC runs it) and in float64.

Fixed before the first run (2026-11-17):

- Error E(n) = median over the 12 targets of the relative root-mean-square error over the 16 samples, sqrt(mean((est/p - 1)^2)).
- **Pass (P1)**: for Algorithm-3 QLD (variant b, sample whitening, ARC's direction search) in float32, the least-squares slope of log2 E(n) on log2 n over n = 2^14 to 2^20 lies in [-0.65, -0.35], and E(2^18)/E(2^20) >= 1.5 (1/sqrt(n) predicts 2). P1 is judged only if the median truth standard error is below 0.2 E(2^20); otherwise the truth is rerun with more samples first.
- **y-variant bias does not fall (P2)**: B(n) = median over targets of |mean(est)/p - 1|. P2 holds if B(2^20) >= 0.5 B(2^14), and at 2^20 the bias is more than 3 standard errors from zero on at least 9 of 12 targets.
- Also reported, not judged: float64, the oracle estimator (true whitening and direction), and median abs log10 error (the day 2 to 3 metric; zero estimates count as infinite error).

## Days 2 and 3: gelu-1l, fixed before any QLD or MHIS run (2026-11-17)

**Owner's yes, 2026-11-17, in chat:** "Yes, run days 2–3". The estimate given was about 12 to 15 offline-worker hours at $0. That is above the bridge's 8 CPU-hour limit (D-056), which is why it needed the owner. Days 4 and 5 still need a separate yes. All other limits above still hold: CPU only, $0, no post, no contact, no PR.

Code: `day23/`. Third-party code (ARC's samplers, direction search and MHIS) runs on offline-worker in containers with the network off and memory capped (D-054). Only `fetch.py`, which is our own code, has the network.

**Inputs.**
- Ground truth: ARC's public `frequencies32-{hex,camel,english}.pt` for gelu-1l. The hex file is byte-identical to the copy from October.
- Camel and english: ARC's samplers build token lists from public datasets, so `fetch.py` rebuilt them the way ARC's `datasets.py` does. It reads the training files in reverse order and takes the first n items: 1,024 items of codeparrot-clean-train for camel, 16,384 of c4 en for english. They are tokenised as in `get_token_dataset`, and ARC's own cache path serves them (`out/fetch.json`).
- **Input gate.** From the 2^22 sample, compare the empirical argmax frequency f with the ground truth p for every token with p >= 1e-4, using z = (f - p)/sqrt(p(1 - p)/2^22). A distribution passes if the median |z| <= 1.5 and the maximum |z| <= 8. A distribution that fails is reported but left out of H1 and H2.

**Samples and tokens.**
- Samples: 2^22 pre-unembed activations per distribution, drawn with ARC's `gen_activ_samples` in 16 seeded shards of 2^18. The estimate at n uses the first n rows, for n = 2^16, 2^17, ..., 2^22.
- Tokens (`select_tokens.py`, `out/tokens.json`): 32 per distribution, drawn with `random.Random(20261118)` from ARC's band [1e-9, 1e-5]. The draw is restricted to ground-truth counts of at least 100 (p >= 2.3e-8) so the truth's own log10 error stays at or below 0.043. This departs from the paper, which draws from the whole band. The first 12 in draw order also get MHIS.

**Estimators.**
- **QLD (Algorithm 3).** ARC's QLD with line 73 bracketed and `b_samps` on line 103, in float32. The whitening comes from the first n rows; ARC's float32 Cholesky is replaced by float64 moments cast to float32. The direction is ARC's `random_constraint_projection` (n_reps 200, factor 0.95, seed = token id). If the search fails, it is retried with seed + 10^6, up to 3 tries. Failures are recorded, and a token-n with no direction counts as a zero estimate.
- **Implementation (`qld_fast.py`).** The logits do not depend on the whitening (u P^T + beta = x W_U), so one matmul serves every n and every target. A numba kernel finds the interval ends.
- **Gate before the main run.** The fast code must equal ARC's QLD (edits b) on the day 1 toy, and equal `day1/qld_multi.py` variant b on the first 2^14 real hex rows for 4 tokens, within relative 1e-4.
- **MHIS yardstick.** ARC's MHIS, unedited: 2^16 samples, burn-in 1,024, batch 32, the repository's gelu-1l temperatures (hex 0.67, camel 2.24, english 1.5), seed 5000 + token, on the 12 MHIS tokens. This is a measured yardstick rather than the paper's Table 3, because Table 3 reports fitted losses, not this metric.

**Metric and rules.**
- M(n) = median over tokens of |log10(estimate / p)|. A zero estimate counts as infinite.
- **Falling from 2^20 to 2^22** on a distribution: R = M_32(2^22) / M_32(2^20) <= 0.8, and the 95th percentile of R over 10,000 token bootstraps (seed 0) is below 1. 1/sqrt(n) predicts R = 0.5. If M_32(2^20) is infinite, the distribution counts as falling when M_32(2^22) is finite, and as undetermined otherwise. "Flat by 2^20" means not falling.
- **H1 is wrong** if QLD is falling on at least 2 of the distributions that pass the input gate.
- **H2 is wrong** if, on at least 2 of those distributions, QLD is flat and its M_12(2^20) on the 12 MHIS tokens is above MHIS's M_12 at 2^16.
- Neither hypothesis gets a verdict if fewer than 2 distributions pass the gate.
- Also reported, not judged: the full curve M(n), zero counts, direction-search failures, and the fitted leave-one-out IS loss (a x^c + b, `outreach/arc-qld/verify/fit.py`) for QLD at each n and for MHIS. The fitted IS loss is the paper's own metric.

## Days 4 and 5: frozen in [day45/PLAN.md](day45/PLAN.md) ([day45/DRYRUN.md](day45/DRYRUN.md))

Approved by the owner on 2026-11-23 ([tracker #77](https://github.com/public-research-archive/issues/77), pointer on [#71](https://github.com/public-research-archive/issues/71)).
