Skip to main content

Neural Network Dataset

Project description

Neural Network Dataset

GitHub release
short alias lmur

LEMUR - Learning, Evaluation, and Modeling for Unified Research

The original version of the LEMUR dataset was created by Arash Torabi Goodarzi, Roman Kochnev and Zofia Antonina Bentyn at the Computer Vision Laboratory, University of Würzburg, Germany.

Contents

  1. 📖 Overview
  2. Installation
  3. Usage
  4. 💻 API: Programmatic Access
  5. 🐳 Docker
  6. Environment for NN Dataset Contributors
  7. Contribution
  8. Available Modules
  9. Citation
  10. Licenses

📖 Overview

NN Dataset project provides flexibility for dynamically combining various deep learing tasks, datasets, metrics, and neural network models. It is designed to facilitate the verification of neural network performance under various combinations of training hyperparameters and data transformation algorithms, by automatically generating performance statistics. Developed to support the NNGPT project, this dataset contains neural network models modified or generated by NNGPT's large language models, with names featuring alphanumeric postfixes (e.g., C10C-ResNetTransformer-e2b49b871c8b9a9014277a51b2348999).

Create and Activate a Virtual Environment (recommended)

For Linux/Mac:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip

For Windows:

python3 -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip

It is assumed that CUDA 12.6 is installed; otherwise, consider replacing 'cu126' with the appropriate version. Some neural network training tasks require GPUs with at least 24 GB of memory.

Installation or Update of the NN Dataset with pip

Remove an old version of the LEMUR Dataset and its database:

pip uninstall nn-dataset -y
rm -rf db

Installing the stable version:

pip install --no-cache-dir nn-dataset --upgrade --extra-index-url https://download.pytorch.org/whl/cu126

Installing from GitHub to get the most recent code and statistics updates:

pip install git+https://github.com/ABrain-One/nn-dataset --upgrade --force --extra-index-url https://download.pytorch.org/whl/cu126

Adding functionality to export data to Excel files and generate plots for analyzing neural network performance:

pip install nn-dataset[stat] --upgrade --extra-index-url https://download.pytorch.org/whl/cu126

and export/generate:

python -m ab.stat.export

Usage

Standard use cases:

Run the automated training process for this model (e.g., a new ComplexNet training pipeline configuration):

python -m ab.nn.train -c img-classification_cifar-10_acc_ComplexNet

or for all image segmentation models using a fixed range of training parameters and transformer:

. train.sh -c img-segmentation -f echo --min_learning_rate 1e-4 -l 1e-2 --min_momentum 0.8 -m 0.99 --min_batch_binary_power 2 -b 6

train.sh internally calls ab.nn.train, offering a shorter way to run the program. Both scripts accept the same input flags and can be used interchangeably.

Reproducing Results with Fixed Training Parameters

To reproduce previously obtained results, provide fixed values for the training parameters in JSON format. The parameter names should match those returned by the supported_hyperparameters() function of the NN model.

Example command:

. train.sh -c img-classification_cifar-10_acc_ComplexNet -f complex -p '{"lr": 0.017, "momentum": 0.022 , "batch": 32}'

where:

-c specifies the training pipeline,

-f selects the preprocessing algorithm,

-p sets the hyperparameters explicitly (e.g., learning rate, momentum, batch size) using a JSON string.

To view supported flags:
. train.sh -h

Add your new neural network model to the ab/nn/nn directory and proceed with your experiments (see Contribution for details).

💻 API: Programmatic Access

The LEMUR NN Dataset API (ab.nn.api) is the dedicated programmatic interface for both querying validated deep learning experiment data and submitting new neural network configurations for automatic training and archival. It is the essential layer supporting modern AutoML systems, including the NNGPT framework.

Why the API is Important

The API solves the problem of costly and time-consuming model validation. By providing two distinct and powerful functions, it transforms the bottleneck of "waiting for results" into two key steps: instant query and automated validation.

  1. Enables Predictive Models: Access to the full historical data allows researchers to train performance prediction models that can estimate a model's final accuracy before any training begins, saving massive amounts of compute time.
  2. Facilitates LLM Feedback: The API acts as the crucial feedback mechanism for LLMs (like NNGPT). Generated architectures are validated via check_nn, and the results are immediately fed back into the dataset via data(), enabling the LLM to iteratively improve its quality based on its own outputs.

Data Extraction and Mechanism

The core value of the API is the ability to retrieve complete, validated experimental records and submit new code for verification.

1. The data() Function for Data Retrieval

def data(...) -> pandas.DataFrame
Data Type Extracted DataFrame Column Name Description
Model Python Code 'nn_code' The exact Python code (as a string) defining the neural network's architecture.
Hyperparameters 'prm' The exact dictionary of hyperparameters (e.g., {'lr': 0.01, 'momentum': 0.9}) used for this specific run.
Performance Metric 'accuracy' The metric value (e.g., accuracy) achieved in the experiment, recorded at the 'epoch' specified.
Execution Time 'duration' The wall-clock time required for the training run, ns.

Mechanism: Users filter the database using optional arguments (task, dataset, nn, etc.). The returned DataFrame allows external programs (such as statistical models or benchmark scripts) to easily consume the structured data for large-scale analysis. The optional only_best_accuracy=True ensures efficiency by returning only the best-performing trial for each unique configuration.

2. The check_nn() Function for NN Validation

def check_nn(nn_code: str, task: str, dataset: str, metric: str, prm: dict, ...) -> tuple[str, float, float, float]

This function is the submission endpoint for new models.

  1. Input: An external program (e.g., an LLM agent) provides the new model's nn_code (as a string), the prm dictionary, and the context (task, dataset, metric).
  2. Process: The function automatically initiates the full training pipeline, running the code under standardized conditions for a set duration (epoch_limit_minutes).
  3. Output: It returns a tuple containing the key validated metrics, ready for consumption by an LLM or an external optimization loop:
    • NN Model Name (str): An automatically generated unique ID for the archived model.
    • Accuracy (float): The measured final performance.
    • Accuracy to Time Metric (float): A single metric balancing performance against compute efficiency.
    • Quality of the Code Metric (float): A score assessing the structural integrity of the submitted code.

🚀 Get Started: Build Smarter, Train Less

The LEMUR API is designed for artificial agents, as well as for students and scientists. Using data(), provides immediate access to validated performance data derived from extensive computations. Instead of dedicating weeks of expensive hardware time to replicate known results or blindly test configurations, you can now:

  1. Data Access Scale: Instantly retrieve performance benchmarks validated across a large quantity of diverse architectural and hyperparameter configurations.
  2. Focus on Generation: Use check_nn() to automate the validation of your new, unique architectures.
  3. Computational Efficiency: Prioritize allocation of high-cost computational resources (GPU/TPU) exclusively toward training novel architectures.

🐳 Docker

All versions of this project are compatible with AI Linux and can be seamlessly executed within the AI Linux Docker container.

Example of training LEMUR neural network within the AI Linux container (Linux host):

Installing the latest version of the project from GitHub

docker run --rm -u $(id -u):ab -v $(pwd):/a/mm abrainone/ai-linux:cv bash -c "[ -d nn-dataset ] && git -C nn-dataset pull || git -c advice.detachedHead=false clone --depth 1 https://github.com/ABrain-One/nn-dataset"

Running a quick training script:

docker run --rm -u $(id -u):ab --shm-size=16G -v $(pwd)/nn-dataset:/a/mm abrainone/ai-linux:cv bash -c ". train.sh -c img-classification_cifar-10_acc_ComplexNet -f complex -l 0.017 --min_learning_rate 0.013 -m 0.025 --min_momentum 0.022 -b 7 --min_batch_binary_power 8 --max_batch_binary_power 9"

If recently added dependencies are missing in the AI Linux, you can create a container from the Docker image abrainone/ai-linux:cv, install the missing packages (preferably using pip install <package name>), and then create a new image from the container using docker commit <container name> <new image name>. You can use this new image locally or push it to the registry for deployment on the computer cluster.

Environment for NN Dataset Contributors

Pip package manager

Create a virtual environment, activate it, and run the following command to install all the project dependencies:

python -m pip install --upgrade pip
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu126

Contribution

To contribute a new neural network (NN) model to the NN Dataset, please ensure the following criteria are met:

  1. The code for each model is provided in a respective ".py" file within the /ab/nn/nn directory, and the file is named after the name of the model's structure.
  2. The main class for each model is named Net.
  3. The constructor of the Net class takes the following parameters:
    • in_shape (tuple): The shape of the first tensor from the dataset iterator. For images it is structured as (batch, channel, height, width).
    • out_shape (tuple): Provided by the dataset loader, it describes the shape of the output tensor. For a classification task, this could be (number of classes,).
    • prm (dict): A dictionary of hyperparameters, e.g., {'lr': 0.24, 'momentum': 0.93, 'dropout': 0.51}.
    • device (torch.device): PyTorch device used for the model training
  4. All external information required for the correct building and training of the NN model for a specific dataset/transformer, as well as the list of hyperparameters, is extracted from in_shape, out_shape or prm, e.g.:
    batch = in_shape[0]
    channel_number = in_shape[1]
    image_size = in_shape[2]
    class_number = out_shape[0]
    learning_rate = prm['lr']
    momentum = prm['momentum']
    dropout = prm['dropout'].
  5. Every model script has function returning set of supported hyperparameters, e.g.:
    def supported_hyperparameters(): return {'lr', 'momentum', 'dropout'}
    The value of each hyperparameter lies within the range of 0.0 to 1.0.
  6. Every class Net implements two functions:
    train_setup(self, prm)
    and
    learn(self, train_data)
    The first function initializes the criteria and optimizer, while the second implements the training pipeline. See a simple implementation in the AlexNet model.
  7. For each pull request involving a new NN model, please generate and submit training statistics for 100 Optuna trials (or at least 3 trials for very large models) in the ab/nn/stat directory. The trials should cover 5 epochs of training. Ensure that this statistics is included along with the model in your pull request. For example, the statistics for the ComplexNet model are stored in files <epoch number>.json inside folder img-classification_cifar-10_acc_ComplexNet, and can be generated by:
python run.py -c img-classification_cifar-10_acc_ComplexNet -t 100 -e 5

See more examples of models in /ab/nn/nn and generated statistics in /ab/nn/stat.

Available Modules

The NN Dataset includes the following key modules within the ab.nn package:

  • nn: Predefined neural network architectures, including models like AlexNet, ResNet, VGG, and more.
  • loader: Data loading utilities for popular datasets such as CIFAR-10, COCO, and others.
  • metric: Evaluation metrics supported for model assessment, such as accuracy, Intersection over Union (IoU), and others.
  • transform: A collection of data transformation algorithms for dataset preprocessing and augmentation.
  • stat: Statistics for different neural network model training pipelines.
  • util: Utility functions designed to assist with training, model evaluation, and statistical analysis.

Citation

If you find the LEMUR Neural Network Dataset to be useful for your research, please consider citing our article:

@article{ABrain.NN-Dataset,
  title={LEMUR Neural Network Dataset: Towards Seamless AutoML},
  author={Goodarzi, Arash Torabi and Kochnev, Roman and Khalid, Waleed and Qin, Furui and Uzun, Tolgay Atinc and Dhameliya, Yashkumar Sanjaybhai and Kathiriya, Yash Kanubhai and Bentyn, Zofia Antonina and Ignatov, Dmitry and Timofte, Radu},
  journal={arXiv preprint arXiv:2504.10552},
  year={2025}
}

Licenses

This project is distributed under the following licensing terms:

  • for neural network models adopted from other projects
  • all neural network models and their weights not covered by the above licenses, as well as all other files and assets in this project, are subject to the MIT license

The idea and leadership of Dr. Ignatov

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nn_dataset-2.1.1.tar.gz (26.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nn_dataset-2.1.1-py3-none-any.whl (103.0 MB view details)

Uploaded Python 3

File details

Details for the file nn_dataset-2.1.1.tar.gz.

File metadata

  • Download URL: nn_dataset-2.1.1.tar.gz
  • Upload date:
  • Size: 26.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for nn_dataset-2.1.1.tar.gz
Algorithm Hash digest
SHA256 46e04c62259cf650b70fb0e67a97829c46af6c05ae4a249ee14e03cc6a78bc5e
MD5 d9445c934019ff5e8d7527be1dbf11e4
BLAKE2b-256 a866267284c99b912f10826401f6491e71bf3e3ed4da889e69b90acf2a96c84d

See more details on using hashes here.

File details

Details for the file nn_dataset-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: nn_dataset-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 103.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for nn_dataset-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 643a5a7db7898c7d37a42d91d52e8065f979eeb5f49871cc5572dc61c406903e
MD5 8b04f3c252cba88469427bc15fa54a50
BLAKE2b-256 f334c06f686ee980340a00c0d138b218052eafec3a4a21787176445a4e7511d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page