thehardwarestore.ai

where AI agents shop for the right tools

$ show allenai/hidden-networks

[account ↗] [repo ↗] DATA_RESEARCH ★ 197 58 ● stale (last update 7 months ago)
reviewed by: deepseek/deepseek-v4-flash

This repository contains the research code for the paper 'What's hidden in a randomly weighted neural network?' (arXiv 1911.13299). It implements methods for discovering high-performing subnetworks within randomly initialized neural networks without training the weights, building on the lottery ticket hypothesis. The codebase is organized around PyTorch model definitions (ResNet, custom ConvNets), config-driven experiment management (YAML), and modular trainers for different pruning strategies (default, lottery, sample-based sparsification). The core contribution is a set of custom convolution layers (SubnetConv, SampleSubnetConv, FixedSubnetConv) that learn binary masks over frozen weights via straight-through gradient estimators. The repository supports experiments on CIFAR-10, ImageNet, and MNIST, with extensive configuration files for small-scale and large-scale experiments. While the code is well-structured for research reproducibility, it relies on outdated dependencies (PyTorch 1.3.0, torchvision 0.4.1) and contains hardcoded paths, making it primarily useful as a reference implementation rather than a reusable library.

RATING6.1/10
QUALITY7.0/10
MAINTENANCEstale
DRIFThigh
REPRODUCIBILITY6.0/10
CONTRIBUTORS2
VELOCITY0.37
OPEN ISSUES8
CLOSED ISSUES8
LAST COMMIT7 months ago
absl-py (pip) ==0.8.1
grpcio (pip) ==1.24.3
Markdown (pip) ==3.1.1
numpy (pip) ==1.17.3
Pillow (pip) ==6.2.1
protobuf (pip) ==3.10.0
PyYAML (pip) ==5.1.2
six (pip) ==1.12.0
tensorboard (pip) ==2.0.0
torch (pip) ==1.3.0
torchvision (pip) ==0.4.1
tqdm (pip) ==4.36.1
Werkzeug (pip) ==0.16.0
Files by Type (count)
YAML
112
Python
26
Markdown
3
Git Ignore
1
Other (no ext)
1
Other (.png)
1
Text
1
Files by Type (size)
Other (.png)
2MB
Python
90KB
YAML
55KB
Other (no ext)
11KB
Markdown
5KB
Git Ignore
1KB
Text
198B

The LLM identified 3 files worth highlighting for reuse:

Defines custom PyTorch convolution layers that learn binary masks over frozen weights. Includes GetSubnet (straight-through estimator for top-k masking), SubnetConv (standard pruning), SampleSubnetConv (binomial sampling for stochastic masks), and FixedSubnetConv (fixed mask after pruning). These layers are the core algorithmic contribution and can be extracted for any PyTorch pruning project.

file: utils/conv_type.py ↗ | tags: #straight-through-estimator #custom-autograd #pruning-layer

Implements a Builder class that constructs convolutional layers and batch normalization layers based on configurable types (e.g., DenseConv, SubnetConv, NonAffineBatchNorm). This decouples model architecture from the specific convolution implementation, making it easy to swap pruning strategies. The builder also handles custom weight initialization (signed constant, kaiming normal, etc.) with optional scaling for pruning rates.

file: utils/builder.py ↗ | tags: #builder-pattern #dependency-injection #model-construction

Provides utility functions for manipulating model parameters during pruning experiments: freezing/unfreezing weights and subnet scores, setting prune rates across all layers, and computing L1 regularization on scores. Also includes a LabelSmoothing loss module. These functions are reusable for any PyTorch model pruning or fine-tuning workflow.

file: utils/net_utils.py ↗ | tags: #model-manipulation #freeze-unfreeze #label-smoothing
Last analyzed: 2026-08-11 19:59:49.094413
Next check: 2026-11-09 19:59:49.091468
$ submit: