CNet framework enables complex number neural networks with faster training
CNet: A Complex-Valued Deep Learning Framework with Wirtinger Autodifferentiation and FFT--Hadamard Convolution
Machine LearningMathematical Software
Summary
Training neural networks that use complex numbers can better match physical systems, but building and optimizing such networks is hard. The authors created CNet, a software framework that helps build and train these complex-valued networks efficiently using special math for complex numbers. They show that their method can match or beat traditional real-number networks on language tasks and can handle specific physics-related problems. This work highlights the potential for complex-valued networks to learn physical structures more accurately.
What this means in practice
- •For machine learning engineers: Build and train neural networks using complex numbers for applications that involve physical signals or wave phenomena, benefiting from efficient GPU support and gradient computation.
- •For signal processing teams: Develop faster and more physically accurate models for tasks like radio modulation classification or coherent diffraction imaging by leveraging complex-valued layers and convolutions.
Authors
Marcel Crasmaru
Abstract
CNet is a C++/CUDA framework for building and training deep complex-valued neural networks (CVNNs) and, more generally, for optimizing complex-valued functions by gradient descent with Wirtinger (CR-calculus) derivatives. It takes a physics-native stance: a network is a cascade of complex -- and often unitary (the DFT) -- operations acting on an amplitude vector, and classification is a Born-rule measurement $p_k = |z_k|^2 / \|z\|^2$ rather than a softmax over real logits. Every layer ships a CPU reference and a CUDA kernel checked against finite differences, and the computation graph is cloned across the batch for GPU execution. On top of the base layers we add signal-processing primitives that turn the identity conv(x,k) = IFFT(FFT(x) . FFT(k)) into a learnable complex convolutional network, together with a true-Adam optimizer and a reduced-memory inference mode. We report three studies. First, a fully complex-valued, FNet-style causal sequence model built on a new $O(N \log N)$ causal Fourier mixer -- a triangular-masked DFT evaluated by a Bluestein / chirp-z factorization: once properly tuned it matches or exceeds a parameter-matched real-valued causal FNet on character-level language modeling, reaching the real model's converged quality in under half the training steps. Second and third, bottleneck analyses on radio-modulation classification (RML2016.10a) and the Fourier phase problem of coherent-diffraction imaging, which isolate exactly where complex-valued networks still need new operators. Across all three the complex formulation provably learns the physically correct structure. Code: https://github.com/crasmarum/CNet