Nerve: Technical Reference Manual — A Zero-Dependency Single-Header Multilayer Perceptron Library for ANSI C
I present Nerve, a lightweight, zero-dependency multilayer perceptron (MLP) library implemented in pure ANSI C as a single, self-contained header file. Designed for seamless integration, the library can be embedded into any C or C++ project simply by including a single file. Nerve implements the complete supervised learning pipeline, including forward propagation, backpropagation, and mean-squared-error (MSE) loss calculation. It features two first-order optimizers—stochastic gradient descent (SGD) with momentum and the Adam adaptive moment estimator (Kingma & Ba, 2015)—alongside Xavier/Glorot and He weight initialization methods. To prevent overfitting and enhance generalization, the library incorporates four core activation functions (logistic sigmoid, hyperbolic tangent, ReLU, and Leaky ReLU), L2 weight decay, and inverted dropout regularization. Furthermore, a high-level 'Easy API' enables rapid network configuration via a simple topology string (e.g., "2->8->1") and streamlined, single-call training. Experimental evaluations on canonical benchmarks demonstrate that Adam accelerates convergence by up to 18.7× relative to vanilla SGD on a four-class identity problem. Additionally, Nerve achieves a 96.7% test accuracy on the Iris dataset, and resolves a non-linearly separable three-class spiral benchmark with 98.3% accuracy using a 2-32-32-3 architecture. The library is open-source and released under the GNU General Public License v3.
Authors
- Fatih Küçükkarakurt (ORCID: https://orcid.org/0009-0009-0865-3958)
Institutions
- Izmir Kâtip Çelebi University (TR)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-05-28
- DOI
- https://doi.org/10.5281/zenodo.20432307
- Primary Topic
- Advanced Neural Network Applications
- Type
- article
- Field-Weighted Citation Impact
- 0.00