A newer version of the Gradio SDK is available: 6.20.0
title: AI Model X-Ray
emoji: π¬
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 5.33.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: Which layers can you prune? Structural health scanner.
tags:
- backyard-ai
- custom-ui
π¬ AI Model X-Ray β Structural Health Scanner
Which layers of your transformer are compressible? Which are fragile?
Select a model or paste any HuggingFace model ID. The scanner extracts attention graphs, computes the spectral simplicial hierarchy per layer, and classifies each layer as immune (safe to prune), buffer (caution), or critical (do not touch).
Based on the spectral principle Ξ»β(T(G)) β€ Ξ»β(G), validated on 45,000+ graphs with zero violations. Formally verified in Lean 4.
How it works
For each layer we average every attention head's map over a small probe set
(16 sentences for text models, 16 CIFAR-10 images for vision), flatten it to a
signature, and join heads whose signatures correlate (Pearson r > 0.3). On that
head-to-head graph G we compute:
- Ξ»β(G) β algebraic connectivity of the head graph.
- T(G) β the triangle graph (edges of
Gthat share a triangle). - Ξ»β(T(G)) and the coherence ratio Ο = Ξ»β(T(G)) / Ξ»β(G).
- FI β the fragility index: fraction of edges sitting in zero triangles.
High Ο with zero FI means a layer is triangle-redundant β its head structure has slack and is safe to prune. Low Ο means the layer is structurally load-bearing.
| Regime | Condition | Meaning |
|---|---|---|
| π’ Immune | Ο > 0.8, FI = 0 | safe to prune |
| π‘ Buffer | 0.5 β€ Ο β€ 0.8 | prune with caution |
| π΄ Critical | Ο < 0.5 | do not prune |
Pre-loaded models (BERT, GPT-2, ViT) show instantly from a precomputed cache. Custom model IDs and DistilBERT trigger a live scan on ZeroGPU.
π¬ Demo: [YouTube link TBD] π See also: Octopus AI
Built by Cognitive Engineering π¨π