# Diffusion Models, Diffusion LMs and DSpark

**Project:** [Concept Learning](../../INDEX.md) · **Workstream:** this offline lesson, separate from LAYA and Decision Lab · **Evidence cutoff:** 24 November 2026. The requested Word report is the starting inventory, not the primary authority. Its raw local Markdown conversion, source papers and executable examples are separate from the website. No private content was sent to a network service.

**Release and verification status (2026-11-24):** The previously accepted [offline lesson](../index.html) and [CompVis flow map](../latent-diffusion-flow-diagram.html) are unchanged. The [fresh four-agent audit](../verification/source-reaudit-bbf6c2c6.json) blocked re-acceptance on CompVis's nonvisual step feedback. The [verification receipt](../verification/receipt.json) distinguishes the two decisions and preserves the exact hashes.

## Read the research

| Record | Purpose |
|---|---|
| [01-continuous.md](./01-continuous.md) | Gaussian diffusion, DDIM/SDE/EDM/flow, conditioning, U-Net/LDM/DiT/MMDiT, derivations and tensor shapes |
| [02-language.md](./02-language.md) | Discrete and continuous text corruption, masking/caching, deployment uses, model comparison, and six Oct–Nov 2026 primary sources |
| [03-dspark.md](./03-dspark.md) | Parallel backbone, Markov/optional recurrent head, confidence, explicit release shapes, loss, scheduler, verifier, and offline vs live evidence |
| [04-visual-evidence.md](./04-visual-evidence.md) | Visual reading notes, all numbered DSpark figures and table, evidence scope |
| [Paper figure and table catalogue](./media-index.md) · [inventory](./inventory.json) · [media receipts](./media-inventory.json) | Per-paper source URLs, versions and local extract locations; machine-located assets and unresolved conversions |
| [Repositories](./checkout-receipt.json) · [corpus configuration](./corpus.json) · [asset provenance](../assets/provenance.json) | Pinned public clones, core paper inclusion, CC BY asset fingerprints |
| [Synthetic reference code](./toy_checks.py) · [results](./toy-checks.json) | Executed arithmetic for noising, reveal probabilities, configuration-derived shapes, exact verification, biased retrospective admission and optimal allocation at fixed budget |

## How evidence was collected

1. The original Word document remains in Downloads. A read-only OOXML conversion preserved paragraph ordering and 24 Word tables. There were no embedded images, despite the report discussing figures. Its SHA-256 and the local Markdown/CSV locations are recorded in the inventory. The report's private header is not included in the webpage.
2. Source versions were identified from arXiv abstracts; original PDFs and machine Markdown copies were saved in a local archive. Use structured author HTML for equation markup and tables where present, fallback to PDF. PDF raster pages retain vector artwork and spanning table headers. CSV flattens structure; for multilevel/merged tables read the source image or retained HTML before using cells.
3. `requirements.txt` pins a small isolated Python converter environment. Use `python research\collect.py --archive <local-archive> --word <input-docx>`; `python research\media.py --archive <local-archive>` builds the panel inventory and nine attributed DSpark crops. Sparse repo clones are source only; no training framework install or GPU access. Actual model benchmark results remain author-reported.
4. The selected corpus has 21 versioned arXiv PDFs (638 pages) with Markdown conversions and 11 pinned official checkouts. The machine catalogue lists 311 figure records and 151 table records, including 109 paper CSV exports. It fetched all 724 panel URLs it discovered. Where there is no standalone panel or structured table, use the PDF page render. This is not a manual review of every catalogue row or every source cited in the Word report.

## Visual plan before implementation

An encyclopedic timeline is useful in the research directory, but not as the learning order. The page is ordered by **what each process changes and who owns the next output**. Native HTML, CSS, SVG and JavaScript are enough: no runtime library, no server, no model weights. Cyan is a retained signal or verified output; violet is corruption or a provisional prediction; amber is a correction. Shape contracts and computed values remain visible when motion is off.

| Where | Illustration/control | Motion and verification |
|---|---|---|
| Continuous diffusion | Signal/noise bar and scalar reconstruction, with two sliders for retained signal and network error. Separate shape diagram for pixel, latent and patch axes. | Animate only short, input-triggered value transitions; fixed axis and numeric text. Compare against Python `x_t=1, x̂₀=1.625`. |
| Language diffusion | Fixed prompt + mutable two-slot canvas; choose reveal order/mode and inspect legal two-mode joint vs simultaneous marginals. Compare `m_t` / `m_s` reveal fraction. | Step whole snapshot or one reveal, not a video of a real checkpoint. Check both mismatch and coherent paths. |
| DSpark | Seven clickable steps on a flat projection/attention/Markov/confidence/target diagram, with declared miniature dimensions beside the pinned Qwen configuration. | Highlight only the active stage; same first draw flows into Markov bias and the second distribution. Verify both branches. |
| Verifier | Compare `p` and `q`, probability ratio and mass, then toggle invalid retrospective peek. | Show which mass was accepted/corrected, not a guessed model likelihood. Verify exactly `.70` becomes `.85` with the bad rule. |
| Scheduler | Prefix-survival rows and fixed extra-slot budget, plus an Appendix A A/B selector that links to the verifier's probability lab. | A known toy profile shows first-stop and invalid lookahead separately. Check the fixed budget against the exhaustive oracle and both appendix branches against exact fractions. No engine throughput measured. |
| Source room | All cleared DSpark figures and Table 1, with interpretation, page link and author protocol. Corpus is reference, not merged leaderboard. | Static figures with descriptive text and a lower-payload preview; no dynamics from data we did not extract or measure. |

## Verification and continuation

The [receipt](../verification/receipt.json) records the build lineage, Python/Node/Edge versions, run evidence and limits. Source archive: `%USERPROFILE%\.copilot\session-state\50f975ba-6203-4095-9af3-67a23eb321fa\files\diffusion-evidence`. Keep the Word input and raw extracts private. The lesson and the companion map are standalone HTML files; the neighbouring Markdown and CSV files support the research links.

### DF-03: foundations-first expansion

| Reader question | Interactive path | What the check establishes |
|---|---|---|
| How does a denoiser learn, and how can it sample with no original image? | Pixel timeline with training and generation modes; seed, play and inspect one cell | Forward corruption and known-noise MSE; successive seeded reverse updates; displayed clean estimate is not the next sample |
| What does corruption mean for tokens? | Four-slot masked training and inference, plus the retained two-slot dependency example | Mask-only loss, fixed prompt, right-side conditioning, and commit without access to gold labels |
| What goes into each layer? | Eight training/generation inspectors and a three-flow CompVis companion | Paper and code-backed tensor contracts; configuration versus toy versus author result |
| Do more parallel tokens mean lower latency? | Fixed-output comparison lab and research cards | Explicit prompt-cache and step-count conventions, allowed attention pairs versus recurrent updates, and no new latency claims |
| Where could diffusion help, and how would we know? | Use cases, November arXiv reading and four experiment designs | Primary references with limits; proposals with baselines, measurable metrics and falsification criteria |

**DF-03 coverage status:** All five scope items are completed in the accepted HTML and in the related research notes above. The first staged build passed functional tests but failed [three source checks](../verification/source-review-4557554a.json): DiffusionGemma training vs. generation, which rows DUET retains, and what Clover Table 2 counts. The corrected build passed a [fresh independent re-check](../verification/source-review-bbf6c2c6.json), 10 numerical and 15 offline Edge test groups, and the final local navigation check. The original DF-01 exercises and media remain available within the revised lesson. No model checkpoints, serving benchmarks, or proposed experiments were run.

Run from `Concept_Learning\diffusion-models`:

```powershell
python .\build.py --check
python .\research\toy_checks.py
node --test .\verification\lesson.test.cjs
python .\build_flow.py --check
# Use an available Playwright module (PLAYWRIGHT_MODULE can name its local path).
node .\verification\browser.cjs
```

For development, `python .\build.py --candidate` writes `index.candidate.html` without replacing the accepted page. `node .\verification\browser.cjs .\index.candidate.html` tests the candidate by its actual fingerprint. The CompVis map uses the installed flow-diagram template at build time (or a supplied `--template`); no plugin is needed to open the result.

| Session task | Classification | Authoritative evidence and destination | Write / verification status | Remaining gap |
|---|---|---|---|---|
| `diff-doc` · convert the supplied report | Completed | [Inventory](./inventory.json); private `word\report.md` and CSVs | Conversion saved; fingerprint and counts recorded | Word leads are not independently authoritative |
| `diff-primary` · extend with primary papers and released code | Completed | [Corpus](./corpus.json), [pinned checkouts](./checkout-receipt.json) | Downloads and version receipts saved | Scope is the selected corpus, not all 82 leads |
| `diff-convert` · archive paper figures and tables | Completed with scope limit | [Media catalogue](./media-index.md), [capture receipt](./media-inventory.json) | Figure/table exports and PDF fallbacks saved | Catalogue coverage is automated, not a full editorial audit |
| `diff-study` · interpret mechanisms and checked examples | Completed for selected mechanisms | [Continuous](./01-continuous.md), [language](./02-language.md), [DSpark](./03-dspark.md), [figures](./04-visual-evidence.md), [toy results](./toy-checks.json) | Notes written; Python fixtures reproduced, selected media read | No checkpoint execution or reproduction of authors' experiments |
| `diff-design` / `diff-page` · plan and build the new offline site | Completed | Design table above, [template](../src/lesson.html), [build recipe](../build.py), [current lesson](../index.html) | Deterministic build; Appendix A desktop/mobile captures inspected before the final wording delta | No server or model required |
| `diff-b1` · teach when verification can look at the draft | Completed and verified | [DSpark Appendix A](https://arxiv.org/html/2607.05147v1#A1), [DSpark notes](./03-dspark.md), [Python fixture](./toy-checks.json) | Appendix A outputs tested; final source check confirmed the historical full scan versus current ranking | Author-described production behavior, not an engine reimplementation |
| `diff-b2` / `diff-b3` / `diff-b46` · verify the handoff, model distinctions and figure claims | Completed and verified | [Language notes](./02-language.md), [DSpark notes](./03-dspark.md), [figure readings](./04-visual-evidence.md), [source audit lineage](../verification/source-review-6213e7c5.json) | Pinned code and config checks, visible Qwen tensor/cache walkthrough, language and figure corrections; exact parity after final edit | No checkpoints loaded and no reported performance reproduced |
| `diff-verify` / `diff-retest` / `diff-reaccept` · validate and select the revised build | Completed with runner exception | [Numerical harness](../verification/lesson.test.cjs), [browser harness](../verification/browser.cjs), [receipt](../verification/receipt.json) | Final seven numerical groups and source PASS; ten Edge assertions on the build before the one-line prose change | [VT-01](../../pending-work.md#validation-tooling) tracks browser-runner shutdown, not a lesson failure |
| LAYA and earlier Concept Learning lessons | Not changed here | [Parent index](../../INDEX.md) and the separate Inference workstream | No edits under Inference or existing lesson folders | The announced LAYA changes were not verified in this session |

**Start the next session here:** Open [Concept Learning](../../INDEX.md) and [DF-04 in pending work](../../pending-work.md#diffusion-models), then the [audit](../verification/source-reaudit-bbf6c2c6.json) and [receipt](../verification/receipt.json). Confirm the installed hashes before touching the [map builder](../build_flow.py). The next revision should expose the current flow and step to assistive technology, test the announcement, and pass a fresh exact-version gate. DF-02 is optional wider figure review; VT-01 is historical runner reliability. No graph sync, new skill or preference change. The private Word input and raw extracts were not opened during the re-audit.
