This package provides an easy and modular way to build and train simple or complex neural networks using Torch:
- Modules are the bricks used to build neural networks. Each are themselves neural networks, but can be combined with other networks using containers to create complex neural networks:
- Module: abstract class inherited by all modules;
- Containers: composite and decorator classes like
Sequential,Parallel,ConcatandNaN; - Transfer functions: non-linear functions like
TanhandSigmoid; - Simple layers: like
Linear,Mean,MaxandReshape; - Table layers: layers for manipulating
tables likeSplitTable,ConcatTableandJoinTable; - Convolution layers:
Temporal,SpatialandVolumetricconvolutions;
- Criterions compute a gradient according to a given loss function given an input and a target:
- Criterions: a list of all criterions, including
Criterion, the abstract class; MSECriterion: the Mean Squared Error criterion used for regression;ClassNLLCriterion: the Negative Log Likelihood criterion used for classification;
- Criterions: a list of all criterions, including
- Meta-Cognitive and AIML Integration (NEW):
- NN.AIML Documentation: Complete guide to meta-cognitive neural networks with AIML integration
MetaCognitiveLoop: Neural networks that monitor their own learningNestedMetaCognition: Hierarchical meta-cognitive processing (learning about learning, reasoning about reasoning)SelfAwareNetwork: Self-monitoring neural networks with AIML conversational interfaceMetaCognitiveAIML: AIML pattern-based conversational AI with neural awareness
- AGML - Advanced Generative Markup Language (NEW):
- AGML Documentation: Advanced AIML-based conversational AI with nested meta-cognitive loops.
- Integrated Packages (NEW):
- Packages Documentation: A collection of integrated external packages.
- Additional documentation:
- Overview of the package essentials including modules, containers and training;
- Training: how to train a neural network using
StochasticGradient; - Testing: how to test your modules.
- Experimental Modules: a package containing experimental modules and criteria.
Transcending LLM Performance Through True Meta-Cognition
The NN.AIML system implements nested meta-cognitive loops that enable neural networks to truly learn about their learning, reason about their reasoning, and adapt with deep cognitive awareness - capabilities that go beyond traditional LLMs' simulated reasoning.
require 'nn'
-- Create a base neural network
local baseNet = nn.Sequential()
:add(nn.Linear(10, 20))
:add(nn.Tanh())
:add(nn.Linear(20, 10))
-- Add nested meta-cognitive loops (3 levels: cognition, meta-cognition, meta-meta-cognition)
local metaCognitiveNet = nn.NestedMetaCognition(baseNet, 3)
-- Make it self-aware with AIML conversational interface
local selfAwareNet = nn.SelfAwareNetwork(metaCognitiveNet, true)
-- Use like any neural network
local input = torch.randn(5, 10)
local output = selfAwareNet:forward(input)
-- Converse with the neural network!
local response = selfAwareNet:converse("HOW ARE YOU", input)
print(response) -- "I'm functioning well! My cognitive confidence is high at 0.95."
-- Introspect its cognitive state
local intro = selfAwareNet:introspect()
print("Learning stability: " .. intro.learningDynamics.stability)
print("Current state: " .. intro.recentReflections[1].state)-
Explicit Meta-Cognitive Loops: NN.AIML implements explicit nested cognitive loops that monitor and adapt learning in real-time, providing measurable confidence and stability metrics. LLMs simulate reasoning through token prediction without explicit self-monitoring mechanisms.
-
Lightweight & Efficient: Built on Torch with estimated 10-20% computational overhead per cognitive level (based on implementation analysis of additional forward/backward passes). Actual overhead depends on base network size and cognitive depth. Compare to massive transformer models requiring billions of parameters. See benchmarking documentation for measurement methodologies to verify performance on your specific use case.
-
Transparent Self-Awareness: Full introspection into cognitive state, confidence levels, and reasoning processes through explicit APIs. Unlike black-box neural models, every aspect of cognitive state is directly measurable and accessible.
-
Adaptive Learning: Self-adjusting learning rates and stability based on tracked meta-cognitive metrics, enabling continuous self-improvement during training. Traditional models require manual hyperparameter tuning or separate meta-learning systems.
-
Hybrid Neural-Symbolic: Combines neural network processing with AIML pattern-based reasoning for robust conversational AI. This hybrid approach leverages both statistical learning and symbolic rule-based systems.
Note: Performance characteristics vary based on network architecture, cognitive depth, and use case. See benchmarking documentation for measurement methodologies.
See examples/metacognitive_botnet.lua for a complete demonstration.