NeuralDelphi

Download NeuralDelphi
A high-performance, pure Delphi machine learning framework. No Python. No external DLLs. Just fast, native code.
✨ Features
🚀 Arena-Based Memory — Zero allocation/deallocation during training
⚡ SIMD Assembly — AVX-512 and SSE kernels with CPUID auto-detection
🔄 Automatic Differentiation — Full autograd with computation graphs
🧵 Thread Pool Parallelization — Efficient multi-core utilization
📦 Zero Dependencies — Pure Delphi, compiles standalone
🎛️ N-Dimensional Tensors — Full Shape/Strides support for any dimensionality
📡 Broadcasting — NumPy-style automatic shape broadcasting
🔢 Batch Operations — Batched matrix multiplication for 3D+ tensors
📊 Training Visualization — Live loss charts and confusion matrices
💾 Model Persistence — Save/Load trained models to disk
Component Details
ML.Arena.pas - Memory Management
The foundation of NeuralDelphi's performance. Implements a linear allocator (also called a "bump allocator" or "arena allocator") that pre-allocates a large contiguous block of memory.
Key Concepts:
TMemPtr: An Integer index into the arena, not a pointer. This avoids pointer arithmetic issues and makes the system 32/64-bit agnostic.
TArena.Alloc(Count): O(1) allocation - just increments the head pointer. No free lists, no fragmentation.
TArena.Reset(): O(1) deallocation - sets head to 0. All memory is "freed" instantly.
GetSavePoint() / Restore(): Critical for the graph architecture. Allows resetting only temporary activations while keeping persistent parameters.
Why This Matters: Traditional GetMem/FreeMem calls are expensive (kernel calls, heap fragmentation). During training, you might allocate millions of temporary tensors. The arena eliminates this overhead entirely.