{"id":2010,"date":"2026-07-18T06:41:31","date_gmt":"2026-07-18T13:41:31","guid":{"rendered":"http:\/\/macdaddy4sure.ai\/?p=2010"},"modified":"2026-07-18T06:41:31","modified_gmt":"2026-07-18T13:41:31","slug":"mathnn","status":"publish","type":"post","link":"http:\/\/macdaddy4sure.ai\/index.php\/2026\/07\/18\/mathnn\/","title":{"rendered":"MathNN"},"content":{"rendered":"\n<p>MathNN is the native C++ neural-network subsystem inside _AugmentedIntelligence.<\/p>\n\n\n\n<p>It is designed for small-to-medium in-process models where the application needs<\/p>\n\n\n\n<p>local learning without sending every update to TensorFlow, CUDA, or a remote<\/p>\n\n\n\n<p>policy server.<\/p>\n\n\n\n<p>The main current use case is reinforcement learning: MathNN can act as a local<\/p>\n\n\n\n<p>value network, policy network, or DQN Q-network for systems such as Minecraft,<\/p>\n\n\n\n<p>driving RL, gaming RL, strategy agents, Life RL, and math tutoring domains.<\/p>\n\n\n\n<p><strong>RL hub:<\/strong> ReinforcementLearning.md (ReinforcementLearning.md) \u00b7 <strong>System map:<\/strong><\/p>\n\n\n\n<p>AugmentedIntelligenceSystems.md (AugmentedIntelligenceSystems.md) \u00b7 <strong>Life RL:<\/strong><\/p>\n\n\n\n<p>LifeRL.md (LifeRL.md)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What MathNN Is<\/h2>\n\n\n\n<p>MathNN is a compact neural-network framework implemented in the repository&#8217;s C++<\/p>\n\n\n\n<p>codebase. The dense network core supports analytic backpropagation, optimizers,<\/p>\n\n\n\n<p>checkpoint save\/load, and command-line demos.<\/p>\n\n\n\n<p>MathNN is not meant to replace large model training stacks. Use CUDA, TensorFlow,<\/p>\n\n\n\n<p>TensorRT, ONNX Runtime, llama.cpp, or a remote policy server for large pretrained<\/p>\n\n\n\n<p>models, high-throughput vision models, LLMs, or heavy transformer training.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Core Files<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>File<\/strong><\/td><td><strong>Role<\/strong><\/td><\/tr><tr><td>MathNN.hpp \/ MathNN.cpp<\/td><td>Dense neural network core, activations, losses, optimizers, dropout, save\/load.<\/td><\/tr><tr><td>MathNNLayers.hpp \/ MathNNLayers.cpp<\/td><td>Conv2D, max pooling, layer norm, RNN, LSTM forward path, and attention forward path.<\/td><\/tr><tr><td>MathNNDevice.hpp \/ MathNNDevice.cpp<\/td><td>CPU\/GPU\/NPU\/APU\/Remote placement, probe, bench, agent overrides.<\/td><\/tr><tr><td>MathNNLearning.hpp \/ MathNNLearning.cpp<\/td><td>Domain learning functions: prefer, transfer, distill, scale, federate, \u2026<\/td><\/tr><tr><td>MathNNFeatures.hpp \/ MathNNFeatures.cpp<\/td><td>User-facing nn commands, Lua registration, and _NNPolicy.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>See also: MathNNLearningFunctions.md (MathNNLearningFunctions.md) \u00b7 MathDE.md (MathDE.md) \u00b7 BuildConfigurations.md (BuildConfigurations.md) \u00b7 RealityConstruct.md (RealityConstruct.md) \u00b7 SpaceEngineersRL.md (SpaceEngineersRL.md)<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>RLNeural.hpp<\/strong><strong> \/ <\/strong><strong>RLNeural.cpp<\/strong><\/td><td><strong>In-process learners: DQN, dueling DQN, actor-critic, bandit, hierarchical, multi-head dueling, reward model, world model.<\/strong><\/td><\/tr><tr><td>RLAgentNet.hpp \/ RLAgentNet.cpp<\/td><td>Per-agent neural policy registry with aux reward\/world models, checkpoint meta, Q\/loss\/feedback commands.<\/td><\/tr><tr><td>LifeRL.hpp \/ LifeRL.cpp<\/td><td>Advisory multi-domain &#8220;life&#8221; RL on MathNN (sleep, focus, chores, \u2026).<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">What It Can Do<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Dense Networks<\/h3>\n\n\n\n<p>The _NN class can build stacked dense networks:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add dense layers with configurable input\/output sizes.<\/li>\n\n\n\n<li>Choose layer activations.<\/li>\n\n\n\n<li>Run forward inference with Predict.<\/li>\n\n\n\n<li>Train with supervised TrainStep.<\/li>\n\n\n\n<li>Save and load model weights.<\/li>\n\n\n\n<li>Report parameter count and network summaries.<\/li>\n<\/ul>\n\n\n\n<p>Supported activations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Linear<\/li>\n\n\n\n<li>ReLU<\/li>\n\n\n\n<li>LeakyReLU<\/li>\n\n\n\n<li>Sigmoid<\/li>\n\n\n\n<li>Tanh<\/li>\n\n\n\n<li>GELU<\/li>\n\n\n\n<li>Softmax<\/li>\n<\/ul>\n\n\n\n<p>Supported losses:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>MSE<\/li>\n\n\n\n<li>CrossEntropy<\/li>\n\n\n\n<li>BCE<\/li>\n<\/ul>\n\n\n\n<p>Supported optimizers:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SGD<\/li>\n\n\n\n<li>Momentum<\/li>\n\n\n\n<li>Adam<\/li>\n<\/ul>\n\n\n\n<p>Additional dense-network features:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Inverted dropout during training.<\/li>\n\n\n\n<li>Fused stable gradients for softmax plus cross entropy.<\/li>\n\n\n\n<li>Fused stable gradients for sigmoid plus binary cross entropy.<\/li>\n\n\n\n<li>Xavier\/Glorot-style initialization for dense layers.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Architecture Layers<\/h3>\n\n\n\n<p>MathNNLayers adds lower-level neural building blocks:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Component<\/strong><\/td><td><strong>Capability<\/strong><\/td><\/tr><tr><td>_Conv2D<\/td><td>Forward pass, backward pass, trainable weights, explicit channel-first image tensors.<\/td><\/tr><tr><td>_MaxPool2D<\/td><td>Forward pass and backward pass with cached argmax locations.<\/td><\/tr><tr><td>_LayerNorm<\/td><td>Forward pass, backward pass, trainable gamma\/beta.<\/td><\/tr><tr><td>_RNNCell<\/td><td>Elman RNN forward steps plus sequence training with backprop-through-time.<\/td><\/tr><tr><td>_LSTMCell<\/td><td>Forward\/inference path. Local BPTT training is not exposed; route larger LSTM training to a remote trainer.<\/td><\/tr><tr><td>_Attention<\/td><td>Scaled dot-product attention and multi-head attention forward\/inference, with optional causal masking.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Tensor convention for image-like layers is flat row-major storage with explicit<\/p>\n\n\n\n<p>shapes. Images use channels-first layout: C * H * W.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">RL Policy Adapter<\/h3>\n\n\n\n<p>_NNPolicy wraps _NN as a value or policy network:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>ActionValues(state) returns Q-values for all actions.<\/li>\n\n\n\n<li>GreedyAction(state) picks the highest-valued action.<\/li>\n\n\n\n<li>UpdateQ(state, action, target) trains one selected action toward a target.<\/li>\n\n\n\n<li>Save(path) and Load(path) persist the policy.<\/li>\n<\/ul>\n\n\n\n<p>The default policy shape is:<\/p>\n\n\n\n<p><em>[text]<br><\/em>state_dim -&gt; hidden ReLU -&gt; hidden ReLU -&gt; action_dim Linear<\/p>\n\n\n\n<p>This is enough for many DQN-style value functions where the network predicts one<\/p>\n\n\n\n<p>Q-value per action.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">In-Process DQN<\/h3>\n\n\n\n<p>_NNQLearner builds a local DQN around _NNPolicy:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Online network.<\/li>\n\n\n\n<li>Target network.<\/li>\n\n\n\n<li>Replay buffer.<\/li>\n\n\n\n<li>Epsilon-greedy action selection.<\/li>\n\n\n\n<li>TD target training: reward + gamma * max(Q(next_state)).<\/li>\n\n\n\n<li>Target network sync.<\/li>\n\n\n\n<li>Checkpoint save\/load.<\/li>\n<\/ul>\n\n\n\n<p>_RLNeural::TrainDQN provides a training loop over any RLEnv implementation.<\/p>\n\n\n\n<p>That makes MathNN reusable across game, robotics, driving, and knowledge<\/p>\n\n\n\n<p>environments when those environments expose state, action, reward, and terminal<\/p>\n\n\n\n<p>signals.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Per-Agent Neural Registry<\/h3>\n\n\n\n<p>_RLAgentNet lets individual agents opt into a MathNN-backed learner without<\/p>\n\n\n\n<p>rewriting their existing heuristic or tabular paths.<\/p>\n\n\n\n<p><strong>Primary modes:<\/strong> dqn, dueling-dqn, actor-critic, bandit,<\/p>\n\n\n\n<p>hierarchical, multihead-dueling, worldmodel (dueling + curiosity),<\/p>\n\n\n\n<p>reward-model (bandit + preference head).<\/p>\n\n\n\n<p><strong>Auxiliary (combinable):<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Reward model: rl net rm &lt;agent> on, rl net reward &lt;agent> good|bad, rl net blend &lt;agent> 0.7<\/li>\n\n\n\n<li>World model \/ curiosity: rl net wm &lt;agent> on, rl net curiosity &lt;agent> 0.05<\/li>\n<\/ul>\n\n\n\n<p>Supported agent examples:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>minecraft, driving, gaming_fps, strategy<\/li>\n\n\n\n<li>life, life_sleep_routine, life_focus_blocks, \u2026<\/li>\n\n\n\n<li>math tutoring domains, human, cybernetic, desktop_support<\/li>\n<\/ul>\n\n\n\n<p>Checkpoints write a .meta sidecar (mode, dims) plus optional .rm \/ .wm files.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Life RL<\/h3>\n\n\n\n<p>Advisory multi-domain daily-living RL (LifeRL). Synthetic smoke by default;<\/p>\n\n\n\n<p>sensitive domains (mood, budget, social) are bandit\/preference oriented and never<\/p>\n\n\n\n<p>auto-execute external side effects. See docs\/LifeRL.md.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Commands<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Mathematics RL Domains (MathNN)<\/h3>\n\n\n\n<p>Six STEM tutoring domains train MathNN DQN policies over safe synthetic<\/p>\n\n\n\n<p>curriculum environments (category mathematics). Each domain maps tutoring<\/p>\n\n\n\n<p>actions (simplify, apply theorem, hypothesis test, etc.) into the shared<\/p>\n\n\n\n<p>eight-value observation used by the RL curriculum smoke envs.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Domain ID<\/strong><\/td><td><strong>Subject<\/strong><\/td><\/tr><tr><td>math_algebra<\/td><td>Algebra<\/td><\/tr><tr><td>math_geometry<\/td><td>Geometry<\/td><\/tr><tr><td>math_trigonometry<\/td><td>Trigonometry<\/td><\/tr><tr><td>math_probability_statistics<\/td><td>Probability and Statistics<\/td><\/tr><tr><td>math_linear_algebra<\/td><td>Linear Algebra<\/td><\/tr><tr><td>math_finite_math<\/td><td>Finite Math<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><em>[text]<br><\/em>nn math domains<br>nn math domain math_algebra<br>nn math smoke mathematics 8 72<br>nn math train math_algebra 200<br>nn math net enable math_algebra<br>rl net save math_algebra checkpoints\/math_algebra_mathnn.txt<br>rl curriculum domains mathematics<br>rl curriculum smoke math_trigonometry 8 78<\/p>\n\n\n\n<p>Aliases: algebra, geometry, trigonometry, probability_statistics,<\/p>\n\n\n\n<p>linear_algebra, finite_math, and mathematics (smoke all six).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">MathNN Demos<\/h3>\n\n\n\n<p>Run these in the _AugmentedIntelligence command interface:<\/p>\n\n\n\n<p><em>[text]<br><\/em>nn status<br>nn demo<br>nn conv-demo<br>nn rnn-demo<br>nn attn-demo<\/p>\n\n\n\n<p>Command behavior:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Command<\/strong><\/td><td><strong>What it tests<\/strong><\/td><\/tr><tr><td>nn status<\/td><td>Confirms the MathNN command surface is registered.<\/td><\/tr><tr><td>nn demo<\/td><td>Trains a small dense network on XOR with BCE and Adam. This is the main smoke test for dense forward\/backprop\/training.<\/td><\/tr><tr><td>nn conv-demo<\/td><td>Runs Conv2D and MaxPool over an 8&#215;8 input and prints output shapes.<\/td><\/tr><tr><td>nn rnn-demo<\/td><td>Trains a small RNN echo task and prints loss movement.<\/td><\/tr><tr><td>nn attn-demo<\/td><td>Runs multi-head causal attention over a small sequence.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Lua surface:<\/p>\n\n\n\n<p><em>[text]<br><\/em>ai_nn_xor_demo()<\/p>\n\n\n\n<p>This runs the XOR demo and returns the final loss.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">RLAgentNet Commands<\/h3>\n\n\n\n<p><em>[text]<br><\/em>rl net status<br>rl net modes<br>rl net enable &lt;agent&gt;<br>rl net disable &lt;agent&gt;<br>rl net mode &lt;agent&gt; &lt;dqn|dueling-dqn|actor-critic|bandit|hierarchical|multihead-dueling|worldmodel|reward-model&gt;<br>rl net save &lt;agent&gt; &lt;path&gt;<br>rl net load &lt;agent&gt; &lt;path&gt;<br>rl net q &lt;agent&gt; [top_k]<br>rl net loss &lt;agent&gt;<br>rl net reward &lt;agent&gt; good|bad|&lt;n&gt;<br>rl net blend &lt;agent&gt; &lt;alpha&gt;<br>rl net curiosity &lt;agent&gt; &lt;scale&gt;<br>rl net wm &lt;agent&gt; on|off<br>rl net rm &lt;agent&gt; on|off<\/p>\n\n\n\n<p>Examples:<\/p>\n\n\n\n<p><em>[text]<br><\/em>rl net enable driving<br>rl net mode gaming_fps actor-critic<br>rl net wm minecraft on<br>rl net curiosity minecraft 0.05<br>rl net reward gaming_fps good<br>rl net save driving checkpoints\/driving_mathnn.txt<br>rl net load driving checkpoints\/driving_mathnn.txt<br>rl cartpole 50 dueling curiosity<br>life rl smoke sleep_routine 12<br>life rl suggest focus_blocks<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Minecraft MathNN Commands<\/h3>\n\n\n\n<p>The Minecraft DQN subsystem can use MathNN through its neural-net mode:<\/p>\n\n\n\n<p><em>[text]<br><\/em>minecraft dqn net on<br>minecraft dqn net off<br>minecraft dqn net status<br>minecraft dqn net save &lt;path&gt;<br>minecraft dqn net load &lt;path&gt;<\/p>\n\n\n\n<p>Executive Functions (high-level setup steps each train\/eval tick):<\/p>\n\n\n\n<p><em>[text]<br><\/em>minecraft dqn plan on<br>minecraft dqn plan detail<br>minecraft dqn plan next 2<br>minecraft dqn plan status<\/p>\n\n\n\n<p>Typical Minecraft startup sequence:<\/p>\n\n\n\n<p><em>[text]<br><\/em>minecraft dqn observe<br>minecraft dqn dry-run<br>minecraft dqn plan on<br>minecraft dqn goal mine iron_ore<br>minecraft dqn net on<br>minecraft dqn net status<br>minecraft dqn train 1000<\/p>\n\n\n\n<p>Use short training runs first. Stop and inspect behavior before letting it run<\/p>\n\n\n\n<p>for long periods:<\/p>\n\n\n\n<p><em>[text]<br><\/em>minecraft dqn off<br>minecraft dqn status<br>minecraft dqn net save minecraft_mathnn_checkpoint.txt<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How MathNN Fits Into RL<\/h2>\n\n\n\n<p>A MathNN-backed RL agent uses this loop:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The domain converts the current world into a numeric state vector.<\/li>\n\n\n\n<li>MathNN predicts Q-values for available actions.<\/li>\n\n\n\n<li>The agent chooses an action, often epsilon-greedy during training.<\/li>\n\n\n\n<li>The environment executes the action.<\/li>\n\n\n\n<li>The domain computes reward, next state, and terminal status.<\/li>\n\n\n\n<li>_NNQLearner stores the transition in replay memory.<\/li>\n\n\n\n<li>Training samples a minibatch and updates the online network.<\/li>\n\n\n\n<li>The target network is periodically synchronized.<\/li>\n\n\n\n<li>A checkpoint is saved after useful behavior appears.<\/li>\n<\/ol>\n\n\n\n<p>The most important part is the state\/reward\/action design. MathNN can only learn<\/p>\n\n\n\n<p>from the signals it is given. If the state vector does not show walls, velocity,<\/p>\n\n\n\n<p>health, objective distance, inventory, or other useful facts, the network cannot<\/p>\n\n\n\n<p>learn those facts. If the reward function pays the wrong behavior, the network<\/p>\n\n\n\n<p>will optimize the wrong behavior.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Current Capability Matrix<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Area<\/strong><\/td><td><strong>Status<\/strong><\/td><td><strong>Notes<\/strong><\/td><\/tr><tr><td>Dense MLP inference<\/td><td>Available<\/td><td>_NN::Predict.<\/td><\/tr><tr><td>Dense MLP training<\/td><td>Available<\/td><td>_NN::TrainStep.<\/td><\/tr><tr><td>Activations<\/td><td>Available<\/td><td>Linear, ReLU, LeakyReLU, Sigmoid, Tanh, GELU, Softmax.<\/td><\/tr><tr><td>Losses<\/td><td>Available<\/td><td>MSE, cross entropy, BCE.<\/td><\/tr><tr><td>Optimizers<\/td><td>Available<\/td><td>SGD, Momentum, Adam.<\/td><\/tr><tr><td>Dropout<\/td><td>Available<\/td><td>Training-time inverted dropout.<\/td><\/tr><tr><td>Save\/load<\/td><td>Available<\/td><td>Native MathNN checkpoint format.<\/td><\/tr><tr><td>Conv2D<\/td><td>Available<\/td><td>Forward\/backward implemented; gradient-check before production training.<\/td><\/tr><tr><td>MaxPool2D<\/td><td>Available<\/td><td>Forward\/backward implemented.<\/td><\/tr><tr><td>LayerNorm<\/td><td>Available<\/td><td>Forward\/backward implemented.<\/td><\/tr><tr><td>RNN<\/td><td>Available<\/td><td>Elman RNN with BPTT sequence training.<\/td><\/tr><tr><td>LSTM<\/td><td>Forward only<\/td><td>Use remote trainer for full local sequence training needs.<\/td><\/tr><tr><td>Attention<\/td><td>Forward only<\/td><td>Scaled dot-product and multi-head inference helpers.<\/td><\/tr><tr><td>DQN<\/td><td>Available<\/td><td>_NNQLearner with online\/target nets and replay.<\/td><\/tr><tr><td>Dueling DQN<\/td><td>Available<\/td><td>_NNDuelingQLearner V+A.<\/td><\/tr><tr><td>Actor-critic<\/td><td>Available<\/td><td>_NNActorCriticLearner policy+value.<\/td><\/tr><tr><td>Bandit<\/td><td>Available<\/td><td>_NNBanditLearner.<\/td><\/tr><tr><td>Hierarchical RL<\/td><td>Available<\/td><td>skill manager + worker DQN.<\/td><\/tr><tr><td>Multi-head dueling<\/td><td>Available<\/td><td>skill-group advantages.<\/td><\/tr><tr><td>Reward model<\/td><td>Available<\/td><td>preference BCE + blend into Observe.<\/td><\/tr><tr><td>World model<\/td><td>Available<\/td><td>\u0394s+reward predict + curiosity bonus.<\/td><\/tr><tr><td>Life RL<\/td><td>Available<\/td><td>advisory multi-domain (life rl \u2026).<\/td><\/tr><tr><td>Per-agent neural policies<\/td><td>Available<\/td><td>RLAgentNet opt-in registry.<\/td><\/tr><tr><td>LLM behavior<\/td><td>Not MathNN<\/td><td>Use the LLM subsystem; MathNN can score states\/actions, not generate rich language.<\/td><\/tr><tr><td>Large CUDA training<\/td><td>Not MathNN<\/td><td>Use CUDA\/TensorFlow\/remote training for large models.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">What MathNN Is Good For<\/h2>\n\n\n\n<p>Use MathNN for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Local DQN value functions.<\/li>\n\n\n\n<li>Small supervised models.<\/li>\n\n\n\n<li>RL action scoring.<\/li>\n\n\n\n<li>Agent-specific policies.<\/li>\n\n\n\n<li>Lightweight experiments that should compile into _AugmentedIntelligence.<\/li>\n\n\n\n<li>Fast smoke tests for learning loops without external services.<\/li>\n\n\n\n<li>Simple RNN sequence experiments.<\/li>\n\n\n\n<li>Small perception experiments using Conv2D and pooling.<\/li>\n<\/ul>\n\n\n\n<p>Use another subsystem for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>LLM chat and reasoning.<\/li>\n\n\n\n<li>Image generation.<\/li>\n\n\n\n<li>Large CNNs or transformers.<\/li>\n\n\n\n<li>Production-scale CUDA training.<\/li>\n\n\n\n<li>Model import\/export pipelines such as ONNX.<\/li>\n\n\n\n<li>High-volume offline training jobs.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Practical Training Guidance<\/h2>\n\n\n\n<p>Start with the demos before training a domain:<\/p>\n\n\n\n<p><em>[text]<br><\/em>nn status<br>nn demo<br>nn conv-demo<br>nn rnn-demo<br>nn attn-demo<\/p>\n\n\n\n<p>Then validate the target domain without learning:<\/p>\n\n\n\n<p><em>[text]<br><\/em>minecraft dqn observe<br>minecraft dqn dry-run<\/p>\n\n\n\n<p>For any RL domain, verify:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>State values change when the world changes.<\/li>\n\n\n\n<li>Legal actions match what the agent can actually do.<\/li>\n\n\n\n<li>Rewards increase for intended progress.<\/li>\n\n\n\n<li>Terminal events are marked correctly.<\/li>\n\n\n\n<li>Safety shields and stop commands work.<\/li>\n<\/ul>\n\n\n\n<p>Only after that should you enable MathNN training:<\/p>\n\n\n\n<p><em>[text]<br><\/em>rl net enable &lt;agent&gt;<\/p>\n\n\n\n<p>or for Minecraft:<\/p>\n\n\n\n<p><em>[text]<br><\/em>minecraft dqn net on<br>minecraft dqn train 1000<\/p>\n\n\n\n<p>Save checkpoints when behavior improves:<\/p>\n\n\n\n<p><em>[text]<br><\/em>rl net save &lt;agent&gt; checkpoints\/&lt;agent&gt;_mathnn.txt<br>minecraft dqn net save minecraft_mathnn_checkpoint.txt<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Problem<\/strong><\/td><td><strong>Likely cause<\/strong><\/td><td><strong>What to check<\/strong><\/td><\/tr><tr><td>nn status is not recognized<\/td><td>Command dispatcher is not routing nn commands.<\/td><td>Check _MathNNFeatures::HandleSpeechCommand registration.<\/td><\/tr><tr><td>nn demo loss does not decrease<\/td><td>Training path, optimizer, or numeric issue.<\/td><td>Rebuild, rerun, and compare XOR predictions.<\/td><\/tr><tr><td>RL agent never improves<\/td><td>Bad state\/reward\/action wiring.<\/td><td>Inspect observations, rewards, terminal flags, and action execution before tuning the network.<\/td><\/tr><tr><td>Minecraft walks into walls<\/td><td>State\/action safety issue, not just a network issue.<\/td><td>Use minecraft dqn observe, minecraft dqn wall-guard on, and staged arenas.<\/td><\/tr><tr><td>Checkpoint load fails<\/td><td>Wrong path, incompatible model shape, or inactive agent.<\/td><td>Enable\/configure the same agent and use a matching checkpoint.<\/td><\/tr><tr><td>Training is unstable<\/td><td>Learning rate, reward scale, or exploration is too aggressive.<\/td><td>Lower learning rate, normalize rewards, reduce action space, and train in shorter sessions.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Safety Notes<\/h2>\n\n\n\n<p>MathNN can select actions automatically when connected to an RL domain. Treat<\/p>\n\n\n\n<p>live-control domains differently from simulations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Prefer simulation or dry-run first.<\/li>\n\n\n\n<li>Keep explicit stop commands available.<\/li>\n\n\n\n<li>Use safety shields for driving, robotics, Minecraft, and desktop control.<\/li>\n\n\n\n<li>Keep high-stakes domains in advisory, simulated, or human-approved modes.<\/li>\n\n\n\n<li>Do not deploy learned behavior directly into real-world control without<\/li>\n<\/ul>\n\n\n\n<p>&nbsp; independent validation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Short Summary<\/h2>\n\n\n\n<p>MathNN gives _AugmentedIntelligence a local neural-learning layer. It can train<\/p>\n\n\n\n<p>small dense networks, run several neural layer demos, act as a DQN value network,<\/p>\n\n\n\n<p>and provide opt-in neural policies for RL agents. Its strongest current role is<\/p>\n\n\n\n<p>local reinforcement learning support, especially when paired with carefully<\/p>\n\n\n\n<p>designed states, rewards, legal actions, and safety guards.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Multi-device placement (CPU \/ GPU \/ NPU \/ APU)<\/h2>\n\n\n\n<p>`&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ext<\/p>\n\n\n\n<p>nn device status<\/p>\n\n\n\n<p>nn device list<\/p>\n\n\n\n<p>nn device refresh<\/p>\n\n\n\n<p>nn device bench all 256<\/p>\n\n\n\n<p>nn device set global train gpu<\/p>\n\n\n\n<p>nn device set global infer npu<\/p>\n\n\n\n<p>nn device set global dtype fp16<\/p>\n\n\n\n<p>nn device set agent minecraft train gpu infer gpu<\/p>\n\n\n\n<p>nn device set agent life infer npu<\/p>\n\n\n\n<p>nn device resolve space_engineers<\/p>\n\n\n\n<p>nn device clear agent life<\/p>\n\n\n\n<p>`<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>CPU<\/strong> \ufffd MatrixAcceleration AVX\/AVX-512 GEMM (default, correctness).<\/li>\n\n\n\n<li><strong>GPU<\/strong> \ufffd CUDA probe + hybrid staged buffers (host GEMM until cuBLAS kernel lands).<\/li>\n\n\n\n<li><strong>NPU<\/strong> \ufffd env hints (OPENVINO_DEVICE, QNN_SDK_ROOT, DML_VISIBLE_DEVICES); placeholder GEMM + ONNX EP path later.<\/li>\n\n\n\n<li><strong>APU<\/strong> \ufffd hybrid policy (CPU train path + optional iGPU\/NPU prefs).<\/li>\n\n\n\n<li><strong>Remote<\/strong> \ufffd AI_REMOTE_CUDA_HOST for HardwareAcceleration workers.<\/li>\n<\/ul>\n\n\n\n<p>Agent status (nn agent status &lt;id&gt;) includes device_train \/ device_infer resolved devices.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MathNN is the native C++ neural-network subsystem inside _AugmentedIntelligence. It is designed for small-to-medium in-process models where the application needs local learning without sending every update to TensorFlow, CUDA, or a remote policy server. The main current use case is reinforcement learning: MathNN can act as a local value network, policy network, or DQN Q-network [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2010","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/posts\/2010","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/comments?post=2010"}],"version-history":[{"count":1,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/posts\/2010\/revisions"}],"predecessor-version":[{"id":2011,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/posts\/2010\/revisions\/2011"}],"wp:attachment":[{"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/media?parent=2010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/categories?post=2010"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/macdaddy4sure.ai\/index.php\/wp-json\/wp\/v2\/tags?post=2010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}