Nerve: Technical Reference Manual — A Zero-Dependency Single-Header Multilayer Perceptron Library for ANSI C
Year: 2026
Type: report
Abstract: 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.
Author: Küçükkarakurt, Fatih
Institution: Izmir Kâtip Çelebi University
Language: English
Subfield: Artificial Intelligence
Field: Computer Science
Domain: Physical Sciences
Open Access status: gold
OpenAlex ID: W7162683471
Cites:
Cited by:
Related to:
