Runtime and architecture
Compilation pipeline
.cognia text
-> Lexer
-> Parser and AST
-> SemanticAnalyzer
-> TopologyBuilder
-> CogniaSubstrate
-> Mind / NeuralGraph on GPU
The parser creates the language model. Semantic analysis resolves nested endpoints, validates dimensions, controllers, chemistry, competition and channels. The topology builder expands reusable instances and connection patterns into concrete neurons and edges. CogniaSubstrate reorders and annotates that graph for the runtime. Mind owns the graph and workspace; NeuralGraph performs propagation and plasticity on the GPU.
Validation and execution are intentionally separate. cognia stops after topology inspection, while cognia_run crosses the CUDA bridge.
Runtime neuron dynamics
For each neuron, incoming recurrent drive is normalized by in-degree, multiplied by per-neuron gain, combined with bias and modulation, and passed through a bounded nonlinearity. Adaptation subtracts a slowly changing fatigue term. Leak blends the new response with the previous activation.
Conceptually:
net_i = sum_j(weight_ji * delayed_activation_j) / normalization_i
candidate_i = tanh(gain_i * net_i + bias_i - adaptation_i + modulation_i)
activation_i = (1 - leak_i) * candidate_i + leak_i * previous_i
The optional normalization mode uses square-root in-degree instead of in-degree. Exact constants are runtime configuration, not language semantics.
Time and state
State includes neuron activation, adaptation, delayed activation history, sampled firing, workspace state, chemistry, output hysteresis, polarization and—where enabled—changing weights and topology. Saving a network persists the trained graph state required by the binary format, but models must be rebuilt with compatible dimensions before loading.
reset clears activity and resets the random generator for deterministic repeated evaluation. It does not change the declarative topology.
Delays
Every delayed edge reads the source from an activation-history ring buffer of size max_delay + 1. Delay zero keeps the original fast path. Delays make sequence order observable without creating a separate recurrent cell type.
Continuous and stochastic activity
Cognia supports continuous rate activation and optional stochastic firing probability. The server can return:
- current activations;
- whether each unit fired in the last step;
- firing probability;
- accumulated fire counts over multiple requested steps.
Set an explicit seed and reset between trials when measuring stochastic behavior.
Workspace and attention
Competition runs over the top runtime layer. Modules form coalitions; the strongest may ignite and broadcast influence through the graph. Focus can add settling iterations. Novelty-gated habituation releases an unchanging winner, a refractory period prevents immediate recapture, and attention hunger raises excitation of ignored alternatives.
The runtime exports winner, salience, ignition state, threshold, per-module boredom and excitation. These mechanisms shape a continuing mind and are bypassed by the raw sequence-feed path.
Structural plasticity
Growth can prune weak/inactive edges and add candidate edges within declared bounds. The runtime can restrict growth to adjacent layers, protect sensory targets and enforce a maximum edge count. Structural mutation complicates reproducibility; record the seed, model, runtime version and evaluation tick range.
Sensory and output integration
The full application follows:
camera / microphone / text
-> SensorPacket
-> GPU cortex preprocessing
-> ordered sensory region
-> Mind
-> declared output region
-> signal or literal output adapter
The HTTP service begins after cortex preprocessing and accepts a flat vector of exactly sensoryCount floats. Query /_model instead of hard-coding dimensions.
Visualization
The 3D network view clusters sensory modalities and workspace modules, distinguishes connection directions/types, highlights ignition and displays workspace metrics. Polarized modules show their direction vector in the plane of the neurons they polarize. The vector is a mathematical state inspired by repurposing the otherwise unused axon direction; it is not a geometrical axon simulation.
Visualization is diagnostic. Numeric evaluation should use controlled datasets and exported outputs.