File size: 5,392 Bytes
d20e3d0
 
 
 
322bced
d20e3d0
 
 
322bced
 
d20e3d0
322bced
d20e3d0
 
322bced
d20e3d0
e45f8a9
d20e3d0
322bced
 
 
431ed5f
 
 
d20e3d0
322bced
 
 
 
431ed5f
 
322bced
 
431ed5f
322bced
431ed5f
322bced
 
 
431ed5f
322bced
 
431ed5f
322bced
 
431ed5f
 
e45f8a9
431ed5f
322bced
 
 
 
d20e3d0
322bced
 
 
d20e3d0
322bced
431ed5f
 
 
 
322bced
d20e3d0
431ed5f
 
 
 
 
322bced
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
license: apache-2.0
tags:
- diffusiongemma
- gemma4
- code-graphs
- code-refactoring
- latent-diffusion
- ast
pretty_name: DiffusionGemma 2 Latent Code Graph Benchmarks & Raw Predictions
size_categories:
- 1K<n<10K
---

# DiffusionGemma 2: Latent Code-Graph Benchmarks & Raw Predictions

Standardized AST code-graph benchmark packs, continuous symbol embeddings, pre-registration (`PREREG.json`), linear evaluation probes, and **raw `.npy` and `.npz` model prediction arrays** for independent CPU rescoring of ***Latent Roadmaps: Soft-Token Re-Feeding in DiffusionGemma for Code Graphs***.

- **Author:** `bumblebeers` ([GitHub](https://github.com/bumblebeers))
- **License:** Apache-2.0
- **Code & Scoring Harness:** [bumblebeers/dgg2-latent-code-graphs](https://github.com/bumblebeers/dgg2-latent-code-graphs)
- **Trained Two-Seed LoRA Adapters & Readout Heads:** [bumblebeer/dgg2-latent-code-graphs-adapters](https://huggingface.co/bumblebeer/dgg2-latent-code-graphs-adapters)
- **Standalone Libraries (`v0.1.0`):** [dgg-latent](https://github.com/bumblebeers/dgg-latent) | [dgg-codebook](https://github.com/bumblebeers/dgg-codebook) | [dgg-vit-decoder](https://github.com/bumblebeers/dgg-vit-decoder)
- **Upstream `transformers` Multimodal Mask Fix:** [huggingface/transformers#50684](https://github.com/huggingface/transformers/pull/50684)

---

## Repository Contents

### 1. Experiment A: 16x16 Visual Adjacency Grid Benchmark Packs (`data/gridA_*`)
- **`data/gridA_train1608.npz`**: 1,608 16-symbol Python AST subgraphs extracted across 3 training repositories (`fastapi`, `requests`, `rich`) with 22 fixed candidate states and 3 open-ended edit families.
- **`data/gridA_test360_httpx.npz`**: 360 held-out 16-symbol AST subgraphs from `encode/httpx` across seen, shuffled, unseen paraphrase, indirect intent, held-out single-pass, 2-step re-feeding, 3-step chain, and open-ended manifests.
- **`data/gridA_test360_click.npz`**: 360 held-out 16-symbol AST subgraphs from `pallets/click` for zero-shot cross-repository transfer.
- **`data/gridA_n32_*.npz` & `data/gridA_n48_*.npz`**: Multi-resolution 32x32 and 48x48 subgraph packs testing sub-patch packing limits (Gate A1).
- **`data/*.nodes.json`**: Per-subgraph AST symbol and line metadata.
- **`reader.npz`** (`outputs/m1/reader.npz`): Gate A1 closed-form Ridge probe mapping clean SigLIP latents `h_v` (`256 x 1152`) to the 8 discrete palette classes (`1.000` clean cell accuracy across all 8 classes).

### 2. Experiment B: 256-Symbol Continuous Embedding Packs (`data/nodeB_*`)
- **`data/nodeB_train1608.json.gz`**: 1,608 256-symbol AST windows for single-site and multi-site symbol refactoring.
- **`data/nodeB_test360_httpx.json.gz`** & **`data/nodeB_test360_click.json.gz`**: Held-out `httpx` (`N=360`) and zero-shot `click` (`N=360`) evaluation packs (`chance = 12.5%`, `mean-vector floor = 25.0%`).
- **`data/nodeB_test360_httpx_unseenargs.json.gz`** & **`data/nodeB_test180_httpx_renameclass.json.gz`**: Unseen argument and class-rename splits.
- **`data/nodeB_multi_test360_httpx_k2.json.gz`** & **`k4.json.gz`**: 2-site and 4-site simultaneous and re-fed symbol-editing splits.
- **`emb.npz`** & **`emb_train.npz`**: Frozen `sentence-transformers/all-MiniLM-L6-v2` (`d=384`) symbol embeddings and train-only standardization statistics.

### 3. Raw Model Prediction Arrays (`predictions/` & `outputs/m2/decoded_grids_all_arms.npz`)
To enable full independent verification without requiring a 26B GPU, this dataset hosts **both** continuous latent `.npy` outputs and Ridge-decoded discrete `(M, 16, 16)` `uint8` grid `.npy`/`.npz` files:
- **`predictions/expA_hv/<arm>/preds_*.npy`**: Raw continuous predicted SigLIP latent tensors (`360 x 256 x 1152`, `float32`) emitted by `stock_generate_with_readout` for two-seed LoRA DG (`cg_lora_dg_seed42_ep3`, `cg_lora_dg_seed1337_ep3`), `cg_frozen_dg_ep3`, and Non-DG baselines.
- **`predictions/expA_grids/<arm>/*.npy`** & **`outputs/m2/decoded_grids_all_arms.npz`**: Decoded `(360, 16, 16)` `uint8` palette grids (`0..7`) across all evaluated arms — two-seed LoRA DG (`httpx` and two-seed zero-shot `click`), Frozen DG, two-seed Non-DG (`Frozen Instr` and `Enc LoRA`), and preliminary `google/gemma-4-26B-A4B-it` autoregressive references (2-shot `gemma4_ar_prompted` and 354-of-4,824-step single-seed `gemma4_ar_lora_r64_s42` across all 4 primary splits).
- **`predictions/expB_vec/<arm>/*.npy`**: Raw standardized continuous symbol-vector predictions (`M x 256 x 384`, `float32`) for two-seed Experiment B LoRA DG (`cg_expB_lora_dg_seed42_ep3`, `cg_expB_lora_dg_seed1337_ep3`) and two-seed Non-DG baselines.

---

## Independent CPU Rescoring Quickstart

```bash
git clone https://github.com/bumblebeers/dgg2-latent-code-graphs.git
cd dgg2-latent-code-graphs

# Rescore Experiment A directly from raw continuous h_v (.npy, shape 360x256x1152) + Ridge probe:
python3 cg/cg_score_preds.py \
  --pack data/gridA_test360_httpx.npz \
  --reader reader.npz \
  --manifest seen_bal360 \
  --pred predictions/expA_hv/cg_lora_dg_seed42_ep3/preds_cg_lora_dg_seed42_ep3_seen_bal360.npy

# Rescore decoded (360, 16, 16) uint8 palette grids (.npy), including Gemma 4 AR LoRA:
python3 cg/cg_score_preds.py \
  --pack data/gridA_test360_httpx.npz \
  --manifest refeed_heldout_comp_bal360 \
  --grids predictions/expA_grids/gemma4_ar_lora_r64_s42/refeed_heldout_comp_bal360.npy
```