← Back to all essays
Canonical Source: iamdaksh.dev/blog/i-deleted-94-of-an-image-and-70-of-an-llm-prompt
View on GitHub ↗
Deep Learning & AI

I Deleted 94% of an Image and 70% of an LLM's Prompt. Here’s What Happened.

Published Nov 4, 2026 · 9 min read (1,759 words) · By Daksh Patel

By Daksh Patel

GitHub: github.com/helloitsdaksh/saccade | PyPI: pip install saccade-ai


I have a confession: I hate Grad-CAM.

If you’ve ever worked with computer vision, you know the drill. You train a massive Vision Transformer, it predicts that a CT scan has a malignant tumor, and your boss or an oncologist asks: "Why did it make that prediction?"

So you fire up a saliency map like Grad-CAM. It spits out a smooth, gorgeous, rainbow-colored heatmap that looks like a Doppler radar storm hovering over the image. You look at it, smile, nod, and tell everyone: "See? It looked at the tumor."

Except it’s an illusion.

Post-hoc saliency maps are like hiring a PR spokesperson after a crime was committed to tell you what the suspect was probably thinking. Researchers have proven over and over again that you can randomize a model’s weights, blur the background, or shift pixels, and those smooth heatmaps barely change. You have zero mathematical guarantee that the model actually used those pixels.

So over the past week, I decided to fix this.

Inspired by David Ha’s (@hardmaru) legendary work on Neuroevolution of Self-Interpretable Agents, I built saccade: an open-source library that doesn't explain the black box after the fact. It physically blindfolds the model.

Then, around 2:00 AM, I had a crazy thought:

"Wait... if self-attention can prune 94% of image pixels without hurting accuracy, could it do the same thing to English prompts fed into LLMs? What if we intentionally destroy the grammar, throw away 70% of the words, and feed pure telegraphic noise to Gemini or GPT-4?"

Here is the story of how I built both, the bugs that almost broke my brain, and the double-blind experiment that proved LLMs don't care about your grammar.


Act I: Building the Physical Blindfold (Vision Saccade)

In human biology, your eyes don't stare at a static scene. They make rapid ballistic jumps called saccades (3 to 4 times a second). Your peripheral vision takes in the blurry room, and your high-resolution fovea darts to the high-information centers: the eyes, the hands, the door handle.

Why couldn't a Vision Transformer do the exact same thing?

In saccade, I inserted a mathematical bottleneck right into the middle of the transformer blocks:

Input Image (196 Spatial Patches)
       │
       ▼
Self-Attention Matrix A in R^{196 x 196}
       │
       ▼
Patch Importance Voting: p_j = sum_{i=1}^N A_{i, j}
       │
       ▼
Hard Top-K Bottleneck (Throw away 184 patches!)
       │
       ▼
Downstream Classifier (Receives ONLY the surviving 12 patches)

The mathematical beauty here is absolute: Causal Isolation.

If I physically throw away 184 patches out of 196 (keeping only 6.1% of the pixels), the downstream classification head never receives them. The gradient leakage is mathematically guaranteed to be 0.000000. If the model predicts Bald Eagle with 85% confidence, I know with 100% mathematical certainty that the decision came strictly from those 12 squares.


Act II: Peeking Inside the 12 Layers (The Mind of a Transformer)

I wanted to actually see this work in real time, so I built an interactive, zero-dependency HTML inspector that lets you scrub through all 12 layers of the transformer like a video editor timeline.

When you scrub through the layers, you watch the machine recreate the evolution of visual perception:

        Raw Pixels
            │
            ▼
┌───────────────────────────┐
│ Layer 0 – 2               │  "The Infant's Eye"
│ Low-Level Filters         │  Sees only contrast edges and horizons.
│                           │  Guesses: "White Stork" (19%), "Zebra" (fur stripes).
└─────────────┬─────────────┘
              │
              ▼
┌───────────────────────────┐
│ Layer 3 – 6               │  "The Anatomist"
│ Mid-Level Assembly        │  Glues textures into parts: wings, paws, cup rims.
│                           │  Confidence surges: "Bald Eagle" jumps to 75%.
└─────────────┬─────────────┘
              │
              ▼
┌───────────────────────────┐
│ Layer 7 – 11              │  "The Expert Detective"
│ Diagnostic Saccades       │  Discards 94% of the image. Locks onto the smoking gun:
│                           │  the hooked yellow beak, crema microfoam, eye mask.
└───────────────────────────┘
              │
              ▼
       Final Prediction: 85.2% Bald Eagle

If you scrub the slider to Layer 0, you'll notice something fascinating: a green box already touches the beak. If the beak is already in the top 12 patches, and those 12 patches are forwarded through the entire rest of the network (Layers 1 through 11) to the classification head, why does the final model only guess White Stork (19.6%) instead of Bald Eagle?

Here is the critical mechanistic distinction: token budget allocation vs. semantic composition.

At Layer 0, the linear projections act purely like classical Gabor edge filters. The bright yellow beak meeting stark white feathers against a dark forest is simply the highest-contrast luminance boundary in the photo. The model doesn't know it's a "beak"—it just fires on sharp color transitions. More critically, Layer 0 squanders 10 of its 12 precious tokens on irrelevant high-contrast noise: empty blue sky gradients, image corner artifacts, and tree branch silhouettes.

When the downstream network (Layers 1–11) receives only 1 patch of yellow-and-white feathers accompanied by 11 patches of empty sky and branches, it is starved of anatomical context. With no dark raptor wings, no tail feathers, and no talons, the downstream classifier looks at a lone white-and-yellow feather patch and makes an unformed, low-confidence guess: White Stork (19.6%).

Watch what happens as you drag the slider forward:

Fed this curated constellation of biological features, the downstream classifier surges from an uncertain 19% guess to a decisive 85.2% Bald Eagle.

At Layer 0, it picked contrast edges and wasted its budget on background sky. By Layer 11, it selected the minimal sufficient anatomical proof of an apex predator.

INTERACTIVE DEMO // Layer-by-Layer Vision Inspector (Layers 0–11)
Open Fullscreen ↗

Act III: The 2:00 AM Epiphany — "Break the Grammar"

Once the vision side was working, a question hit me like a ton of bricks:

Why do we write fluent English to LLMs?

Every day, developers send millions of prompts to Claude, Gemini, and GPT-4:

"Could you please carefully review the following document and in accordance with standard practice summarize..."

That is 60% to 70% syntactic fluff.

LLMs don't read English. They project subword tokens into high-dimensional geometric manifolds. If an LLM is just a giant token prediction machine, does it really need "in order to properly determine whether"? Or is it happy with "determine whether"?

What if we built a Prompt Saccade?

The Two-Tier Architecture: "The Tiny Bouncer & The Giant Brain"

Obviously, you can't ask GPT-4 to compress your prompt, because running GPT-4 costs the exact tokens you're trying to save!

So I designed a two-tier system:

  1. Tier 1 (The Free Local Bouncer): A tiny, lightweight model (distilgpt2) running 100% locally on my laptop's CPU. It runs in 15 milliseconds at $0.00 cost.
  2. It computes two mathematical numbers for every word:
  3. Self-Attention Votes: Words like melanoma, IndexError, or $14.2B get flooded with attention from other tokens. Words like the, please, and of get zero votes.
  4. Information Surprise ($-\log P(w)$): Rare, content-dense nouns carry huge bits of entropy. Common grammatical glue words carry near-zero bits.
  5. The bouncer multiplies them, keeps the top 30% of words in chronological order, and chops off the remaining 70%.

The result is a telegraphic, "broken grammar" string.


Act IV: The Double-Blind Test on My Own Blog

To see if this was actually real, or if it would cause the LLM to hallucinate, I ran a strict double-blind experiment on an article I personally wrote: "Building a GPT-Style Transformer Model from Scratch."

I launched two isolated Gemini instances in parallel that had zero communication with each other:

Here is the exact prompt Gemini B received:

"In recent, transformer models revolution field natural language processing. GPTGener Pretrained models garnered remarkable generate coherent context text. share journey building Gstyle transformer from discussing underlying implementation challenges lessons Transformers architecture tasks—from language translation beyond My project aimed dem models simplified yet G entirely hands not deep selfatt dec architectures thoughtful deep models differ transformer architecture ways DecOnly Architecture Unlike enc– models BERT Trans G uses part. Ca Self prediction for word words employs causal ( masked prevents che future tokens during training Pre Fine Parad first pre to fine task Why Build from Building transformer dem black forces: role positional encoding adds mechanism self how weigh layers residual help deep networks Project"

It looks like a stroke victim wrote a telegram.

Now look at what the two Gemini instances outputted side-by-side:

TopicGemini A (From Full 445-Token Post)Gemini B (From Chopped 146-Token Post)
1. Core ObjectiveThe author undertakes building a functional, simplified GPT-style transformer from scratch to demystify modern NLP models and understand how autoregressive language models generate coherent text.The author details building a simplified GPT-style transformer from scratch to demystify modern autoregressive language models, exploring implementation challenges and foundational generative NLP concepts through hands-on development.
2. Architectural DifferencesUnlike the standard encoder–decoder transformer or encoder-only variants (e.g., BERT), GPT relies on a decoder-only design with causal (masked) self-attention to prevent the model from attending to future tokens during next-token prediction, underpinned by a pre-training and fine-tuning paradigm.Unlike encoder-decoder transformers or encoder-only models (like BERT), GPT employs a decoder-only architecture featuring causal (masked) self-attention—which prevents the model from "cheating" by attending to future tokens during training—operating under a pre-training and fine-tuning paradigm.
3. Key MechanicsImplementing the model from the ground up strips away the "black-box" abstraction, fostering a first-principles understanding of crucial components—including positional encodings for sequence order, self-attention for token-weighting dynamics, and stacked layers with residual connections.Constructing the model from the ground up demystifies the "black box" nature of transformers, providing deep insight into critical mechanics such as positional encoding (injecting sequence order), self-attention (contextual token-weighting), and residual connections/normalization (enabling effective training of deep neural networks).

They are virtually identical.

Every technical detail—the decoder-only structure, causal masking to prevent cheating on future tokens, pre-training/fine-tuning, positional encodings, and residual connections—was captured with 100% precision.

And Gemini B did it using 67.2% fewer tokens.


The Economics: Why This Matters

Let’s talk numbers.

If you’re running an enterprise AI application making 1,000,000 LLM calls a month with standard prompts:

In medical imaging, it protects patients by proving an AI isn't hallucinating on scanner glare. In LLM applications, it cuts your cloud bill by two-thirds.


Try It Out

I open-sourced the whole package. It's on PyPI right now:

pip install saccade-ai

15-Second Code Example:

from saccade.text import PromptSaccade

# Initialize the tiny local CPU filter (takes ~15ms)
saccade = PromptSaccade(model_name="distilgpt2", device="cpu")

# Compress your prompt by 65% before sending it to GPT-4 / Gemini
compressed, meta = saccade.compress(
    text=my_long_prompt,
    compression_ratio=0.35, # Keep only 35% of tokens
    preserve_order=True
)

print(f"Saved {meta.tokens_saved} tokens ({meta.token_savings_pct:.1f}% reduction)!")
# Send compressed.text to your expensive LLM!

I also built two standalone, zero-dependency interactive visualizers (hosted right here on this site!):

INTERACTIVE PLAYGROUND // Real-Time Prompt Compression & Token Pruning
Open Fullscreen ↗

Check out the code on GitHub: github.com/helloitsdaksh/saccade.

Let me know what you think—and next time you write a prompt to an LLM, remember: it doesn't need your grammar. It just wants the signal.