Brhaddaksa / README.md
nkshirsa's picture
Update ML Intern artifact metadata
799e12f verified
---
tags:
- ml-intern
---
# बृहद्दक्ष (Bṛhaddakṣa)
> **"Vast Skill, Grand Dexterity" — a research architecture for machines that hold patterns, discover new ones, and receive the patterns that only minds can create.**
---
## 1. AI Today: The Big Picture (For Everyone)
### The High School Version
Artificial Intelligence is the field of making machines do things that look intelligent. The current revolution — ChatGPT, Claude, Gemini, everything you have heard about — rests on a single invention called the **Transformer**, introduced in 2017. Before that, AI was a collection of narrow tools: one program recognized faces, another translated sentences, another played chess. They did not talk to each other. They did not learn from each other. The Transformer changed that by giving the machine a way to look at **everything at once** and decide what matters.
Think of it like a student taking a very long test. Before answering question 500, the student re-reads questions 1 through 499. Not to check their work — to actually **re-derive** the answer to question 500 from scratch, using every previous question as "context." The longer the test, the more work each answer requires. This works, but it is fundamentally absurd. A human does not re-read the first 499 pages of a novel before understanding page 500. A human **remembers** what book they are reading.
### The Undergrad Version
Transformers use **self-attention**: a mechanism where every token in a sequence computes a similarity score against every other token. For a sequence of length N, this creates an N×N matrix. The computational and memory cost scales as O(N²). Even with optimizations like KV caching and Flash Attention, the fundamental bottleneck remains: **there is no persistent state that survives between tokens.** Each forward pass is independent. The only "memory" is the sequence itself, which is re-processed every time.
The brain does not work this way. Your visual cortex does not re-process every photon you have ever seen before recognizing a face. Your motor cortex does not re-derive your destination before every turn of the steering wheel. The brain uses **persistent activity patterns**: populations of neurons that stay active (or stay silent) over time, encoding the current task, mood, or intention independently of the sensory stream. Transformers have no equivalent.
### The Grad Version
The Transformer architecture, while powerful, conflates two distinct computational roles:
- **Recurrent state**: A compressed representation of recent history (what has been said)
- **Executive state**: A persistent representation of current task, mode, or intention (how we should operate)
Transformers have no executive state. Every token generation must re-derive the current mode from the entire prefix. This is not a bug — it is the design. The attention mechanism is a content-addressable memory that reads the past. It does not hold a "destination register."
**State Space Models (SSMs)** like Mamba-2 address the O(N²) cost by maintaining a fixed-size hidden state h_t that is updated recurrently: h_t = A_t · h_{t-1} + B_t · x_t. This reduces memory to O(1) per token. But the SSM state is a **compression of history**, not an **executive mode**. It answers "what has been said?" not "what mode should I operate in?" The model still derives its behavior from the input stream, not from a persistent intention.
### The Expert Version
Recent developments include:
- **Mixture of Experts (MoE)**: Scale model capacity without proportional compute increase by routing tokens to specialized sub-networks
- **Test-time scaling (o1, DeepSeek-R1)**: Allocate more computation at inference time for reasoning tasks via chain-of-thought
- **Emergent architectures**: Hybrid attention-SSM models (e.g., NVIDIA's 8B hybrid), linear attention approximations, and state-space augmentations
- **Long-context innovations**: Ring attention, infinite attention, and context-compression techniques
These improve efficiency and capacity but do not address the core architectural gap: **no explicit executive state with discrete mode switching and timescale separation.** The brain's prefrontal cortex operates on a slower timescale than sensory processing. Basal ganglia maintain task-set representations that persist across thousands of stimulus presentations. The cerebellum executes motor programs compiled from declarative knowledge. None of these organizational principles have direct analogues in current AI architectures.
---
## 2. The Architecture Zoo: What Exists Today
### The High School Version
Think of AI architectures as different ways to organize a factory:
- **Neural Networks (the classic kind)**: An assembly line where each worker passes their work to the next. Simple, but if worker 50 needs to know what worker 1 did, the message has to travel through 49 people. Information gets distorted or lost.
- **Transformers**: A factory where every worker can talk to every other worker simultaneously. Very powerful, but the number of conversations grows as the square of the number of workers. 100 workers = 10,000 conversations. 100,000 workers = 10 billion conversations. It explodes.
- **Mamba / State Space Models**: Each worker keeps a small notebook. They write a summary of what they did, pass the notebook to the next worker, and the next worker only reads the notebook — not the entire history. The notebook stays the same size no matter how long the shift. But the notebook only records what happened. It does not say "today we are making sports cars, not sedans." That intention is not written anywhere.
- **Recurrent Neural Networks (LSTMs, GRUs)**: Workers pass a hidden message along with their work. The message is supposed to carry important context. But over long shifts, the message gets washed out — like a game of telephone where the original message is lost after 50 people.
- **Emergent hybrids**: Some factories try to combine the approaches — a few workers use notebooks, a few use simultaneous conversations, a few use special shortcut lines. These are promising but ad-hoc. They improve efficiency without a principled theory of why.
### The Undergrad Version
| Architecture | Memory per token | Has persistent state? | State is executive or recurrent? | Mode switching |
|---|---|---|---|---|
| Transformer | O(N) with KV cache | ❌ None | N/A | Gradual (via attention weights) |
| LSTM/GRU | O(1) | ✅ Hidden state | Recurrent (compression) | Gradual (gated flow) |
| Mamba-2 (SSM) | O(1) | ✅ SSM state | Recurrent (compression) | Gradual (input-dependent) |
| HiT-LM (Bṛhaddakṣa) | O(1) | ✅ Two states: SSM + Attractor | **Separate** fast/recurrent + slow/executive | **Discrete** (energy barriers) |
The critical distinction: Mamba-2's SSM state h_t is a function of the entire input history: h_t = f(x_1, x_2, ..., x_t). It is a **sufficient statistic** of history, not an **independent intention.** Bṛhaddakṣa adds a second state h^slow that is updated only at segment boundaries, persists independently of token-level input, and is trained to represent **modes** (tone, persona, task, genre) via energy-based attractor dynamics.
### The Grad Version
Bṛhaddakṣa is a **Hierarchical Timescale Language Model (HiT-LM)**. Its theoretical foundation is the principle of **timescale separation** from dynamical systems theory: when a system contains processes operating at very different speeds, the fast processes can be approximated as instantaneously equilibrated relative to the slow processes, and the slow processes can be treated as constants during fast dynamics.
In the brain:
- **Fast timescale (~ms)**: Neuronal spiking, sensory processing, motor execution
- **Medium timescale (~s)**: Working memory, attention shifts, segment processing
- **Slow timescale (~min)**: Task sets, mood, intention, procedural mode
- **Ultra-slow timescale (episodes)**: Long-term memory, skill acquisition, exploration
Bṛhaddakṣa maps these explicitly:
- **Tier 1 (Fast)**: Token-level Mamba-2 execution (~1 ms/token)
- **Tier 2 (Interface)**: Segment-level boundary detection (~seconds)
- **Tier 3 (Slow)**: Episode-level Hopfield attractor dynamics (~minutes)
- **Tier 4 (Meta)**: Task-level self-monitoring and override (~episodes)
- **Tier 5 (Memory)**: Cross-episode polar long-term memory (~system lifetime)
- **Tier 6 (Curiosity)**: System-lifetime exploration of mode hypersphere
- **Tier 7 (Ideas)**: Human-originated angular seeds (transcendent to the system)
### The Expert Version
The polar coordinate unification is the key geometric insight. All tiers speak one language: **rotations on a hypersphere S^(d-1)**:
- **Tier 1** receives rotations via **Polar FiLM** (Feature-wise Linear Modulation): R(θ)·r·h + β applied at intermediate Mamba-2 layers
- **Tier 3** holds a position on the sphere via **Modern Hopfield Network** energy minima: E(h) = -h^T · Ξ · softmax(β · Ξ^T · h)
- **Tier 5** stores positions as (θ, r) pairs — retrieval **is** modulation (no transformation needed)
- **Tier 6** discovers unexplored positions via **von Mises-Fisher kernel density estimation** on the sphere
- **Tier 7** originates new positions from human minds, projected onto the sphere via learned encoders
The circular mean property is mathematically necessary: arithmetic mean of 350° and 10° gives 180° (wrong); circular mean gives 0° (correct). This matters for memory consolidation, anti-memory storage (θ + π), and gradient interpolation.
---
## 3. What Current Models Lack
### The High School Version
Imagine a brilliant pianist who can play any style — jazz, classical, formal speech, scary stories. But this pianist has three fatal problems:
1. **They forget what style they're playing after a few thousand notes.** They have to re-read the sheet music from measure 1 before playing every single note. This is slow, expensive, and makes long stories drift into random styles.
2. **They cannot switch styles cleanly.** If the conductor says "now play jazz," they gradually slide from classical to jazz over 500 notes, sounding like a confused mess in between.
3. **They remember nothing from yesterday.** Every concert is their first concert. They never learn that jazz worked great at last night's wedding, or that funeral marches made the children cry at the birthday party.
### The Undergrad Version
Current language models lack three architectural properties that the brain possesses:
1. **Persistent executive state**: A register that holds "we are in formal mode" independently of the text being generated. Transformers re-derive this from the prefix every token. Mamba-2 compresses it into the SSM state but does not separate "what has been said" from "how we should speak."
2. **Discrete mode switching**: The brain can switch tasks discontinuously — from driving to parking, from speaking English to speaking French, from focusing on a conversation to reacting to a siren. Current AI drifts gradually. There is no energy barrier that makes some configurations stable and others unstable.
3. **Cross-episode learning**: The brain accumulates procedural knowledge over a lifetime. A model's weights are frozen at deployment. Its "context window" is a short-term buffer, not a growing library of what worked and what failed.
### The Grad Version
The mathematical problems:
**Quadratic attention cost**: Even with KV caching, generating token N+1 requires reading all N cached keys and values. For 128K context, this is 128,000 vector operations per layer per token. The memory bandwidth becomes the bottleneck.
**No attractor dynamics**: A GRU or LSTM state flows like a river — it converges to a single fixed point determined by the input sequence. There are no multiple stable basins. You cannot "be in formal mode" with a barrier against drifting into casual mode. The dynamics are monostable.
**Training signal mismatch**: Next-token prediction loss (-log P(token_t | prefix)) is a local, causal objective. It cannot teach a module to maintain global coherence across 10,000 tokens. There is no gradient for "the paragraph should maintain the same tone" because tone is not a token.
**No episodic memory**: At inference time, the model has no mechanism to write new information to persistent storage based on outcomes. RAG retrieves external text, but it does not store "formal mode worked for this user" as a behavioral memory.
### The Expert Version
The fundamental limitation is **architectural monism**: current models conflate all cognitive functions into a single processing stream. The brain is architecturally plural:
- **Thalamus**: Sensory gating and routing
- **Hippocampus**: Episodic memory formation and retrieval
- **Prefrontal cortex**: Executive control, task sets, self-monitoring
- **Basal ganglia**: Habit formation, procedural memory, action selection
- **Cerebellum**: Compiled motor programs, timing, prediction
- **Default mode network**: Internal mentation, self-referential processing
None of these map cleanly to "stack of identical Transformer blocks." Bṛhaddakṣa is an attempt at principled pluralism — different structures for different functions, operating on different timescales, with explicit interfaces between them.
---
## 4. What Has Been Tried to Address These Shortcomings
### The High School Version
The AI community has tried many band-aids:
- **Longer context windows**: Give the model more memory. But this just makes the re-reading problem bigger — now it re-reads 200,000 notes instead of 4,000.
- **Retrieval-Augmented Generation (RAG)**: Let the model look things up in a search engine. This helps with facts ("what is the capital of France?") but not with tone, style, or mode.
- **System prompts**: Tell the model "be formal" at the start. But this instruction gets diluted over thousands of tokens. The model gradually forgets it.
- **Fine-tuning**: Retrain the model on formal text. But this changes the entire model permanently. It cannot switch to casual when needed.
- **Chain-of-thought**: Make the model think step by step. This improves reasoning but does not help with style consistency across a novel.
- **Test-time compute scaling**: Let the model spend more time thinking before answering. Better for math, irrelevant for creative writing coherence.
### The Undergrad Version
| Approach | What It Fixes | What It Does Not Fix |
|---|---|---|
| Longer context | Fact retrieval over longer documents | Quadratic cost, mode drift |
| RAG | Factual grounding | Behavioral/style memory |
| System prompts | Initial instruction | Persistence over long generation |
| Fine-tuning | Domain adaptation | Mode switching, online learning |
| Chain-of-thought | Multi-step reasoning | Long-horizon coherence |
| Test-time scaling | Reasoning depth | Style consistency, persona maintenance |
| KV cache compression | Memory reduction | No persistent executive state |
| Attention sparsification | Compute reduction | Still re-processes prefix |
| In-context learning | Few-shot adaptation | Episodic memory, outcome learning |
None of these address the core architectural deficit: the absence of a **slow executive tier** that persists independently of the fast execution tier and is updated only when the mode should change.
### The Grad Version
Recent research closer to Bṛhaddakṣa's goals:
- **Hierarchical Transformers** (e.g., Hierarchical BERT): Process documents at sentence, paragraph, and document levels. But the hierarchy is feed-forward, not recurrent — no persistent state at higher levels.
- **Memory-augmented networks** (e.g., Memory Networks, Neural Turing Machines): Add external memory banks. But memory is typically content-addressable text/vectors, not mode representations. Retrieval feeds into attention, not into executive control.
- **World models** (Ha & Schmidhuber): Learn predictive models of the environment. Applied mainly to RL environments, not language generation. The "world model" operates on pixel/vector spaces, not linguistic modes.
- **Continual learning** (Progressive Networks, EWC): Prevent catastrophic forgetting when learning new tasks. But these modify weights, not add a separate memory system that persists at inference time without gradient updates.
- **Hopfield networks for modern deep learning** (Demircigil et al., 2017; Ramsauer et al., 2021): Show that Hopfield networks can store exponentially many patterns and retrieve them via attention-like dynamics. Bṛhaddakṣa builds directly on this work.
### The Expert Version
The closest intellectual relatives:
- **LeCun's JEPA (Joint Embedding Predictive Architecture)**: Proposes a world model architecture with hierarchical prediction. But JEPA is focused on perception and planning, not language generation. The hierarchical levels predict embeddings, not control generation modes.
- **Schmidhuber's RNN hierarchy**: Proposed fast/slow RNNs with different clock rates in the 1990s. Bṛhaddakṣa realizes this with modern components (Mamba-2, Modern Hopfield, FiLM) and adds the critical innovations: polar coordinate unification, anti-memories, curiosity-driven exploration, and the human-machine idea boundary.
- **Modular approaches** (e.g., Gato, FLAN): Train a single model on many tasks. But tasks are switched via input prompt, not via a persistent executive state. There is no explicit mode register.
- **Consciousness-inspired architectures** (Global Workspace Theory models): Implement broadcast mechanisms and competitive selection. These are conceptually related to Bṛhaddakṣa's meta-tier but typically lack the geometric unification and the explicit timescale separation of the lower tiers.
---
## 5. What Bṛhaddakṣa Wants to Solve
### The High School Version
Bṛhaddakṣa adds a **conductor** to the orchestra.
The conductor looks at the whole concert program and says "we are playing jazz tonight." The pianist still plays every note, but the conductor adjusts the piano's sound **between songs**, not during them. The conductor also remembers which programs worked (memory), finds styles the piano has never tried (curiosity), and — critically — knows that **only a living composer can write genuinely new music** (the Ideas Layer).
The pianist (Tier 1) plays notes. The stage manager (Tier 2) notices when the scene changes. The conductor (Tier 3) holds the mood. The critic (Tier 4) checks if the mood matches the program. The librarian (Tier 5) remembers past concerts. The explorer (Tier 6) finds blank spots on the map. The composer (Tier 7) writes music that has never existed.
Six of these people are machines. One is a human. That is the design.
### The Undergrad Version
Bṛhaddakṣa solves three specific problems that no existing architecture addresses together:
1. **Long-horizon coherence**: Maintain consistent tone, persona, or task execution across 10,000+ tokens by separating fast execution (token-level Mamba-2) from slow executive control (segment-level Hopfield attractors). The slow tier updates only when the Interface detects a boundary — typically every 16-32 tokens — not every token.
2. **Discrete mode switching**: Use energy-based attractor dynamics (Modern Hopfield Network) to create stable basins separated by energy barriers. Switching modes requires overcoming a barrier — it is discontinuous, not gradual. This is how the brain switches tasks: not by fading from one to another, but by loading a new task set.
3. **Cross-episode learning at inference time**: The Polar Long-Term Memory (Tier 5) stores mode experiences as (θ, r) on a hypersphere. After each episode, successful modes are stored, failed modes become anti-memories (θ + π), and the system warm-starts future episodes from relevant past experience. No retraining required.
### The Grad Version
Bṛhaddakṣa is built on five design principles:
**Principle 1: Timescale separation.** Cognitive functions operate at different speeds. Token generation (~ms) should not be gated by mode selection (~s) which should not be gated by memory retrieval (~episodes). Each tier operates at its natural frequency, with explicit interfaces between timescales.
**Principle 2: Energy-based stability.** Modes should be attractors — stable fixed points in a dynamical system — not flowing states. The Modern Hopfield Network energy E(h) = -h^T · Ξ · softmax(β · Ξ^T · h) has explicit minima at learned patterns. Small perturbations return to the basin. Large perturbations (boundary signals, meta-tier overrides) can jump basins.
**Principle 3: Geometric unification.** All tiers speak one language: rotations on a hypersphere. Tier 1 receives rotations (Polar FiLM). Tier 3 holds positions (Hopfield attractor). Tier 5 stores positions (θ, r). Tier 6 discovers gaps (coverage map). Tier 7 originates positions (human seeds). This means retrieved memories are immediately usable as modulation parameters — no lossy transformation.
**Principle 4: Self-monitoring.** The meta-tier (Tier 4) maintains a self-model: "I am in attractor #7. The goal requires simple, playful explanations. Attractor #7 is formal and dense. Mismatch detected. Override to attractor #12." This is not consciousness — it is a second-order control system that evaluates the controller against external criteria.
**Principle 5: Honest boundaries.** The architecture explicitly marks what the machine can and cannot do. Tiers 1-6 are closed dynamical systems on the hypersphere. Tier 7 is the only open boundary — human-originated ideas that the machine cannot generate. This is a design feature, not a limitation to be overcome.
### The Expert Version
The seven-tier architecture:
```
┌─────────────────────────────────────────────────────────────────────────┐
│ K R U T R I M — 7 T I E R S │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ TIER 7 Ideas Layer ┐ "Enormous silence as a narrative mode." │
│ (Human Seeds) │ REQUIRES human input. The mind plants │
│ ★ Transcendent │ seeds the machine cannot originate. │
│ ↓ │
│ TIER 6 Curiosity Engine ┐ "Let's explore around the new idea." │
│ (Polar Explorer) │ Maps the hypersphere. Finds the gaps. │
│ System-lifetime │ │
│ ↓ │
│ TIER 5 Permanent Memory ┐ "The idea worked. Storing it." │
│ (Polar LTM) │ Anti-memories: what NOT to do. │
│ Cross-episode │ │
│ ↓ │
│ TIER 4 Meta-Cognition ┐ "Am I holding this mode correctly?" │
│ (Self-Model) │ Consults memory, curiosity, and ideas.│
│ Task-level │ │
│ ↓ │
│ TIER 3 Slow Executive ┐ "Hold this mode steady." │
│ (Hopfield) │ Attractor seeded by idea/memory/UCB. │
│ Episode-level │ │
│ ↓ │
│ TIER 2 Interface ┐ "Scene changed." │
│ (Segment Encoder) │ │
│ Segment-level │ │
│ ↓ │
│ TIER 1 Fast Execution ┐ "Type the next word." │
│ (Mamba-2 + │ Rotational modulation from Tier 3. │
│ Polar FiLM) │ │
│ │
│ TIERS 1-4: Ephemeral (within episode) │
│ TIERS 5-6: Permanent (autonomous, across episodes) │
│ TIER 7: Transcendent (human-originated, from outside the system) │
│ │
└─────────────────────────────────────────────────────────────────────────┘
```
The polar coordinate framework:
- FiLM injection: h'_l = γ_l ⊙ h_l + β_l, where (γ_l, β_l) are generated from the slow state via tiny hypernetworks (~2% parameter overhead)
- Hopfield dynamics: h^(k+1) = Ξ · softmax(β · Ξ^T · h^(k)), converging in 1-3 steps to an energy minimum
- Memory storage: (θ_k, r_k, key_k, outcome_k, age_k, access_k, is_anti_k) per slot
- Coverage estimation: von Mises-Fisher kernel density on S^(d-1)
- Explore-exploit: UCB adapted for angular space
---
## 6. Why It Might Be Better
### The High School Version
Because it is organized like a mind, not like a spreadsheet.
Your brain does not re-process every memory you have ever had before deciding what to say next. Your brain has:
- Fast circuits for speaking (motor cortex)
- Medium circuits for noticing when the conversation changed topic (anterior cingulate)
- Slow circuits for holding your intention (prefrontal cortex)
- Memory circuits that remember what worked (hippocampus, basal ganglia)
- Curiosity circuits that make you try new things (dopamine system)
Bṛhaddakṣa copies this organization. It is not the only way to build AI. But it is the way that a billion years of evolution converged on for managing long, coherent, adaptive behavior.
### The Undergrad Version
Bṛhaddakṣa offers potential advantages in three domains:
**Efficiency**: The slow tier updates every K tokens (K=16-32), not every token. The meta-tier checks every N segments (N=5-10). The memory and curiosity tiers operate only at episode boundaries. For a 10,000-token generation, the slow tier updates ~500 times. A full Transformer attention layer would compute 10,000×10,000 = 100 million pairwise interactions. Even with optimizations, this is orders of magnitude more computation.
**Coherence**: By explicitly separating "what mode are we in?" (slow tier) from "what word comes next?" (fast tier), the system can maintain mode stability across arbitrarily long sequences. The slow state h^slow is a 64-dimensional vector. It costs nothing to hold. It costs nothing to check. It is not re-derived from 10,000 tokens of context.
**Adaptivity**: The system learns from its own experience at inference time. If "formal mode" fails for a particular user, it stores an anti-memory. Next time that user appears, it warm-starts from a different mode. This is not fine-tuning — no gradient computation, no data collection, no server restart. It is behavioral learning in real time.
### The Grad Version
The theoretical advantages:
**Attractor-based stability**: The Hopfield energy landscape provides mathematical guarantees. For β > ln(P-1), the stored patterns ξ_i are stable fixed points with basins of attraction. The system resists noise (adversarial perturbations, ambiguous inputs) by returning to the nearest basin. This is robustness-by-design, not robustness-by-scale.
**Circular mean prevents catastrophic forgetting**: In Cartesian space, the mean of [1, 0, ..., 0] and [-1, 0, ..., 0] is [0, 0, ..., 0] — both memories are destroyed. In polar coordinates, the circular mean of 0° and 180° is undefined (orthogonal), and the mean of similar angles (e.g., 30° and 35°) is 32.5° — both memories are preserved. Angular separation is geometric isolation.
**UCB on the sphere**: The explore-exploit tradeoff has a natural geometric interpretation. Exploitation = rotate toward nearest high-confidence memory. Exploration = rotate toward the farthest point from all memories. The coverage fraction is computable: Σ_k ω_k / A_d, where ω_k is the solid angle of memory k's neighborhood and A_d is the total surface area of S^(d-1). This is not a heuristic — it is a well-defined optimization.
**Human-machine complementarity**: The architecture formalizes a division of labor. Humans are good at ideation, metaphor, qualitatively new directions. Machines are good at persistence, precision, scale, exploration of defined spaces. Bṛhaddakṣa gives each partner what the other lacks. The human provides the angle. The machine provides the rotation.
### The Expert Version
The research hypotheses that, if true, would make Bṛhaddakṣa superior:
1. **Timescale separation improves long-horizon coherence**: Decoupling local fluency (fast tier) from global control (slow tier) allows each to optimize for its objective without interference. The fast tier optimizes perplexity. The slow tier optimizes mode stability. These can conflict — a locally surprising word might be globally coherent (e.g., a genre-defying metaphor at the right moment).
2. **Learned attractors acquire semantic meaning without labels**: The four-term loss (L_LM + λ₂·L_attractor + λ₃·L_transition + λ₄·L_energy) should induce attractor basins that correspond to human-interpretable modes. Linear probing of h_t for phase/tone/topic labels should achieve >80% accuracy after Phase 2 training.
3. **Intermediate FiLM outperforms output modulation**: Modulating intermediate layers changes the dynamics of the fast tier, not just its final outputs. This is a causal pathway, not a post-hoc filter. Ablations should show that final-layer-only modulation underperforms multi-layer FiLM.
4. **RL refinement of the slow tier yields measurable gains**: Delayed rewards (coherence scores across full episodes) can shape global structure better than local next-token losses. This is the slow-tier equivalent of test-time scaling.
5. **Attractor structure transfers across tasks**: "Formal mode" learned on emails should transfer to formal essays without slow-tier retraining. The attractor is a reusable behavioral primitive.
---
## 7. Why the Full Architecture Makes Sense (Honest Assessment)
### The High School Version
It makes sense because it is the simplest way to solve three problems at once:
- Problem 1: "I forget what I am doing." → Solution: A conductor who writes the program on a card and holds it for the whole concert.
- Problem 2: "I drift between styles." → Solution: The conductor's card has grooves. It stays in the groove until someone physically lifts it to a new groove.
- Problem 3: "I never learn from experience." → Solution: A library in the basement where the critic writes notes after every concert.
The architecture is modular. Each tier has one job. They talk to each other through well-defined messages. If one tier breaks, the others keep working.
### The Undergrad Version
The architecture makes sense because it respects the **separation of concerns**:
| Function | Tier | Why It Is Separate |
|---|---|---|
| Token fluency | Fast (Mamba-2) | Needs O(1) memory, fast recurrence, local coherence |
| Boundary detection | Interface | Needs different statistics (entropy, punctuation) than token prediction |
| Mode holding | Slow (Hopfield) | Needs energy-based stability, not flow-based recurrence |
| Self-evaluation | Meta | Needs goal representation, not just text statistics |
| Experience storage | Memory | Needs persistence, consolidation, anti-memories |
| Discovery | Curiosity | Needs coverage estimation, UCB, exploration logging |
| Ideation | Ideas | Needs human input by design |
Each tier optimizes a different objective. The fast tier minimizes perplexity. The slow tier minimizes energy (stays in basins). The meta-tier maximizes goal-match. The memory tier maximizes outcome prediction. The curiosity tier maximizes coverage. These objectives can conflict — a locally surprising word (high perplexity) might be globally appropriate (good mode match). Separation allows tradeoffs.
### The Grad Version
The architecture makes sense mathematically because:
1. **The polar coordinate unification is dimensionally consistent**: If the fast tier has dimension d, Polar FiLM operates on d/2 pairs → num_pairs = d/2. The Hopfield slow state can have dimension D_slow ≪ d (e.g., 64). The hypernetwork maps D_slow → d. The memory bank stores (θ, r) with num_pairs angles and magnitudes. Every tier operates on the same angular variables.
2. **Timescale separation is justified by singular perturbation theory**: When ε = τ_fast / τ_slow ≪ 1, the fast dynamics can be approximated as instantaneously relaxing to a manifold parameterized by the slow variables. This is the **adiabatic approximation** from physics. Bṛhaddakṣa sets ε ≈ 1/16 to 1/32 (one slow update per 16-32 tokens), which is small enough for the approximation to hold.
3. **The Hopfield capacity is exponential**: Modern Hopfield networks with energy E(h) = -h^T · Ξ · softmax(β · Ξ^T · h) can store ~2^(D_slow/2) patterns. For D_slow = 64, this is ~2^32 ≈ 4 billion patterns. In practice, the effective number of semantic modes is much smaller (dozens to hundreds), so capacity is not a constraint.
4. **The circular mean is the correct statistic for angular data**: The arithmetic mean of angles is not a consistent estimator on the circle. The circular mean (atan2 of mean sines and cosines) is the maximum likelihood estimator for von Mises-Fisher distributed data. Using it for memory consolidation is statistically principled.
### The Expert Version
The architecture makes sense as a **research program** because it asks answerable questions:
1. Does timescale separation improve 10K-token coherence? (Testable: compare HiT-LM vs. pure Mamba-2 on narrative consistency benchmarks)
2. Do learned attractors acquire semantic meaning without labels? (Testable: linear probe h_t for annotated phase labels)
3. Is intermediate FiLM more effective than output modulation? (Testable: ablation study)
4. Does RL refinement yield measurable coherence gains? (Testable: Phase 2 vs. Phase 2+3 evaluation)
5. Does the attractor structure transfer across tasks? (Testable: train on emails, test on essays)
6. Does Polar LTM warm-start outperform cold-start? (Testable: episode 1 vs. episode N with memory)
7. Do anti-memories prevent repeated failures? (Testable: adversarial user simulation)
8. Does curiosity discover modes that training missed? (Testable: coverage fraction vs. downstream performance)
9. Do human-planted ideas produce modes unreachable by exploration alone? (Testable: idea-seeded vs. machine-discovered modes on creative writing tasks)
10. Does HRR holographic encoding improve memory capacity and graceful degradation? (Testable: capacity and corruption-resistance benchmarks)
Each question has a clear metric, a clear experimental design, and a clear falsification condition. This is good science. The architecture is valuable even if some hypotheses are falsified — negative results are results.
---
## 8. What This Architecture Lacks (Honest Criticism)
### The High School Version
It is not built yet. The design is a blueprint. Blueprints are not houses.
More specifically:
1. **It has never generated a single real word.** The weft prototype exists as a NumPy simulation. It proves the math works in isolation. It does not prove the system works as a language model.
2. **The connective tissue is missing.** Seven independent calculators are not a system. The orchestrator that sequences them, the feedback loops that connect them, the state persistence that lets them learn across episodes — these are designed but not fully implemented.
3. **It assumes Mamba-2 works well enough as a base.** Mamba-2 has known weaknesses: in-context copying, few-shot learning, complex reasoning. Bṛhaddakṣa does not fix these. It adds coherence on top of a substrate that may be weaker than Transformers at some tasks.
4. **Training is going to be hard.** Four loss terms competing with each other is inherently unstable. The slow tier might collapse to zero (no effect). The attractors might all merge into one (no transitions). The model might lose fluency.
5. **It breaks all the standard tools.** This architecture does not work with vLLM, TGI, speculative decoding, or standard quantization. Deploying it in production requires building custom infrastructure.
### The Undergrad Version
**Critical gaps in the current implementation:**
1. **Orchestrator truncated**: The episode lifecycle loop (begin → generate segments → end) is incomplete. Without it, tiers compute but do not sequence.
2. **No inter-tier feedback wiring**: Tier 3's state does not feed into Tier 1's FiLM. Tier 4's override does not reach Tier 3. Tier 5's warm-start does not seed Tier 3. Tier 6's exploration targets do not reach Tier 3. Tier 7's ideas do not reach any tier.
3. **No cross-episode memory persistence**: Tier 5 computes correctly in a single pass but does not carry state between episodes. The system cannot learn from experience.
4. **All weights are random**: The weft uses fixed random seeds. No training has occurred. No gradient flow. The attractor landscape is random. The meta-tier's mismatch detection is random.
5. **Trigram hash instead of semantic encoder**: Tiers 4, 5, and 7 use character-level hashing instead of sentence embeddings. Goal analysis, memory retrieval, and idea encoding are syntactic, not semantic.
6. **SSM state resets per invocation**: The fast tier's Mamba-2 cache does not persist across segments. Local temporal coherence within the fast tier is broken.
7. **Boundary signal does not gate slow-tier updates**: The slow tier updates unconditionally every segment, defeating timescale separation.
**Known risks even if implemented:**
1. **Mamba-2 weaknesses persist**: In-context copying, few-shot learning, and reasoning are not addressed by the slow tier.
2. **Training instability**: Multi-objective optimization with competing losses can diverge. The four-term loss requires careful balancing.
3. **Interpretability gap**: Learned attractor patterns may not be human-nameable. The system may encode "formal + slightly angry + technical" as a single pattern that defies description.
4. **Ecosystem fragility**: Custom forward passes break compatibility with standard serving infrastructure.
### The Grad Version
**Architectural limitations that are fundamental, not fixable by engineering:**
1. **The dimensionality is fixed at training time**: Tier 7's most radical form (dimensional expansion) requires re-initializing hypernetworks and retraining Polar FiLM. The hypersphere cannot grow without architecture surgery. This is a genuine constraint: the system's geometric vocabulary is finite.
2. **Ideas require a human**: By design. This is honest but limiting. Systems that need human input for novelty cannot operate autonomously in novel situations. They are tools for human-machine partnership, not autonomous agents.
3. **Curiosity is bounded by the sphere**: Tier 6 explores the surface of S^(d-1). It cannot explore outside the sphere. If the training distribution did not cover "ironic compassion as a narrative mode," no amount of spherical exploration will discover it. Curiosity finds gaps within the known space, not outside it.
4. **The polar coordinate choice assumes rotational structure**: Polar FiLM applies 2D rotations to dimension pairs. This assumes that meaningful transformations in the fast tier's hidden space are approximately rotations. If the true structure is translations, scalings, or more general affine transformations, the polar restriction is a bias that may hurt performance.
5. **Timescale separation assumes boundaries are detectable**: The Interface's boundary detector must reliably detect mode transitions. If boundaries are gradual (e.g., a story slowly transitioning from comedy to tragedy over 1000 tokens), the K-token chunking will miss the transition. Adaptive K (based on entropy or punctuation) helps but does not solve the general case.
### The Expert Version
**Honest assessment of what might not work:**
1. **The four-term loss may not produce meaningful attractors**: L_attractor (||h_t - h_{t-1}||² within phases) encourages stability but may encourage collapse to a single fixed point. L_transition (phase classification accuracy) requires phase labels, which are expensive. L_energy (-log max softmax) may push patterns apart so far that transitions become impossible. The balance between these is delicate and may not have a stable solution.
2. **Polar FiLM may not outperform Cartesian FiLM**: The restriction to rotations (orthogonal transformations with det=+1) may be too narrow. Cartesian FiLM (γ ⊙ h + β) can express any affine transformation per dimension. Polar FiLM couples dimensions in pairs, which may lose useful degrees of freedom. The geometric elegance does not guarantee functional superiority.
3. **The Hopfield patterns may not acquire semantic meaning**: Even with the right loss functions, the learned patterns Ξ might encode statistical regularities of the training data that do not correspond to human-interpretable modes. Linear probing may fail. The system would still function (stable basins exist) but would not be interpretable or controllable.
4. **Meta-tier override may hurt more than help**: A self-monitoring system that can force transitions introduces a new failure mode: false positives. If the mismatch detector fires incorrectly, the system will switch modes mid-episode for no reason, destroying coherence. The override threshold must be tuned very conservatively.
5. **Memory consolidation may destroy nuance**: The circular mean preserves direction but blurs distinctions. Five similar memories merge into one. If the distinctions matter (e.g., "formal for legal documents" vs. "formal for scientific papers"), consolidation loses them.
6. **Curiosity exploration may be unsafe**: The system deliberately tries modes it has never used. Some will be bad. Some may be offensive. The safety mechanisms (anti-memory repulsion, safety classifier, sandboxed exploration) are designed but not tested.
7. **The quantum coherence hypothesis is not part of the engineering**: The philosophy that motivates Tier 7 (that genuine ideation requires quantum coherence) is not implemented, not tested, and not required for the architecture to function. It is the spark, not the fuel. If the hypothesis is wrong, Tier 7 still functions as a human steering interface.
---
## 9. What This Model Could Improve On
### The High School Version
If this works, the next questions are:
1. **Can it learn faster?** Right now, it stores memories one episode at a time. Could it learn from a single example? Like a child who touches a hot stove once and never does it again?
2. **Can it explain itself?** If the conductor picks "jazz mode," can it tell you why? "I picked jazz because last time you smiled during the jazz section, and the library says you like upbeat things."
3. **Can it compose ideas?** Not the machine — the partnership. Can the human say "mix the sadness of rain with the excitement of a roller coaster" and the machine hold that impossible combination steady for 10,000 words?
4. **Can it fix its own mistakes?** If the slow tier collapses to zero (no effect), can the meta-tier detect this and re-initialize? Can the system diagnose its own failures?
5. **Can it work with other models?** Use a Transformer for reasoning, a Mamba for fluency, and Bṛhaddakṣa for coherence — all in one system.
### The Undergrad Version
**Engineering improvements:**
1. **Holographic memory encoding**: The holonomic critique (Document 15) identifies six gaps. Holographic memory (Holographic Reduced Representations via FFT circular convolution) could replace point-based memory with distributed interference patterns, improving capacity and graceful degradation under corruption.
2. **Compositional mode binding**: Instead of monolithic attractors ("formal"), use compositional primitives ("formal" ⊗ "friendly" ⊗ "technical") bound via HRR bind/unbind. This would exponentially increase the effective number of modes without increasing the number of learned patterns.
3. **Fourier-domain memory operations**: Store and retrieve memories in the frequency domain rather than the spatial domain. This could reduce interference and improve retrieval precision.
4. **Dimensional expansion without retraining**: A mechanism to add new dimension pairs to the hypersphere at inference time, incrementally expanding the geometric vocabulary without architecture surgery.
5. **Multi-modal extension**: Apply the same timescale separation to vision, audio, and action. The slow tier could hold "we are in a conversation" while the fast tier processes speech tokens, visual frames, and motor outputs simultaneously.
**Training improvements:**
1. **Curriculum learning for the slow tier**: Start with high λ₁ (language modeling loss), gradually introduce λ₂ (attractor stability), λ₃ (transition accuracy), λ₄ (energy), λ₅ (memory). This prevents the slow tier from collapsing early in training.
2. **Meta-tier pre-training on synthetic tasks**: Generate synthetic episodes with known phase labels, known goals, and known outcomes. Pre-train the meta-tier on this before joint training.
3. **Contrastive pre-training for the Interface**: Train the boundary detector on a corpus with explicit segment boundaries (dialogue turns, scene changes, paragraph breaks). This provides supervision for a module that otherwise has no direct training signal.
4. **Offline RL for memory and curiosity**: Use logged episodes (with human feedback or automated outcome scores) to train the memory retrieval policy and exploration strategy without online interaction.
### The Grad Version
**Research directions:**
1. **Test the holographic hypothesis**: Does HRR encoding improve memory capacity? Measure: how many distinct modes can be stored before retrieval accuracy drops below threshold? Compare point-based vs. holographic under controlled corruption.
2. **Compositional generalization**: Train on atomic modes (formal, casual, technical, playful). Test on compositional modes (formal+playful, technical+casual). Does the system generalize to unseen compositions via HRR binding? This is the critical test of whether the architecture achieves systematic compositionality.
3. **Transfer learning of attractors**: Train the slow tier on one domain (creative writing). Freeze it. Fine-tune only the fast tier on another domain (technical documentation). Does the "formal" attractor from creative writing transfer to technical writing? If yes, attractors are domain-independent behavioral primitives.
4. **Human evaluation of idea efficacy**: Collect human ratings of episodes generated with human-planted ideas vs. machine-discovered modes vs. baseline. Is there a measurable difference in novelty, coherence, or quality?
5. **Safety evaluation of curiosity**: Design red-team scenarios where curiosity exploration targets harmful modes. Measure the effectiveness of anti-memory repulsion, safety classifiers, and graduated exploration at preventing harmful output.
6. **Scaling laws for timescale separation**: As model size increases (130M → 1.3B → 7B → 70B), what is the optimal K (segment length), D_slow (attractor dimension), and P (number of patterns)? Do these hyperparameters scale with model size, or are they task-dependent constants?
### The Expert Version
**Deep questions:**
1. **Is the polar restriction necessary?** Ablate: train one model with Polar FiLM and one with unconstrained FiLM (separate γ, β per dimension). If unconstrained outperforms, the geometric unification was a beautiful mistake. If polar matches or exceeds, the restriction provides useful inductive bias.
2. **Can the meta-tier be made self-improving?** If the meta-tier's override decisions are logged with outcomes, can it learn to override better over time? This creates a second-order learning loop: the system learns how to learn.
3. **Does the architecture exhibit emergent timescale separation without explicit design?** Train a standard Mamba-2 model with only the four-term loss, no explicit slow tier. Do the hidden states spontaneously separate into fast and slow manifolds? If yes, the explicit separation is a useful scaffold that might become unnecessary at scale. If no, the explicit design is necessary.
4. **What is the minimum viable architecture?** Bṛhaddakṣa has seven tiers. Can three tiers (Fast + Slow + Memory) achieve 80% of the benefit? Can two? Understanding the Pareto frontier of complexity vs. benefit is essential for practical adoption.
5. **Can the architecture be made biologically plausible?** Map each tier to specific brain regions and test whether the model's behavior matches lesion studies. If the meta-tier is "lesioned" (disabled), does the system exhibit perseveration (inability to switch modes)? If memory is lesioned, does it exhibit anterograde amnesia? Biological plausibility is not a requirement for engineering success, but it is a powerful validation criterion.
6. **The ultimate question**: Does any of this matter if scale continues to win? If a 1-trillion-parameter Transformer with 10-million-token context and test-time reasoning solves all these problems by brute force, Bṛhaddakṣa is a beautiful research curiosity. If brute force hits a wall — and the O(N²) wall is real — then architectural innovations like timescale separation may be the only path forward.
---
## ⚠️ Honest Boundaries
**Bṛhaddakṣa is NOT:**
- ❌ Conscious — no interiority, no qualia, no subjective experience
- ❌ Alive — no metabolism, no homeostasis, no evolution
- ❌ Quantum — all computation is classical floating-point on GPUs
- ❌ A mind — it cannot have ideas. That is the human's role.
**Bṛhaddakṣa IS:**
- ✅ A structural model of expertise with seven timescales
- ✅ A research direction for long-horizon generation with memory, curiosity, and human-machine creative partnership
- ✅ Honest about what it can and cannot do — and honest about where the machine ends and the mind begins
---
## 🧭 When to Use What
```
Factual recall? → RAG
Behavioral recall? → Polar LTM (Tier 5)
Discover new modes? → Curiosity (Tier 6)
Inject a concept the machine can't? → Ideas Layer (Tier 7)
Short, single mode? → System prompt
Hard math/logic? → Test-time scaling (o1)
Long creative, dynamic tones? → Bṛhaddakṣa (full stack)
```
---
## 📚 The Full Architecture (18 Documents)
| # | Document | What You'll Learn |
|---|---|---|
| 0 | [`docs/00_for_highschoolers.md`](docs/00_for_highschoolers.md) | The whole architecture explained with theater analogies |
| 1 | [`docs/01_philosophy.md`](docs/01_philosophy.md) | Why monks drying towels and expert drivers are our inspiration |
| 2 | [`docs/02_transformer_problems.md`](docs/02_transformer_problems.md) | What's broken in Transformers and Mamba — with analogies |
| 3 | [`docs/03_original_proposal.md`](docs/03_original_proposal.md) | Our first idea: Mamba-2 + "Coherence Field" |
| 4 | [`docs/04_critique.md`](docs/04_critique.md) | Honest autopsy: 7 flaws that killed the first design |
| 5 | [`docs/05_hitlm_architecture.md`](docs/05_hitlm_architecture.md) | **HiT-LM redesigned** — FiLM, Hopfield, timescale separation |
| 6 | [`docs/06_training.md`](docs/06_training.md) | Three-phase training: pretrain → joint → RL |
| 7 | [`docs/07_ascii_diagrams.md`](docs/07_ascii_diagrams.md) | 11 ASCII visualizations — memory, energy, FiLM, batch hygiene |
| 8 | [`docs/08_honest_assessment.md`](docs/08_honest_assessment.md) | What this IS (long-horizon coherence) and IS NOT (consciousness) |
| 9 | [`docs/09_metacognition.md`](docs/09_metacognition.md) | **Tier 4** — the critic who knows the pattern is wrong |
| 10 | [`docs/10_simpler_methods.md`](docs/10_simpler_methods.md) | When to use Bṛhaddakṣa vs. simpler tools |
| 11 | [`docs/11_polar_film.md`](docs/11_polar_film.md) | **Polar FiLM** — rotational mode encoding in polar coordinates |
| 12 | [`docs/12_polar_ltm.md`](docs/12_polar_ltm.md) | **Tier 5** — permanent hyperspherical memory with anti-memories |
| 13 | [`docs/13_polar_curiosity.md`](docs/13_polar_curiosity.md) | **Tier 6** — curiosity-driven exploration on the hypersphere |
| 14 | [`docs/14_ideas_layer.md`](docs/14_ideas_layer.md) | **Tier 7** — human-originated ideas as angular seeds |
| 15 | [`docs/15_holonomic_critique.md`](docs/15_holonomic_critique.md) | **Holonomic critique** — what works, 6 gaps to close |
| 16 | [`docs/16_weft_blindspots.md`](docs/16_weft_blindspots.md) | **Weft prototype audit** — 15 blindspots between skeleton and system |
| 17 | [`docs/17_build_plan.md`](docs/17_build_plan.md) | **Full system build plan** — 15 phases from code to training |
| 17a | [`docs/17a_build_plan_explained.md`](docs/17a_build_plan_explained.md) | **Build plan explained from the very beginning** |
---
## 📎 Citation
```
@misc{brhaddaksa2026,
title={Bṛhaddakṣa: Hierarchical Timescale Language Model with Polar Coordinate
Memory, Curiosity, and Human-Originated Ideas},
author={Research Notes},
year={2026},
url={https://huggingface.co/nkshirsa/Bṛhaddakṣa}
}
```
---
**Repository:** [https://huggingface.co/nkshirsa/Bṛhaddakṣa](https://huggingface.co/nkshirsa/Bṛhaddakṣa)
**License:** Research architecture — implementation code will follow.
> *"The monastery holds the practice. The practice enables the insight. But the spark is not the monastery. Bṛhaddakṣa is the monastery. Tier 7 is where the human walks in with the spark."*
<!-- ml-intern-provenance -->
## Generated by ML Intern
This model repository was generated by [ML Intern](https://github.com/huggingface/ml-intern), an agent for machine learning research and development on the Hugging Face Hub.
- Try ML Intern: https://smolagents-ml-intern.hf.space
- Source code: https://github.com/huggingface/ml-intern
## Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = 'nkshirsa/Brhaddaksa'
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
```
For non-causal architectures, replace `AutoModelForCausalLM` with the appropriate `AutoModel` class.