exp000b shipped: natural-paradigm wall (format-specialization double dissociation; epred cores strong zero-shot carriers)
Browse files- README.md +1 -1
- exp000b_natural/README.md +38 -0
- exp000b_natural/d1_exp000b_natural.py +192 -0
- exp000b_natural/results.json +31 -0
README.md
CHANGED
|
@@ -69,7 +69,7 @@ resolution) so gaps live in a narrow band — the paired design is load-bearing.
|
|
| 69 |
| exp | question | status |
|
| 70 |
|---|---|---|
|
| 71 |
| exp000_baselines | zero-shot baseline wall (above) | **shipped** |
|
| 72 |
-
| exp000b_natural | natural-paradigm
|
| 73 |
| exp001_sd15_relay | relay-all16 vs matched LoRA-r32 vs frozen: **relay beats both; LoRA lands below frozen; post-train toggle bit-exact** | **shipped (candidate, s0)** |
|
| 74 |
| exp002_sd15_addrcond | frozen byte-trigram aleph address into the cond stream — 4-arm causal | running |
|
| 75 |
| exp003_sigma_registers | sign-code separations: what is a diffusion "register"? (+prompt77 register) | running |
|
|
|
|
| 69 |
| exp | question | status |
|
| 70 |
|---|---|---|
|
| 71 |
| exp000_baselines | zero-shot baseline wall (above) | **shipped** |
|
| 72 |
+
| exp000b_natural | natural-paradigm wall: format specialization is a double dissociation; SDXL core tops the NL wall | **shipped (candidate, s0)** |
|
| 73 |
| exp001_sd15_relay | relay-all16 vs matched LoRA-r32 vs frozen: **relay beats both; LoRA lands below frozen; post-train toggle bit-exact** | **shipped (candidate, s0)** |
|
| 74 |
| exp002_sd15_addrcond | frozen byte-trigram aleph address into the cond stream — 4-arm causal | running |
|
| 75 |
| exp003_sigma_registers | sign-code separations: what is a diffusion "register"? (+prompt77 register) | running |
|
exp000b_natural/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# exp000b_natural — the natural-paradigm baseline extension (amendment to exp000)
|
| 2 |
+
|
| 3 |
+
**Directive.** Judged work carries standard 77-token plain-English prompting
|
| 4 |
+
alongside the json-225 encoding (congruency to the natural paradigm), and the
|
| 5 |
+
core epred variants of SD1.5/SDXL join the wall as primary reference points.
|
| 6 |
+
|
| 7 |
+
**Design.** Same judge, same 24 held-out rows, same paired derangement design
|
| 8 |
+
as exp000 (which remains immutable). New arms: the Lune family conditioned on
|
| 9 |
+
the NL `prompt` column via a STANDARD single 77-token CLIP encode (flow
|
| 10 |
+
sampler unchanged); the stock cores via their standard pipelines (epsilon
|
| 11 |
+
prediction, shipped schedulers, fp16 inference; judge features fp32).
|
| 12 |
+
SDXL generates at 1024 (CLIP judge resizes to 224 — resolution asymmetry noted).
|
| 13 |
+
|
| 14 |
+
**Results** (`results.json`; exp000 json-225 rows quoted for contrast):
|
| 15 |
+
|
| 16 |
+
| arm | cond | shuffled | gap | contrast (exp000, json-225) |
|
| 17 |
+
|---|---|---|---|---|
|
| 18 |
+
| sdxl_epred_core (Euler, g=5.0) | 0.7398 | 0.5269 | **+0.2129** | — |
|
| 19 |
+
| base_lune @ nl77 | 0.7540 | 0.5497 | **+0.2043** | +0.1075 on json |
|
| 20 |
+
| sd15_epred_core (PNDM, g=7.5) | 0.7267 | 0.5458 | **+0.1809** | — |
|
| 21 |
+
| json_ckpt2500 @ nl77 | 0.7210 | 0.5519 | **+0.1691** | +0.2099 on json |
|
| 22 |
+
|
| 23 |
+
**Findings (candidate, s0, n=24).**
|
| 24 |
+
1. **Conditioning-format specialization is a double dissociation**: the base
|
| 25 |
+
lune nearly doubles its grounding on natural prompts (+0.1075 → +0.2043)
|
| 26 |
+
while the json finetune loses ground there (+0.2099 → +0.1691). Training
|
| 27 |
+
format moves grounding toward the trained format and away from the other.
|
| 28 |
+
2. **The core epred models are strong natural-paradigm carriers zero-shot** —
|
| 29 |
+
SDXL core tops this wall; only json_vit's in-domain +0.2504 (exp000)
|
| 30 |
+
exceeds it anywhere. Supports treating the epred cores as the primary
|
| 31 |
+
adapter substrates.
|
| 32 |
+
3. Shuffled floors sit 0.53–0.56 across all arms — the derangement control is
|
| 33 |
+
stable across objectives, samplers, and resolutions.
|
| 34 |
+
|
| 35 |
+
**Caveats.** n=24, single seed bank; guidance/scheduler differ across arms by
|
| 36 |
+
design (each model judged under its own native regime — this wall compares
|
| 37 |
+
*models in their natural operating points*, not a controlled single-knob
|
| 38 |
+
sweep); SDXL resolution asymmetry as noted. GPU cost ≈ 8 minutes.
|
exp000b_natural/d1_exp000b_natural.py
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""d1_exp000b_natural.py — exp000b: the NATURAL-PARADIGM baseline extension.
|
| 2 |
+
|
| 3 |
+
Phil directive 2026-07-16 (post-crash wake): (1) judged work needs standard
|
| 4 |
+
77-token plain-English prompting ALONGSIDE the json-225 encoding — congruency
|
| 5 |
+
to the natural paradigm; (2) the CORE EPRED variants of SD1.5 and SDXL are the
|
| 6 |
+
most powerful elements (Lune = an undertrained exemplar) and join the wall.
|
| 7 |
+
|
| 8 |
+
Amendment to exp000 (original rows immutable on the hub). Same judge, same 24
|
| 9 |
+
rows, same paired derangement design. New arms:
|
| 10 |
+
A. lune family x nl77 — plain-English `prompt` column, STANDARD single
|
| 11 |
+
77-token CLIP encode (the natural conditioning shape), same flow sampler.
|
| 12 |
+
B. sd15_epred_core — stock stable-diffusion-v1-5 via the standard
|
| 13 |
+
StableDiffusionPipeline (epsilon-pred, stock scheduler, 77-token NL) —
|
| 14 |
+
the natural paradigm itself as a baseline.
|
| 15 |
+
C. sdxl_epred_core — stock stable-diffusion-xl-base-1.0 via the standard
|
| 16 |
+
StableDiffusionXLPipeline (epred, dual encoder, 1024px; judge resizes to
|
| 17 |
+
CLIP's 224 — resolution asymmetry NOTED).
|
| 18 |
+
|
| 19 |
+
Pod: bash pod2/run_exp000b.sh
|
| 20 |
+
"""
|
| 21 |
+
from __future__ import annotations
|
| 22 |
+
|
| 23 |
+
import io
|
| 24 |
+
import json
|
| 25 |
+
import os
|
| 26 |
+
import sys
|
| 27 |
+
|
| 28 |
+
sys.path[:0] = ["pod2", "."]
|
| 29 |
+
|
| 30 |
+
import torch
|
| 31 |
+
|
| 32 |
+
from pod_ledger import ledger_run, note
|
| 33 |
+
from aleph_diffusion_core import derangement
|
| 34 |
+
from d1_lune_sampler import encode_clip_225, flow_sample, decode
|
| 35 |
+
|
| 36 |
+
DATASET = "AbstractPhil/synthetic-object-relations-json"
|
| 37 |
+
SD_BASE = "stable-diffusion-v1-5/stable-diffusion-v1-5"
|
| 38 |
+
SDXL_BASE = "stabilityai/stable-diffusion-xl-base-1.0"
|
| 39 |
+
LUNE_MODELS = [
|
| 40 |
+
("json_ckpt2500", "AbstractPhil/sd15-flow-lune-json-prompt",
|
| 41 |
+
"checkpoint-00002500/unet"),
|
| 42 |
+
("base_lune", "AbstractPhil/sd15-flow-lune-flux",
|
| 43 |
+
"flux_t2_6_pose_t4_6_port_t1_4/checkpoint-00018765/unet"),
|
| 44 |
+
]
|
| 45 |
+
N, STEPS, GUIDANCE, SEED = 24, 30, 6.0, 1234
|
| 46 |
+
OUT_DIR = ("/workspace/data/dexp000b" if os.path.isdir("/workspace")
|
| 47 |
+
else os.path.join(os.environ.get("GEOLIP_DATA", "./data"),
|
| 48 |
+
"dexp000b"))
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def encode_nl77(prompts, tokenizer, text_encoder, device):
|
| 52 |
+
"""STANDARD single-77 CLIP encode — the natural conditioning shape."""
|
| 53 |
+
ids = tokenizer(prompts, padding="max_length",
|
| 54 |
+
max_length=tokenizer.model_max_length, truncation=True,
|
| 55 |
+
return_tensors="pt").input_ids.to(device)
|
| 56 |
+
return text_encoder(ids)[0] # [B, 77, 768]
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def load_rows(n=N):
|
| 60 |
+
from d1_exp000_baselines import load_rows as _lr
|
| 61 |
+
rows = _lr(n)
|
| 62 |
+
# exp000's loader carries json cond cols; re-read the NL `prompt` column
|
| 63 |
+
from huggingface_hub import HfApi, hf_hub_download
|
| 64 |
+
import pyarrow.parquet as pq
|
| 65 |
+
api = HfApi()
|
| 66 |
+
files = sorted(f for f in api.list_repo_files(DATASET, repo_type="dataset")
|
| 67 |
+
if f.endswith(".parquet"))
|
| 68 |
+
path = hf_hub_download(DATASET, files[-1], repo_type="dataset")
|
| 69 |
+
tbl = pq.read_table(path, columns=["prompt"])
|
| 70 |
+
nl = [r["prompt"] for r in
|
| 71 |
+
tbl.slice(max(0, tbl.num_rows - n), n).to_pylist()]
|
| 72 |
+
for r, p in zip(rows, nl):
|
| 73 |
+
r["prompt"] = p if isinstance(p, str) else json.dumps(p)
|
| 74 |
+
return rows
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def run(device="cuda"):
|
| 78 |
+
os.makedirs(OUT_DIR, exist_ok=True)
|
| 79 |
+
import numpy as np
|
| 80 |
+
from PIL import Image
|
| 81 |
+
from diffusers import (UNet2DConditionModel, AutoencoderKL,
|
| 82 |
+
StableDiffusionPipeline, StableDiffusionXLPipeline)
|
| 83 |
+
from transformers import (CLIPTextModel, CLIPTokenizer, CLIPModel,
|
| 84 |
+
CLIPProcessor)
|
| 85 |
+
from d1_exp000_baselines import judge_selftest
|
| 86 |
+
|
| 87 |
+
rows = load_rows()
|
| 88 |
+
nl_prompts = [r["prompt"] for r in rows]
|
| 89 |
+
perm = derangement(N, seed=SEED)
|
| 90 |
+
nl_shuffled = [nl_prompts[i] for i in perm.tolist()]
|
| 91 |
+
|
| 92 |
+
clip = CLIPModel.from_pretrained(
|
| 93 |
+
"openai/clip-vit-large-patch14",
|
| 94 |
+
torch_dtype=torch.float32).to(device).eval()
|
| 95 |
+
cproc = CLIPProcessor.from_pretrained("openai/clip-vit-large-patch14")
|
| 96 |
+
feat = judge_selftest(clip, cproc, device)
|
| 97 |
+
orig = torch.cat([
|
| 98 |
+
feat(Image.open(io.BytesIO(r["image_bytes"])).convert("RGB"))
|
| 99 |
+
for r in rows])
|
| 100 |
+
|
| 101 |
+
def cos_of(pils, sl):
|
| 102 |
+
f = torch.cat([feat(p) for p in pils])
|
| 103 |
+
return (f * orig[sl]).sum(-1).tolist()
|
| 104 |
+
|
| 105 |
+
results = {"n": N, "seed": SEED, "amendment_of": "exp000_baselines",
|
| 106 |
+
"models": {}}
|
| 107 |
+
|
| 108 |
+
# A. lune family, nl77 arms (natural prompt, standard encode, flow sampler)
|
| 109 |
+
tok = CLIPTokenizer.from_pretrained(SD_BASE, subfolder="tokenizer")
|
| 110 |
+
te = CLIPTextModel.from_pretrained(
|
| 111 |
+
SD_BASE, subfolder="text_encoder",
|
| 112 |
+
torch_dtype=torch.float32).to(device).eval()
|
| 113 |
+
vae = AutoencoderKL.from_pretrained(
|
| 114 |
+
SD_BASE, subfolder="vae", torch_dtype=torch.float32).to(device).eval()
|
| 115 |
+
with torch.no_grad():
|
| 116 |
+
ehs_c = encode_nl77(nl_prompts, tok, te, device)
|
| 117 |
+
ehs_s = encode_nl77(nl_shuffled, tok, te, device)
|
| 118 |
+
for label, repo, sub in LUNE_MODELS:
|
| 119 |
+
with ledger_run(f"dexp000b {label} nl77", budget_h=0.5) as h:
|
| 120 |
+
unet = UNet2DConditionModel.from_pretrained(
|
| 121 |
+
repo, subfolder=sub, torch_dtype=torch.float16).to(device)
|
| 122 |
+
unet.eval()
|
| 123 |
+
arms = {}
|
| 124 |
+
for arm, ehs in (("cond", ehs_c), ("shuffled", ehs_s)):
|
| 125 |
+
cos = []
|
| 126 |
+
for i in range(0, N, 6):
|
| 127 |
+
lat = flow_sample(unet, ehs[i:i + 6].half(),
|
| 128 |
+
n_steps=STEPS, guidance=GUIDANCE,
|
| 129 |
+
seed=SEED + i, device=device)
|
| 130 |
+
imgs = decode(vae, lat.float())
|
| 131 |
+
pil = [Image.fromarray((im * 255).astype(np.uint8))
|
| 132 |
+
for im in imgs]
|
| 133 |
+
cos += cos_of(pil, slice(i, i + len(pil)))
|
| 134 |
+
arms[arm] = round(sum(cos) / len(cos), 4)
|
| 135 |
+
gap = round(arms["cond"] - arms["shuffled"], 4)
|
| 136 |
+
results["models"][f"{label}_nl77"] = {**arms,
|
| 137 |
+
"cond_minus_shuffled": gap}
|
| 138 |
+
h["verdict"] = f"nl77 gap {gap:+.4f}"
|
| 139 |
+
del unet
|
| 140 |
+
torch.cuda.empty_cache()
|
| 141 |
+
|
| 142 |
+
# B/C. the CORE EPRED baselines via standard pipelines (the paradigm)
|
| 143 |
+
def pipe_arm(label, mk_pipe, size):
|
| 144 |
+
with ledger_run(f"dexp000b {label}", budget_h=0.7) as h:
|
| 145 |
+
pipe = mk_pipe()
|
| 146 |
+
arms = {}
|
| 147 |
+
for arm, ps in (("cond", nl_prompts), ("shuffled", nl_shuffled)):
|
| 148 |
+
cos = []
|
| 149 |
+
for i in range(0, N, 4):
|
| 150 |
+
g = torch.Generator(device=device).manual_seed(SEED + i)
|
| 151 |
+
out = pipe(ps[i:i + 4], num_inference_steps=STEPS,
|
| 152 |
+
generator=g, height=size, width=size)
|
| 153 |
+
cos += cos_of(out.images, slice(i, i + len(out.images)))
|
| 154 |
+
arms[arm] = round(sum(cos) / len(cos), 4)
|
| 155 |
+
gap = round(arms["cond"] - arms["shuffled"], 4)
|
| 156 |
+
results["models"][label] = {
|
| 157 |
+
**arms, "cond_minus_shuffled": gap,
|
| 158 |
+
"scheduler": type(pipe.scheduler).__name__,
|
| 159 |
+
"guidance": pipe._guidance_scale
|
| 160 |
+
if hasattr(pipe, "_guidance_scale") else "default"}
|
| 161 |
+
h["verdict"] = f"gap {gap:+.4f}"
|
| 162 |
+
del pipe
|
| 163 |
+
torch.cuda.empty_cache()
|
| 164 |
+
|
| 165 |
+
pipe_arm("sd15_epred_core",
|
| 166 |
+
lambda: StableDiffusionPipeline.from_pretrained(
|
| 167 |
+
SD_BASE, torch_dtype=torch.float16,
|
| 168 |
+
safety_checker=None).to(device), 512)
|
| 169 |
+
pipe_arm("sdxl_epred_core",
|
| 170 |
+
lambda: StableDiffusionXLPipeline.from_pretrained(
|
| 171 |
+
SDXL_BASE, torch_dtype=torch.float16,
|
| 172 |
+
variant="fp16").to(device), 1024)
|
| 173 |
+
|
| 174 |
+
with open(os.path.join(OUT_DIR, "results.json"), "w") as f:
|
| 175 |
+
json.dump(results, f, indent=2)
|
| 176 |
+
note("dexp000b: " + json.dumps(
|
| 177 |
+
{k: v["cond_minus_shuffled"] for k, v in results["models"].items()}))
|
| 178 |
+
print(json.dumps(results, indent=2))
|
| 179 |
+
return results
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
def smoke():
|
| 183 |
+
p = derangement(N, seed=SEED)
|
| 184 |
+
assert not (p == torch.arange(N)).any()
|
| 185 |
+
print("dexp000b smoke PASSED (parse; GPU run is pod work)")
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
if __name__ == "__main__":
|
| 189 |
+
if "--run" in sys.argv:
|
| 190 |
+
run()
|
| 191 |
+
else:
|
| 192 |
+
smoke()
|
exp000b_natural/results.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"n": 24,
|
| 3 |
+
"seed": 1234,
|
| 4 |
+
"amendment_of": "exp000_baselines",
|
| 5 |
+
"models": {
|
| 6 |
+
"json_ckpt2500_nl77": {
|
| 7 |
+
"cond": 0.721,
|
| 8 |
+
"shuffled": 0.5519,
|
| 9 |
+
"cond_minus_shuffled": 0.1691
|
| 10 |
+
},
|
| 11 |
+
"base_lune_nl77": {
|
| 12 |
+
"cond": 0.754,
|
| 13 |
+
"shuffled": 0.5497,
|
| 14 |
+
"cond_minus_shuffled": 0.2043
|
| 15 |
+
},
|
| 16 |
+
"sd15_epred_core": {
|
| 17 |
+
"cond": 0.7267,
|
| 18 |
+
"shuffled": 0.5458,
|
| 19 |
+
"cond_minus_shuffled": 0.1809,
|
| 20 |
+
"scheduler": "PNDMScheduler",
|
| 21 |
+
"guidance": 7.5
|
| 22 |
+
},
|
| 23 |
+
"sdxl_epred_core": {
|
| 24 |
+
"cond": 0.7398,
|
| 25 |
+
"shuffled": 0.5269,
|
| 26 |
+
"cond_minus_shuffled": 0.2129,
|
| 27 |
+
"scheduler": "EulerDiscreteScheduler",
|
| 28 |
+
"guidance": 5.0
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
}
|