Skip to main content

Crate nexcore_cognition

Crate nexcore_cognition 

Source
Expand description

§nexcore-cognition

Typed cognitive engine — the transformer algorithm as strict Rust.

§Meta-cognitive origin

This crate captures the fundamental algorithm behind large language model cognition: attention selects, transformation processes, generation builds. Each module maps to an observable pattern in how neural networks process information, translated faithfully into Rust’s type system.

§Architecture (bottom-up)

pipeline ──► generator ──► block ──► attention + feed_forward
                             │          │            │
                             ▼          ▼            ▼
                         normalize   mask         tensor
                         residual                   │
                         embedding                error

§T1 Primitive grounding

ModulePrimitivesCognitive role
tensorN, Σ, ×, ∂, κNumerical substrate
embeddingμ, λ, NSymbol → vector
attentionκ, →, N, μ, ΣRelevance selection
feed_forwardμ, ςNonlinear transformation
residualπ, ΣContext preservation
normalize∂, NSignal stability
blockσ, ∃Composable unit
mask∂, →, ∝Causal constraint
generatorσ, ρ, ∝, →, ∂Autoregressive output
sampleN, ∂, ν, κStochastic selection
metricsκ, N, ν, μSelf-measurement
pipelineσ, →, Σ, κFull cognitive flow

Modules§

attention
Scaled dot-product attention and multi-head attention.
block
Transformer block — the composable unit of cognition.
embedding
Token embedding and positional encoding.
error
Error types for the cognitive engine.
feed_forward
Feed-forward network (FFN).
generator
Autoregressive generation — building output token by token.
mask
Causal masking for autoregressive attention.
metrics
Meta-cognitive self-measurement.
normalize
Layer normalization.
pipeline
Full cognitive pipeline — the complete flow from input to output.
residual
Residual connections (skip connections).
sample
Sampling strategies for token generation.
tensor
Dense tensor type and operations.

Functions§

make_rng
Create a seeded or OS-random StdRng for use with the cognitive engine.