Model Compression Dashboard

Local System

PROJECT OVERVIEW

Compression at a glance

Monitor model size, compression efficiency and lossless reconstruction.

Loading saved compression results...
Original Size ▤
--
Raw parameter bytes
Compressed Size ▣
--
Complete HUFC container
Compression Ratio ↗
--
Original ÷ compressed
Space Saved ◉
--
Net storage reduction

Model Size Comparison

Before and after Huffman encoding

STORAGE
Original model parameters --
Compressed HUFC container --
Compressed size includes the container metadata and encoding overhead.

Model Accuracy

Original versus reconstructed model

Before compression --
After decompression --

Verification Status

Exact reconstruction checks

Byte equality --
Weight equality --
Prediction equality --

DATA ANALYSIS

Compression Analysis

Explore the byte-level characteristics of the model parameters.

HUFFMAN ENCODING
Payload Bytes --
Distinct Byte Symbols --
Average Code Length --
Theoretical Encoded Bits --

Byte Frequency Distribution

Most frequent byte values in the model payload

TOP 20
Frequency data will appear here.

Container Composition

Encoded data and container overhead

-- Payload
Encoded payload --
Container overhead --

ALGORITHM EXPLORER

Huffman Algorithm

Inspect the generated Huffman tree and symbol-to-code mappings.

CUSTOM IMPLEMENTATION

Huffman Tree

Internal nodes represent combined frequencies. Leaf nodes represent byte symbols.

Leaf node Internal node
Huffman tree will appear here.

Tree visualisation is limited to a readable depth. The underlying Huffman tree is generated from the complete byte-frequency distribution.

Huffman Codebook

Byte symbols and their generated binary codes

TOP 32 SYMBOLS
Byte Hex Frequency Huffman Code Code Length
Codebook data will appear here.

Compression Workflow

How the custom implementation processes model weights

01 Extract

Convert model tensors into a byte payload.

→
02 Count

Calculate the frequency of each byte.

→
03 Build

Construct the Huffman tree using a min-heap.

→
04 Encode

Generate binary codes and build the HUFC container.

→
05 Verify

Decode and compare the reconstructed payload.

INTEGRITY CHECK

Lossless Verification

Confirm that compression and decompression preserve the original model exactly.

EXACT RECONSTRUCTION
✓

Lossless reconstruction

The decompressed payload should reproduce the original parameter bytes without modification.

Verification Results

Results from the actual integration pipeline

Byte-level equality Original payload versus decoded payload
--
Tensor weight equality Original model parameters versus reconstructed parameters
--
Prediction equality Original model versus restored model
--

Accuracy Preservation

MNIST test-set accuracy comparison

Original model --
Restored model --

Equal predictions and equal reconstructed weights demonstrate that decompression preserves the model.

EXECUTION METRICS

Performance Analysis

Measure the time required for Huffman encoding and decoding.

EXECUTION TIME
Encoding Time -- Time to construct and encode the container
Decoding Time -- Time to decode the compressed container

Execution Time Comparison

Encoding versus decoding duration

Encoding --
Decoding --

Execution times depend on the hardware and system load.

ABOUT THE PROJECT

Project Details

Technical overview of the model compression system.

DATA STRUCTURES & ALGORITHMS

Model Compression using Huffman Coding

A lossless model-weight compression system that implements Huffman coding from scratch and applies it to a trained MNIST neural network.

Dataset MNIST Handwritten digit recognition
Model Architecture 784 → 128 → 64 → 10 Fully connected neural network
Algorithm Huffman Coding Lossless entropy encoding
Container Format HUFC Custom compressed file format

Core Data Structures

Implemented as part of the project

Min Heap Efficient minimum-frequency extraction
Binary Tree Huffman tree construction
Dictionary Frequency table and codebook mapping
Bitstream Binary encoding and decoding

Technology Stack

Tools and libraries used

Python PyTorch NumPy Flask HTML CSS JavaScript