As the need for neural network-based applications to become more accurate and powerful grows, so too does their size and memory footprint. With embedded devices, whose cache and RAM are limited, this growth hinders their ability to leverage state-of-the-art neural network architectures. In this work, we propose LegoNet, a compression technique that constructs blocks of weights of the entire model regardless of layer type and clusters these induced blocks. Using blocks instead of individual values to cluster the weights, we were able to compress ResNet-50 trained for Cifar-10 and ImageNet with only 32 4x4 blocks, compressing the memory footprint by over a factor of 64x without having to remove any weights or changing the architecture and no loss to accuracy, nor retraining or any data, and show how to find an arrangement of 16 4x4 blocks that gives a compression ratio of 128x with less than 3% accuracy loss. This was all achieved with no need for (re)training or fine-tuning.
Figures & tables
Fig. 1 : An overview of LegoNet algorithm. First a trained model’s weight matrices are chunked into blocks, or Legos. Then the Legos are clustered into groups. Then the blocks are replaced by the index of the cluster they belong to. At inference time, the centroid representative of this cluster is used as the weight values.
Fig. 2 : A comparison of memory consumption (blue bars) and the size of memory available in the STM32F7 micro-controller (red dotted line). VGG16 is compared to compressed versions, such as (1) Basis [ 11 ] , (2) MBA [ 18 ] , (3) CRELU [ 18 ] , (4) CIRC [ 18 ] and our method, LegoNet (5). Even though others may reduce other attributes (runtime, FLOPs, etc.) only LegoNet gets the model small enough to fit into the main memory.
Fig. 3 : Analysis of K values for a given b value, M and dataset. Note, b=4 is the best for almost all models used in terms of compression ratio for a given accuracy tolerance.
Model
Dataset
Baseline
LegoNet-A
LegoNet-C
VGG16
CIFAR10
90.02
90.07
87.62
VGG16
ImageNet
71.59
71.57
68.96
VGG19
CIFAR10
90.03
90.44
89.60
VGG19
ImageNet
72.38
72.45
70.39
ResNet-18
CIFAR10
83.70
83.44
81.61
ResNet-18
ImageNet
69.76
69.21
67.66
TABLE I: Top-1 accuracies for each model and dataset before and after applying LegoNet. LegoNet accuracies are reported for the best K value with regards to accuracy as well as the lowest K value with maximal accuracy.
Fig. 4 : Accuracy for a variety of K values (orange line) compared to the baseline (blue line).
Method
CR
Accuracy Loss
LegoNet-A
64
0%
LegoNet-C
128
2.8%
MMSE [ 1 ]
8
1.7%
DC [ 6 ]
49
0%
LSSQ [ 2 ]
49
3.2%
ARQ [ 19 ]
26
0%
TABLE II : Compression Rate (CR) comparison versus other compression methods using the Imagenet dataset on the ResNet-50 model. All values that are not our results were taken from the paper directly.
We present \LegoLM{}, a structured weight-sharing compression framework for large language models grounded in a systematic study of why global weight sharing fails and how to fix it. We identify two distinct failure modes. Distributional mismatch: for vector blocks of dimension d <= 2, transformer layers with heterogeneous weight scales impose a scale-mismatch penalty that grows linearly with d and cannot be resolved by increasing K, producing perplexity in the millions.Outlier dominance: for scalar blocks, a fraction ~1/K of weights lies beyond the outermost Lloyd-Max decision threshold and cannot be represented by any centroid; their misrepresentation accumulates across layers, causing catastrophic quality loss. \LegoLM{} resolves both failure modes via three data-free adaptations: 1 scalar-block encoding to eliminate the d-linear mismatch component, 2 percentile-selective replacement that identifies and preserves outlier weights verbatim, and 3 boundary-layer protection for the first and last transformer blocks. Across GPT-2 small (124M) and Mistral-7B, \LegoLM{} achieves +0.03% PPL degradation at 4.41X compression on Mistral-7B - outperforming PTQ-8bit in both quality and compression ratio - and -0.02% at 2.67X. Downstream evaluation on LAMBADA and HellaSwag confirms that \LegoLM{} at K=64, p=99% preserves accuracy within noise at 5.12 X compression, exceeding PTQ-8bit's compression ratio while matching its accuracy. We further discover that outlier dominance grows with model scale: full replacement at K=128 degrades GPT-2 small by only +23% but catastrophically degrades Mistral-7B by +1,134,279%, while selective replacement at p=99% rescues both models to under +15%. A controlled ablation confirms that selective replacement is the dominant mechanism: adding it to per-layer K-means also yields near-lossless quality, matching \LegoLM{} within 0.02%.
Joseph Bingham
Deparment of Biology, Technion – Israel Institute of Technology
Lossless compression can reduce the storage and movement of model weights without changing their floating-point values, but repeated statistical analysis and code construction add computational overhead. We study whether the statistical structure of exponents can be prepared once and reused. For this, we introduce NeuralZip, which groups chunks with similar exponent distributions, shares Huffman codes, and selectively represents recurring exponent tuples using packed exponents, thereby achieving additional moderate compression ratios. A setup chooses these representations before subsequent encodings, while every encoding still processes the current tensor values. In floating-point model checkpoints, post-setup compression is 1.81-21.33× faster than the baselines and achieves exact bit-to-bit reconstruction. We show that this setup can be precomputed and transferred from another compatible architecture, preserving similar compression ratios and avoiding the need to amortize setup costs. Therefore, compression adaptation is transferable and reusable. Training checkpoints demonstrate continued reuse as the weights evolve. Finally, GPU experiments reduce active memory usage by up to 27.5% while reproducing the logits exactly.
Martín Bravo, Samuel Horváth, Gonzalo Navarro +1
Mohamed bin Zayed University of Artificial Intelligence, Abu Dhabi, UAE · Department of Computer Science, University of Chile, Santiago, Chile · National Center for Artificial Intelligence (CENIA), Santiago, Chile
Neural network weights are increasingly a bottleneck for deployment, yet most compression pipelines treat layers independently and overlook cross-layer redundancy induced by function-preserving symmetries. We propose Motion-Compensated Weight Compression (MCWC), a weight-only codec that aligns permutation-symmetric blocks (e.g., hidden units and attention heads) to maximize cross-layer correspondence, turning depth into a predictable sequence. In the aligned coordinate system, MCWC uses a lightweight layer-sequential predictor with periodic keyframes and encodes only quantized prediction residuals using a learned entropy model trained under a rate distortion objective. A simple decoder reconstructs deployable weights by entropy decoding, dequantization, predictor-driven reconstruction, and inverse alignment, enabling fast weight materialization for inference. Across Transformer language modeling and vision classification, MCWC improves the rate accuracy Pareto frontier over strong quantization and learned weight-codec baselines, while maintaining competitive decode time. Ablations confirm that alignment, prediction, entropy modeling, and keyframe scheduling are each necessary for the full gains. Our code is available via https://github.com/Ism-ail11/MCWC.
Ismail Lamaakal
Multidisciplinary Faculty of Nador · Mohammed Premier University · Oujda 60000, Morocco