# Autoresearch: fastest single-step token TTO with high PSNR gain

Mirrors `playground/chamfer_opt/` and `playground/autoresearch_pose_align/`. All code
lives in this folder; the loop edits only `step.py:CONFIG` / `one_step`.

## Goal
The token-TTO distillation loss (`splatfactory/models/tto_loss.py`) wants a SINGLE inner
step that is cheap yet moves the tokens a lot toward the per-scene optimum (the 1-step
distillation target the encoder is trained to match). Make one `one_step` as **fast** as
possible while keeping a **high target-view PSNR gain**.

## Config
- **Scope (editable):** `step.py` only (`CONFIG` + `one_step`).
- **Metric (maximize):** mean target dPSNR / median step ms  (dB per ms).
- **Guard (must pass):** candidate target dPSNR >= baseline dPSNR - 0.05 dB; metric finite.
- **Direction:** higher is better.
- **Baseline:** `step.CONFIG` defaults = TTOLoss step 1 (lr 3e-3, Adam, L1, full render),
  measured once in `build_cache.py` -> `baseline.json`.

## Setup
```
conda run -n splatfactory --no-capture-output python -m playground.autoresearch_tto_step.build_cache
```
Caches the gaussian_head + 4 local DL3DV 6v scenes (encoder tokens + ctx + tgt) to
`cache/`, then writes `baseline.json`. `verify.py` reads the cache only (no backbone),
so each iteration is fast.

## Loop protocol (per iteration)
1. Review `results.tsv` + the champion `CONFIG`.
2. Make ONE change to `step.py` (a CONFIG knob or a new optimizer/precond in `one_step`).
3. `python -m playground.autoresearch_tto_step.verify` -> `METRIC=` / `GUARD=`.
4. Keep if `METRIC` > champion AND `GUARD=PASS`; else revert the change.
5. Append a row to `results.tsv`.

Knobs: lr, optimizer (adam==sign-like step-1 / sign / sgd), loss (l1/mse),
render_scale (<1 -> low-res gradient, faster), n_ctx (subset of views, faster).

## Results
See `results.tsv`.
