Jacob Garcia · Hugging Face Model Foundry

Pocket Diffusion

Interactive classifier-free guided digit diffusion. This showcase backs up the trained artifacts, measured evaluation, and complete runnable source.

Explore every file View the full foundry

Verified project card

# PocketDiffusion

PocketDiffusion is a compact class-conditional denoising diffusion model for 8x8
handwritten digits. It learns to predict Gaussian noise over 50 diffusion steps and
uses classifier-free guidance during sampling.

The same frozen Tiny Vision classifier used for GlyphForge evaluates conditional
recognizability, making the VAE and diffusion results directly comparable under one
judge.

## Reproduce

```powershell
uv run python projects/tiny-vision-foundry/prepare_data.py
uv run python projects/pocket-diffusion/train.py
```

## Verified results

- Parameters: **55,608**
- Diffusion steps: **50**
- Training epochs: **300**
- Generated samples: **1,000**
- Selected classifier-free guidance: **3.0**
- Frozen-judge class fidelity: **96.20%**

Guidance search improved fidelity monotonically from 46.10% at `1.0` to 96.20% at
`3.0`. Per-class fidelity ranged from 83% for digit `8` to 100% for digits `0` and
`6`. Mean within-class pixel variance ranged from 0.0209 to 0.0456, noticeably higher
than the CVAE's 0.0066 to 0.0168 range under the same 100-samples-per-class protocol.

Evaluation snapshot

{
  "model": "PocketDiffusion",
  "parameters": 55608,
  "diffusion_steps": 50,
  "epochs": 300,
  "guidance_search": {
    "1.0": 0.460999995470047,
    "1.5": 0.7149999737739563,
    "2.0": 0.8560000061988831,
    "2.5": 0.9359999895095825,
    "3.0": 0.9620000123977661
  },
  "generation": {
    "judge_accuracy": 0.9620000123977661,
    "judge_accuracy_by_class": {
      "0": 1.0,
      "1": 0.9200000166893005,
      "2": 0.9900000095367432,
      "3": 0.9800000190734863,
      "4": 0.9599999785423279,
      "5": 0.9800000190734863,
      "6": 1.0,
      "7": 0.9900000095367432,
      "8": 0.8299999833106995,
      "9": 0.9700000286102295
    },
    "mean_pixel_variance_by_class": {
      "0": 0.020940322428941727,
      "1": 0.03187673166394234,
      "2": 0.03836727514863014,
      "3": 0.03142565116286278,
      "4": 0.04158321022987366,
      "5": 0.034002821892499924,
      "6": 0.022990796715021133,
      "7": 0.036991652101278305,
      "8": 0.04558330774307251,
      "9": 0.03457583114504814
    },
    "samples": 1000,
    "guidance": 3.0
  },
  "judge": "Tiny Vision labels-only student, 98.52% real-image test accuracy"
}

Backed-up artifact tree

  • README.md
  • __pycache__/app.cpython-311.pyc
  • __pycache__/model.cpython-311.pyc
  • app.py
  • artifacts/pocket-diffusion/evaluation.json
  • artifacts/pocket-diffusion/model.safetensors
  • artifacts/pocket-diffusion/samples.png
  • model.py
  • requirements.txt
  • train.py