- Model Name: Aeron TransformerNeuralNetBackbone
- Repository:
aeron - Primary Implementation:
aeron.py - Tokenizer Runtime Import:
tokenizer_mux.py - Tokenizer Asset Directory:
tokenizer/ - Model Card Version: 4.0.1 (Structural Corrections + RLHF Suite)
- Model Card Last Updated: February 27, 2026
- Authors / Maintainers: treyr (project maintainer)
- License: MIT
Aeron is a production-oriented, research-forward transformer backbone that combines a configurable encoder-decoder architecture with optional advanced subsystems for:
- multimodal fusion (text + image)
- knowledge graph-enhanced attention
- neural memory augmentation
- continual learning hooks
- uncertainty quantification
- active learning sample selection
The codebase is architecturally rich and implementation-heavy, with practical concerns addressed (ONNX export path, fallbacks, caching, runtime toggles, error isolation around advanced modules). At the same time, current readiness is pre-production for claims-heavy deployment because end-to-end benchmark/evaluation evidence is not yet documented in this repository for the present configuration.
Aeron is suitable for:
- experimentation with composite transformer systems
- architecture research for multimodal and uncertainty-aware NLP/ML systems
- building a foundation for custom task fine-tuning
- prototype-to-deployment workflows that require ONNX export
At this time, do not claim that Aeron is:
- a fully benchmarked SOTA model on public leaderboards
- a safety-certified model for high-stakes autonomous operation
- a validated medical, legal, or financial decision engine
- a guaranteed low-latency edge model
The following are implemented in code:
- configurable transformer encoder-decoder backbone
- multimodal path via patch embedding and fusion layers
- knowledge graph attention module with caching/statistics
- neural memory network module
- continual learning module
- uncertainty quantification module (MC-style, ensemble-style, evidential path)
- active learning manager
- streaming JSONL dataset loading pipeline
- ONNX export with export-mode toggling
- This repository currently documents architecture and training scaffolding well, but does not include a finalized, reproducible benchmark report for the exact current stack and tokenizer settings.
- The tokenizer path is wired and operational, but tokenizer assets in
tokenizer/indicate an early-stage state (details in Section 8). - Therefore, model quality claims should be treated as unverified until run-specific eval reports are attached.
The NeuralNetConfig default architecture parameters are:
vocab_size = 50000d_model = 2048nhead = 32num_kv_heads = 8num_encoder_layers = 32num_decoder_layers = 32dim_feedforward = 8192dropout = 0.0activation = "silu"rms_norm_eps = 1e-6layer_norm_eps = 1e-5rope_theta = 500000.0max_position_embeddings = 32768num_multimodal_layers = 6patch_size = 16num_channels = 3vision_d_model = 768num_tot_branches = 4num_scratchpad_slots = 64max_reasoning_steps = 3reasoning_complexity_threshold = 0.3
Core primitives include:
- multi-head attention with optional relative positional bias
- feedforward transformer blocks
- positional encoding module
- encoder and decoder stacks
- output projection to vocabulary logits
Aeron instantiates the following enhanced modules in the backbone:
KnowledgeGraphAttentionNeuralMemoryNetworkContinualLearningModuleUncertaintyQuantificationActiveLearningManager
In TransformerNeuralNetBackbone.forward, advanced modules are applied when export_mode == False. Each subsystem is wrapped with independent error handling; failures fall back to non-enhanced behavior while preserving a forward result payload.
set_export_mode(True) toggles export-oriented behavior and moves model to eval mode. This is used by export_model_to_onnx(...) to produce a cleaner ONNX graph path.
If vision_inputs are supplied:
- image inputs are patch-embedded
- text embeddings and vision embeddings are fused through configured multimodal fusion layers
- resulting fused representations feed the encoder path
If no vision input is provided, the text-only path is used.
Expected tensors include:
input_ids: shape(batch, seq_len)attention_mask: optional; if omitted, auto-filled as all-onesvision_inputs: optional image tensordecoder_input_ids: optional target-side IDsdecoder_attention_mask: optional causal/target mask
Backbone forward returns a structured dictionary. The complete set of keys as of v4.0.1:
| Key | Type | Description |
|---|---|---|
logits |
Tensor(batch, seq, vocab_size) |
Primary output |
encoder_attentions |
Tensor or None |
Encoder self-attention weights |
decoder_self_attentions |
Tensor or None |
Decoder self-attention weights |
decoder_cross_attentions |
Tensor or None |
Decoder cross-attention weights |
knowledge_graph_enhanced |
bool |
True if KG attention was applied |
neural_memory_enhanced |
bool |
True if episodic memory was applied |
memory_statistics |
dict |
Memory access patterns and slot utilization |
uncertainty_estimates |
dict |
MC/Ensemble/Evidential uncertainty outputs |
tot_branch_scores |
Tensor(batch, num_tot_branches) or None |
Per-branch quality scores from ToT |
scratchpad_stats |
dict |
{used_slots, total_slots, step_counter} |
reasoning_info |
dict |
Full reasoning diagnostics: complexity, branch_weights, tot_resolved_contradictions, steps taken |
Downstream consumers should pin to a strict subset of these fields. The research-diagnostic keys (reasoning_info, scratchpad_stats) are not guaranteed stable across minor versions.
This output contract is useful for diagnostics and research introspection, but downstream consumers must define a strict schema for production APIs.
Aeron includes two data paths:
- small in-memory sample dataset path for demo/testing
- streaming JSONL dataset path for larger training sets (
JsonlTextDataset)
prepare_training_dataloader(...) scans datasets/ in configurable order (default via env):
stylesreportscode
The JSONL path includes formatter functions for each dataset type and builds tokenized batches with attention masks derived from pad token IDs.
Aeron tokenizer integration uses:
TokenizerConfigEnhancedBPETokenizerAeronTokenizeradapter wrapper inaeron.py
Runtime defaults point to:
- vocab:
./tokenizer/vocab.json - merges:
./tokenizer/merges.txt
From current repository files:
tokenizer/vocab.jsonshows a compact vocabulary with byte tokens and special tokenstokenizer/merges.txtcontains only a version header (#version: 0.2) and no learned merge rulestokenizer/tokenizer_config.jsonreportsvocab_size = 268
This tokenizer is currently in an early-stage/bootstrapped configuration, not a mature learned BPE merge-space. It is operational and consistent for development, but not yet the kind of tokenizer expected for high-capacity language modeling quality.
That means current model behavior can be architecturally validated, but quality claims tied to subword efficiency or linguistic compression should be deferred until tokenizer training is completed.
- robust modular decomposition for experimentation
- explicit fallback paths around optional advanced modules
- export compatibility path for deployment pipeline integration
- support for uncertainty and active-learning introspection
- no consolidated benchmark suite/report in repo for current stack
- tokenizer merge training appears incomplete
- advanced module presence can create false confidence if eval evidence is missing
- output structure is broad; production API consumers must pin strict fields
- additional code paths (demo/experimental utilities) should be separated from hardened serving runtime
For any high-stakes deployment:
- require full task-specific validation
- run robustness and failure-mode testing
- include human review and rollback controls
- monitor uncertainty outputs as heuristics, not guarantees
Because data provenance and balancing are not yet fully documented in this repository snapshot, fairness properties cannot be asserted. Before external deployment:
- document dataset sources and filtering
- evaluate demographic and domain skew
- run subgroup performance audits
- publish known limitations transparently
- architecture implementation
- training/eval scaffolding
- complexity/benchmark helper utilities
- ONNX export path
- pinned benchmark matrix with dataset versions and seeds
- reproducible quality metrics (e.g., perplexity/accuracy/F1/task KPIs)
- latency/memory results for target deployment hardware and batch regimes
- failure case taxonomy and mitigation outcomes
Minimum publishable evidence:
- training config and seed manifest
- tokenizer build manifest (vocab/merges generation recipe)
- held-out metrics with confidence intervals
- ablations: base vs +KG vs +memory vs +continual vs +uncertainty
- serving latency and memory at representative sequence lengths
- Primary model implementation:
aeron.py - Tokenizer module appears in both
tokenizer_mux.pyandtokenizer/tokenizer_mux.pyin repository snapshot aeron.pycurrently imports from root module path (from tokenizer_mux import ...)- Tokenizer assets resolve under
tokenizer/by default - Dataset directory default:
datasets/ - Export artifact default path used in demo flow:
exports/transformer_backbone.onnx
To reduce drift risk, keep tokenizer module source-of-truth singular and version-pin tokenizer assets with checksums.
- enable
export_modefor serving/export pipelines - separate training-only logic from inference runtime
- pin model and tokenizer artifacts by immutable version tags
- define strict output schema in serving layer
- request throughput and latency by sequence length bucket
- memory utilization and OOM incidents
- error rates by subsystem
- uncertainty distribution drift over time
- tokenization anomalies and unknown-token rates
For each release, publish:
- model commit hash
- tokenizer commit hash and asset hashes
- config diff vs previous release
- metric diff vs previous release
Any change to tokenizer vocab/merges, model architecture defaults, or data formatter behavior should trigger:
- retraining or revalidation
- benchmark refresh
- model card update
Aeron is a serious architecture foundation with strong extensibility and real engineering depth. The right way to present it today is:
- implementation maturity: high for architecture scaffolding
- claim maturity: moderate pending consolidated eval proof
- tokenizer maturity: functional but currently early-stage (merge training incomplete)
With tokenizer training completion and disciplined benchmark publishing, this stack can present as a full lab-grade release with defensible claims.
Aeron's backbone underwent a comprehensive architectural upgrade integrating state-of-the-art transformer techniques used by leading production models (LLaMA 3, Mistral, DeepSeek-V2, Qwen-2, Gemma 2). This upgrade transforms the backbone from a standard post-norm encoder-decoder into a SOTA++ pre-norm architecture with advanced attention, feed-forward, normalization, and reasoning subsystems.
Upgrade Date: February 27, 2026
Affected File: aeron.py
Backward Compatibility: Checkpoint format differs from pre-upgrade; existing checkpoints require migration.
Visualization Outputs: visualizations_sota/ (new subdirectory, separate from legacy visualizations_untrained/)
| Component | Pre-Upgrade | Post-Upgrade (SOTA++) | Rationale |
|---|---|---|---|
| Normalization | nn.LayerNorm (post-norm) |
AeronRMSNorm (pre-norm) |
10-15% faster, better deep gradient flow |
| Position Encoding | Learned/Sinusoidal additive | RoPE-only for text; absolute sinusoidal PE retained for multimodal fusion path only | Relative position awareness, length extrapolation; absolute PE was incorrectly applied to text path in v4.0.0, corrected in v4.0.1 |
| Attention | Standard Multi-Head Attention | Grouped Query Attention (GQA) + RoPE | 2-4x KV-cache reduction, FlashAttention-2 compatible |
| Feed-Forward | Linear-GELU-Linear | SwiGLU (gate-up-down) | Consistently outperforms GELU/ReLU FFN |
| Architecture Pattern | Post-norm (norm after sublayer) | Pre-norm (norm before sublayer) | Superior gradient flow for deep networks (24+ layers) |
| Embedding Tying | Separate input/output embeddings | Weight-tied (shared) | Saves ~vocab_size x d_model params, improves quality |
| Output Projection | nn.Linear(d_model, vocab_size) w/ bias |
nn.Linear(d_model, vocab_size, bias=False) |
Consistent with tied weights, reduced param count |
| Final Norm | Single shared final_layer_norm |
Separate encoder_norm + decoder_norm (RMSNorm) |
Eliminates double-norm bug |
| Reasoning | None | AeronReasoningEngine (ToT + Scratchpad) | Neural-level multi-hypothesis reasoning |
Root Mean Square Layer Normalization. Replaces all nn.LayerNorm instances throughout the model.
Output = (x / sqrt(mean(x^2) + eps)) * weight
- Skips mean-centering step (vs LayerNorm which computes both mean and variance)
- ~10-15% wallclock speedup on GPU
- Configured via
rms_norm_eps(default:1e-6) - Used by: LLaMA, Mistral, Gemma, DeepSeek, Qwen
Rotary Position Embeddings encode relative position information by rotating Q/K vectors in attention.
- Mechanism: Applies rotation matrix to query and key vectors based on position
- Cache: Pre-computes cos/sin values up to
max_position_embeddings, dynamically extends - Extrapolation: Naturally handles sequences longer than training length
- Scaling: Optional
rope_scalingfactor for context window extension - Applied to: Self-attention only (NOT cross-attention, which attends across sequences)
- Config:
rope_theta=500000.0(default v4; extended context),rope_scaling=None
Grouped Query Attention shares K/V projection heads across groups of query heads, reducing memory consumption and enabling efficient KV-caching during generation.
- Config:
nhead=32(query heads),num_kv_heads=8(KV heads),num_kv_groups=4(default v4) - Special cases:
num_kv_heads == nhead→ standard MHA;num_kv_heads == 1→ Multi-Query Attention (MQA) - Backend: Uses
torch.nn.functional.scaled_dot_product_attentionfor automatic FlashAttention-2/memory-efficient kernel selection - Fallback: Manual attention computation if SDPA unavailable
- Bias-free: All projection matrices (
q_proj,k_proj,v_proj,out_proj) usebias=False
SwiGLU gating mechanism replaces the standard 2-layer FFN.
Output = Dropout(W_down @ (SiLU(W_gate @ x) * (W_up @ x)))
- Three matrices instead of two (gate, up, down)
- Intermediate size:
2/3 * dim_feedforward, rounded to nearest 256 boundary for hardware efficiency - Activation: SiLU (Sigmoid Linear Unit) for the gating path
- Bias-free: All three projection matrices use
bias=False
Pre-norm architecture applies normalization BEFORE each sublayer, with residual connections wrapping the normalized path.
Encoder Flow:
residual = x
x = RMSNorm(x) → Self-Attn(GQA+RoPE) → x + residual
residual = x
x = RMSNorm(x) → SwiGLU FFN → x + residual
Decoder Flow:
residual = x
x = RMSNorm(x) → Masked Self-Attn(GQA+RoPE) → x + residual
residual = x
x = RMSNorm(x) → Cross-Attn(GQA, no RoPE) → x + residual
residual = x
x = RMSNorm(x) → SwiGLU FFN → x + residual
A neural-level reasoning system is integrated directly into the forward pass, positioned between the enhancement pipeline (KG/Memory/CL) and the decoder. This provides o1-class "thinking before speaking" capability.
Neural working memory. In v4, this role is fulfilled by AeronInternalScratchpad with 64 differentiable memory slots (see Section 17.3.3 for the v4 implementation).
| Capability | Description |
|---|---|
| Read | Importance-weighted attention retrieval over memory slots |
| Write | Gated update mechanism (lerp between old and new content) |
| Consolidation | Cosine-similarity based merging of related slots |
| Contradiction Detection | Pairwise contradiction scoring between memory slots |
| Eviction | Learned importance scorer determines which slots to overwrite |
Neural branch exploration within the transformer hidden state.
- Branch Generation: 4 parallel hypothesis generators produce candidate reasoning paths
- Branch Evaluation: Learned critic network scores each branch against the original representation
- Pruning: Top-K (K=2) branches survive based on critic scores
- Refinement: Surviving branches pass through a shared self-attention + FFN refinement step
- Merging: Quality-weighted combination of refined branches
- Confidence Gating: Learned gate controls blend ratio between tree reasoning output and original representation
Note: This section describes the SOTA++ intermediate design. The final v4 implementation is documented in Section 17.3.5. Key differences: v4 uses a strict ToT-first mandate (no CoT-style iterative loop), scratchpad write occurs strictly after ToT, and convergence-based early stopping was replaced by a single ToT pass per forward call.
Master controller that orchestrates the scratchpad and tree of thought.
| Feature | Description |
|---|---|
| Adaptive Halting | Complexity estimator (threshold=0.3) skips reasoning for simple inputs, saving compute |
| ToT-First Mandate | Tree of Thought runs before any scratchpad writes (strict ordering) |
| Cross-Memory Bridge | Connects NeuralMemoryNetwork output to ToT branch exploration |
| Scratchpad Synthesis | After ToT: write best_branch and surviving branches, then synthesize |
| Skip Mask | Simple samples use residual path; complex samples use synthesized reasoning output |
The complete forward pass flow after the SOTA++ upgrade:
INPUT: input_ids (batch, seq_len)
|
+--> Token Embeddings (50k vocab, d_model=2048)
| [NO absolute PE -- RoPE handles position inside each attention layer]
|
+--> [Optional] Vision Patch Embedding --> Absolute PE --> Multimodal Fusion
|
v
ENCODER STACK (32x Pre-Norm layers)
| Each layer: AeronRMSNorm --> GQA Self-Attn (32Q/8KV + RoPE) --> Residual
| AeronRMSNorm --> SwiGLU FFN (2048-->5461-->2048) --> Residual
|
+--> encoder_norm (AeronRMSNorm)
|
v
ENHANCEMENT PIPELINE (sequential, error-isolated):
1. KnowledgeGraphAttention -- structured knowledge injection
2. NeuralMemoryNetwork -- 1000-slot episodic memory (memory_dim=512)
3. ContinualLearningModule -- EWC consolidation
4. UncertaintyQuantification -- evidential deep learning heads
5. ActiveLearningManager -- training-only, BADGE sampling
|
v
REASONING ENGINE (AeronReasoningEngine):
+--> complexity_gate --> skip entirely if complexity < 0.3
+--> [TREE OF THOUGHT] 4 branches --> cross-branch attention (O(N^2) on branch summaries)
| --> confidence/evidence scoring --> pruning_decider --> contradiction resolution
| --> quality-weighted merge
| (reads NeuralMemoryNetwork via memory_bridge; KG already in encoder_output;
| CL task_embedding conditions branch exploration)
+--> [WRITE TO SCRATCHPAD] strictly after ToT returns
| best_branch --> WORKING slots; survivors --> SHORT_TERM slots
+--> AeronScratchpadAttention synthesizes across written slots
+--> Final reasoning projection with residual
|
v
DECODER STACK (32x Pre-Norm layers)
| Each layer: AeronRMSNorm --> Masked GQA Self-Attn (32Q/8KV + RoPE) --> Residual
| AeronRMSNorm --> Cross-Attn (GQA, no RoPE) --> Residual
| AeronRMSNorm --> SwiGLU FFN --> Residual
|
+--> decoder_norm (AeronRMSNorm)
|
v
OUTPUT PROJECTION (weight-tied with token embeddings, bias=False)
|
v
OUTPUT: logits (batch, seq_len, vocab_size)
+ tot_branch_scores, scratchpad_stats, reasoning_info,
knowledge_graph_enhanced, neural_memory_enhanced,
memory_statistics, uncertainty_estimates
Before: The decoder ran BEFORE the enhancement pipeline (KG/Memory/CL), meaning it attended to raw, unenhanced encoder output. The KG, memory, and CL modules operated on the encoder output but their results were never seen by the decoder.
After: The enhancement pipeline runs first, followed by the reasoning engine, followed by the decoder. The decoder now attends to fully enhanced and reasoning-processed representations.
Impact: Substantial quality improvement expected once trained, as the decoder can now leverage all neural memory, knowledge graph, and reasoning capabilities.
Before: encode() applied final_layer_norm to encoder output. Then in forward(), the encoder-only code path applied self.final_layer_norm(enhanced_encoder_output) again, resulting in double normalization.
After: Separate encoder_norm and decoder_norm (both AeronRMSNorm) instances. Each is applied exactly once in its respective method. Forward pass projects directly without re-normalizing.
The following parameters were added to NeuralNetConfig:
| Parameter | Default | Description |
|---|---|---|
num_kv_heads |
8 | Number of KV heads for GQA |
activation |
"silu" |
Activation function (SwiGLU uses SiLU) |
rms_norm_eps |
1e-6 |
RMSNorm epsilon for numerical stability |
rope_theta |
10000.0 |
RoPE base frequency |
rope_scaling |
None |
Optional scaling factor for context extension |
use_gradient_checkpointing |
False |
Enable gradient checkpointing for memory efficiency |
tie_word_embeddings |
True |
Share input/output embedding weights |
head_dim |
d_model // nhead |
Derived: per-head dimension |
num_kv_groups |
nhead // num_kv_heads |
Derived: GQA group count |
The backbone forward method now returns an additional key:
| Key | Type | Description |
|---|---|---|
reasoning_info |
Dict[str, Any] |
Reasoning engine diagnostics: steps taken, complexity score, convergence status, branch scores, contradiction levels |
All previously documented keys remain unchanged.
At the target configuration (d_model=2560, nhead=20, num_kv_heads=4, 16+16 layers):
| Component | Approximate Parameters | Notes |
|---|---|---|
| Token Embeddings | ~128M | 50k × 2560 (shared with output projection via tying) |
| Encoder Stack (16 layers) | ~1.28B | GQA Self-Attn (20Q/4KV) + SwiGLU (2560→6826) per layer |
| Decoder Stack (16 layers) | ~1.49B | GQA Self-Attn + GQA Cross-Attn + SwiGLU per layer |
| Output Projection | 0 (tied) | Shared with token embeddings |
| KnowledgeGraphAttention | ~19M | Inherits GQA + KG injector/bias nets |
| NeuralMemoryNetwork | ~15M | 1K-slot memory + consolidation (scaled) |
| ContinualLearningModule | ~8M | Task embeddings + EWC Fisher tracking |
| UncertaintyQuantification | ~18M | MC/Ensemble/Evidential heads |
| ActiveLearningManager | ~6M | BADGE sampling networks |
| ReasoningEngine | ~42M | Scratchpad + ToT + Bridge |
| Estimated Total | ~3.0B | Meets the ~3B parameter target scale |
New visualization outputs are located in visualizations_sota/ to preserve the pre-upgrade visualizations in visualizations_untrained/.
visualizations_sota/
├── architecture/
│ ├── architecture_overview.png -- Full component diagram with SOTA++ labels
│ ├── encoder_decoder_structure.png -- Pre-norm layer block detail
│ ├── model_topology.png -- NetworkX graph of module hierarchy
│ └── topology_data.json -- Machine-readable topology
├── components/
│ ├── attention_head_structure.png -- GQA head configuration + RoPE
│ ├── continual_learning_module.png -- EWC Fisher visualization
│ ├── knowledge_graph_attention.png -- KG injection paths
│ ├── multimodal_fusion.png -- Vision-text fusion layers
│ ├── neural_memory_network.png -- Memory slot analysis
│ └── uncertainty_quantification.png -- UQ estimation heads
├── initialization/
│ ├── initialization_patterns.png -- SwiGLU/RMSNorm weight distributions
│ └── layer_wise_statistics.png -- Layer norm/weight statistics
├── untrained_model_report.json -- Machine-readable analysis
└── README.md -- Auto-generated report
All SOTA++ components pass functional verification (Feb 27, 2026):
Config: d_model=256, nhead=8, num_kv_heads=4, head_dim=32, groups=2
RMSNorm: torch.Size([2, 10, 256]) ✓
RoPE cos/sin: torch.Size([10, 32]) ✓
GQA MHA: out=(2,10,256) w=(2,8,10,10) ✓
SwiGLU FFN: intermediate=512, out=(2,10,256) ✓
Encoder Layer: (2,10,256) ✓
Decoder Layer: (2,10,256) ✓
Scratchpad Read: (2,10,256) ✓
Scratchpad Write: (2,8,256) ✓
Tree of Thought: out=(2,10,256), scores=(2,4), gate=0.501 ✓
Reasoning Engine: out=(2,10,256), steps=2, complexity=0.521 ✓
Pre-upgrade checkpoints will not load directly due to:
final_layer_normrenamed toencoder_norm/decoder_normoutput_projectionbias removed (bias=False)- Attention projections restructured for GQA (
q_proj,k_proj,v_proj) - FFN restructured for SwiGLU (
gate_proj,up_proj,down_proj) - New modules:
reasoning_engine,AeronRMSNorminstances
A migration script mapping old key names to new key names is required for checkpoint conversion.
The lonpt/aeron_adapter.py should be verified against the new architecture. Key changes that may affect the adapter:
- Norm type change (LayerNorm → RMSNorm)
- Attention head structure change (MHA → GQA)
- FFN structure change (2-layer → SwiGLU 3-layer)
- New reasoning engine module
Aeron's backbone was scaled to ~3.85B parameters and the reasoning engine was rebuilt from the ground up with a strict Tree of Thought → Scratchpad pipeline replacing the previous iterative CoT-style loop.
Upgrade Date: February 27, 2026
Model Card Version: 4.0.0
Affected Files: aeron.py, tokenizer_mux.py
| Parameter | v3 Default | v4 Default | Change |
|---|---|---|---|
d_model |
1024 | 2048 | 2× |
nhead |
16 | 32 | 2× |
num_encoder_layers |
12 | 32 | 2.7× |
num_decoder_layers |
12 | 32 | 2.7× |
dim_feedforward |
4096 | 8192 | 2× |
dropout |
0.1 | 0.0 | Disabled at 4B scale |
rope_theta |
10000.0 | 500000.0 | Extended context |
max_position_embeddings |
4096 | 32768 | 8× (32k context) |
max_text_length (tokenizer) |
4096 | 32768 | Matches model context |
Estimated parameter count (d_model=2048, 32/32 layers): ~3.85B
- Embedding: 50k × 2048 = 102M (shared with output via tying)
- Encoder stack (32 layers): ~1,376M
- Decoder stack (32 layers): ~2,048M
- Advanced modules (KG, Memory, CL, UQ, AL): ~160M
- Reasoning engine: ~170M
The reasoning engine was completely redesigned. Key mandate: Tree of Thought FIRST → then write to Scratchpad. NO CoT anywhere. NO MoE.
encoder_output (KG+Memory+CL enhanced)
↓
AeronReasoningEngine:
1. complexity_gate → skip if complexity < 0.3 (saves compute for simple inputs)
2. [TREE OF THOUGHT] — branches explore, evaluate, prune, resolve contradictions
- reads neural_memory context via memory_bridge (Memory #1)
- KG knowledge already baked into encoder_output (Memory #2)
- CL task embedding conditions exploration (Memory #3)
3. [WRITE TO SCRATCHPAD] — strictly after ToT returns
- best_branch written to WORKING slots
- surviving branches written to SHORT_TERM slots
- ScratchpadAttention synthesizes across branch slots
4. synthesized_output → decoder
Multi-head attention over 64 differentiable memory slots with metadata enhancement (slot type, priority, timestamp).
nhead = max(4, d_model // 64)— scales with model size- Slot relevance scoring via learned importance/recency/relevance scorers
- Metadata embeddings:
MemorySlotType(5 values) ×MemoryPriority(5 values) × temporal encoding
64 differentiable memory slots with learnable key/value parameters.
| Method | Description |
|---|---|
read(query) |
Attend over slot values with metadata-enhanced keys |
write(content, slot_type, priority) |
Soft weighted update to slot values |
synthesize(tot_output, x) |
Read after write → concat → project back to d_model |
get_stats() |
Used/total slots, step counter |
Parallel hypothesis exploration with dialectical contradiction resolution.
- Branch generation:
num_tot_branches=4parallel generators produce hypothesis representations - Cross-branch attention:
TransformerEncoderLayerprocesses all branches concatenated - Quality estimation: confidence + evidence assessors score each branch
- Pruning:
pruning_deciderper-branch keep/prune decision - Contradiction resolution: pairwise detector + dialectical
synthesis_resolvermerges contradictory branches - Quality-weighted merge: softmax-weighted combination of surviving branches
| Feature | Description |
|---|---|
| Adaptive halting | complexity_gate (threshold=0.3) skips reasoning for simple inputs |
| ToT-first mandate | Tree of Thought runs BEFORE any scratchpad writes |
| Memory wiring | Neural memory context → memory_bridge → ToT; task embedding → ToT conditioning |
| Scratchpad synthesis | After ToT: write best_branch + survivors, then synthesize() |
| Skip mask | Simple samples use residual; complex samples use synthesized output |
| Parameter | Default | Description |
|---|---|---|
num_tot_branches |
4 | Number of parallel ToT hypothesis branches |
num_scratchpad_slots |
64 | Number of differentiable scratchpad memory slots |
max_reasoning_steps |
3 | Reserved (used as depth hint, ToT runs once per forward) |
reasoning_complexity_threshold |
0.3 | Below this, skip reasoning entirely |
| Key | Type | Description |
|---|---|---|
tot_branch_scores |
Tensor(batch, num_branches) or None |
Per-branch quality scores from ToT |
scratchpad_stats |
Dict |
{used_slots, total_slots, step_counter} |
reasoning_info |
Dict |
Full reasoning diagnostics including complexity, branch_weights, tot_resolved_contradictions |
The following old reasoning components were removed:
AeronScratchpadMemory(replaced byAeronInternalScratchpad+AeronScratchpadAttention)AeronTreeOfThoughtLayer(replaced byAeronTreeOfThoughtProcessor)- Old
AeronReasoningEngineiterative loop with CoT-style convergence detection
TransformerNeuralNetBackbone.forward() now accepts:
task_id: Optional[int] = None— used to retrieve ContinualLearningModule task embedding for ToT conditioning
# Smoke test (< 30 seconds)
python -c "
from aeron import NeuralNetConfig, TransformerNeuralNetBackbone
import torch
config = NeuralNetConfig(
d_model=256, nhead=4, num_kv_heads=2,
num_encoder_layers=2, num_decoder_layers=2,
dim_feedforward=512, vocab_size=50000,
num_tot_branches=2, num_scratchpad_slots=8,
max_reasoning_steps=1
)
model = TransformerNeuralNetBackbone(config)
ids = torch.randint(0, 50000, (2, 16))
out = model(input_ids=ids, attention_mask=torch.ones(2,16), decoder_input_ids=ids)
assert out['logits'].shape == (2, 16, 50000)
print('branch_scores:', out['tot_branch_scores'].shape)
print('scratchpad_stats:', out['scratchpad_stats'])
print('ALL CHECKS PASSED')
"Six structural issues were corrected in aeron.py:
| # | Issue | Impact |
|---|---|---|
| 1 | use_cache now raises NotImplementedError instead of silently ignoring |
Safety |
| 2 | neural_memory_ctx now correctly passes memory_recall to ToT (with shape guard fallback when memory_dim ≠ d_model) |
Correctness |
| 3 | Absolute positional encoding removed from text path (RoPE-only); PE applied only to multimodal-fused path | Architecture |
| 4 | SDPA diagnostic attn_weights now mask-correct (causal and padding masks applied before softmax) |
Correctness |
| 5 | Scratchpad write() no longer mutates global state mid-forward; returns differentiable new_slot_values; gradient flows through write_gate → synthesis |
Training |
| 6 | ToT cross-branch attention reduced from O((N·S)²) to O(N²) via branch-summary pooling | Scalability |
Checkpoint format: unchanged from v4.0.0 (no new parameters added, no parameter shapes changed).
The RLHF/ directory contains three production-grade modules providing alignment training, inference optimization, and model merging capabilities. These modules operate as wrappers over TransformerNeuralNetBackbone and do not modify aeron.py directly.
Full reinforcement learning from human feedback implementation:
| Component | Description |
|---|---|
| PPO Trainer | Proximal Policy Optimization with clipping, value function, and KL penalty against reference policy |
| DPO Trainer | Direct Preference Optimization for alignment without explicit reward model |
| Reward Model Training | Scaffold for training a reward model from preference data |
| Class | Description |
|---|---|
OptimizedAttention |
Automatic FlashAttention-2 / SDPA kernel selection; falls back to manual attention if unavailable |
PagedKVCache |
Paged attention KV-cache management for variable-length batch serving |
SpeculativeDecoder |
Speculative decoding with a smaller draft model; accepts or rejects draft tokens against the target model |
BestOfNSampler |
Generates N candidates and selects the highest-scoring according to a reward model |
MCTSGenerator |
Monte Carlo Tree Search over the token generation graph |
compile_model |
torch.compile wrapper with configurable backend (inductor, aot_eager, etc.) |
| Class / Function | Algorithm | Description |
|---|---|---|
ModelMerger |
Task Arithmetic | Linear combination of task vectors (fine-tuned minus base) |
ModelMerger |
TIES | Trim, Elect Sign, and Merge for conflict resolution across multiple fine-tunes |
ModelMerger |
SLERP | Spherical linear interpolation between two checkpoints |
ModelMerger |
DARE | Drop and Rescale random parameter delta pruning |
ModelSoup |
Uniform / Weighted | Average model weights across a set of checkpoints |
EnsemblePolicy |
Ensemble | Decode by averaging logits across multiple loaded model instances |
layer_wise_interpolation |
Layer-wise | Per-layer interpolation coefficient between two checkpoints |
- None of the RLHF modules modify
aeron.py. They wrap the publicTransformerNeuralNetBackboneAPI. - PPO and DPO trainers require a reference policy (frozen copy of the base model) and a reward model.
- Inference optimizations are independent and can be applied to any forward pass without RLHF training.
- Model merging operates on checkpoint state dicts; no live model instance required for most operations.
use_cache=Falsemust be enforced when usingPagedKVCacheuntil native KV-cache support is implemented inaeron.py.
RLHF modules are implemented and structurally present. No end-to-end RLHF training results are documented for the v4.0.1 configuration. Treat as available infrastructure pending benchmark validation.
The tokenizer implementation is now treated as canonical in:
tokenizer/tokenizer_mux.py
Backward compatibility is preserved via:
tokenizer_mux.py(re-export shim)
This resolves prior dual-module drift risk while maintaining existing import patterns in training and inference scripts.
Tokenizer runtime behavior is now explicitly hardened with fail-loud semantics for contract violations:
- per-instance, modality-scoped circuit breaker execution
- enforced async preprocessing timeout boundaries
- single authoritative tokenization cache path
- structured payload depth and size guardrails
- fail-loud image lane when image tokenizer adapter is required but unavailable
- startup asset validation report with deterministic hash capture
The following validation artifacts were generated:
reports/tokenizer/tokenizer_startup_validation.jsonreports/tokenizer/tokenizer_quality_report.mdreports/tokenizer/tokenizer_quality_manifest.json
Observed summary from quality manifest:
- suite:
tokenizer_quality_non_pytest - total tests:
8 - passed:
8 - failed:
0
For the next repository cut:
- keep
aeron.pytreated as stable unless a new architecture phase explicitly begins - preserve canonical tokenizer module layout from this addendum
- require startup + quality artifact generation before any production-oriented claims
- keep README and model card statements tied to concrete artifact outputs