Skip to content
HarqerPublic

About

Personal multimodal LLM using latest 2026 LLM architecture built on MOJO

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

312 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IQ — Hybrid Reasoning LLM

IQ is an experimental language-model architecture for complex coding, long-context retrieval, and adaptive multi-step reasoning.

The production target is not the original Neutrino/Ising mock architecture. IQ v2 uses Mamba-3 MIMO as the dominant token-time sequence/state mixer, DeepSeek V4-family CSA/HCA for long-context addressing, Stable LatentMoE for routed expert computation, and Block AttnRes as the canonical cross-depth residual mechanism. mHC is retained only as an ablation/reference. Reasoning-time recurrence, the EBM critic, and adaptive halting are separate from the physical backbone schedule.

Architecture

text tokens ─→ embeddings ─────────────────────────────┐
images/video ─→ GLM-5.3 vision tower ─→ projector ─→ Mamba-3 visual stream
                                                     │
                                                     ├─ Vamba-style text→visual cross-attention
                                                     ├─ TransV shallow uniform / deep relevance compression
                                                     ↓
heterogeneous backbone
  │
  ├─ M = Mamba-3 MIMO
  │      token-time recurrent sequence/state mixing
  │
  ├─ E = Stable LatentMoE + SiTU-GLU
  │
  ├─ C/H = CSA/HCA + sliding-window context
  │
  ├─ Block AttnRes = cross-depth residual retrieval
  │
  └─ mHC = standalone ablation/reference only
  ↓
reasoning-time latent recurrence
  ↕
optional reasoning verifier (EBM backend available)
  │   candidate scoring / branch ranking / verification
  │   optional evidence for halting
  ↓
adaptive halting
  ↓
Concept Mapper (ablation)
  ↓
MTP + LM head

Optional dense attention remains a teacher/control/fallback path for exact
pairwise comparisons; it is not a mandatory backbone anchor.

Why the hybrid

  • Mamba-3 MIMO (rank 4) is the primary token-time recurrent sequence/state mixer; MIMO is not optional and IQ has no silent SISO fallback.
  • Multimodal IQ uses the native GLM-5.3 vision tower when GLM is the donor. Long visual streams are processed by dedicated Mamba-3 MIMO blocks rather than visual self-attention; text queries visual memory through gated cross-attention. TimeViper-style TransV performs shallow 50% uniform retention and deep 10% attention-guided retention while preserving temporal order. Text-only execution remains unchanged when no visual input is supplied.
  • DeepSeek V4-family CSA/HCA is the production long-context system: sliding-window local attention plus compressed long-range memory and learned sparse selection. Dense attention remains an optional teacher/control/fallback for exact pairwise comparison rather than a required anchor.
  • Stable LatentMoE is the production expert path: full-width sigmoid routing, latent routed experts, post-aggregate RMSNorm, full-width shared experts, SiTU-GLU, and one-step-delayed Quantile Balancing. The older full-width SwiGLU MoE remains an ablation/control.
  • Block AttnRes is the frozen production depth/residual mechanism. mHC remains a standalone ablation/reference and is not composed into the canonical hybrid. Neither is a reasoning controller.
  • Reasoning-time recurrence is separate from Mamba's token-time recurrence and owns iterative latent refinement. The reference path uses a gated residual transition with a continuous spectral depth coordinate. Teacher-forced training requires explicit reasoning_context_lengths so the recurrent state only observes the causal prompt prefix; inference uses the full visible prefix and injects reasoning only at the final prediction source position.
  • ReasoningVerifier is a pluggable scorer over generated reasoning states. The current EBM backend exposes energy as higher-is-better verifier evidence by negating raw energy; recurrence never depends on EBM semantics and verifier evidence cannot mutate the state transition.
  • Adaptive halting is a separate learned head. It uses a deliberate deep-start initialization, differentiable stop/survival weights, state convergence, and optional verifier-stability evidence. The ponder/compute penalty supports an explicit warmup so early training cannot collapse into a shallow-halting equilibrium.
  • MTP is a first-class pretraining objective/head stack rather than an after-the-fact probe.
  • Differential Attention, Coconut-style recurrence, and the Concept Mapper remain ablation-controlled reasoning experiments rather than mandatory backbone stages.

Legacy NIF disposition

The useful ideas from the original NIF design are kept only where they have a defensible mathematical role:

Legacy idea IQ v2 disposition
Neutrino oscillation superseded by Mamba-3 recurrent state dynamics
Ising / Hamiltonian gate retired from the canonical architecture
Scalar energy retained only as an optional learned EBM critic over generated reasoning states
Riemannian manifold isolated research experiment; not part of the canonical backbone or controller
Heterogeneous MoE Stable LatentMoE + SiTU-GLU, with full-width SwiGLU retained as a control
Muon real matrix-gradient/update orthogonalization
GaLore optional memory-constrained optimizer mode
Muon adapters DoRA correction around transported weights
CUDA-Q isolated research backend; never required for production training/inference

IQ does not claim that ordinary language-model reasoning requires quantum hardware.

Weight transfer

iq_transfer/ is the canonical donor-independent transfer package.

Current production flow:

official Mamba-3 MIMO checkpoint
  → exact 2048→4096 lexical/recurrent widening
  → canonical IQ residual frame

GLM-5.3 BF16 capability weights
  → strict operator inspection
  → WARM semi-orthogonal remapping into the Mamba frame
  → MLA→CSA/HCA + DSA + Stable LatentMoE transforms

Mamba foundation + GLM capability modules + IQ-native controllers
  → one IQ checkpoint
  → stabilization/post-training

The official pretrained Mamba-3 MIMO 1.5B checkpoint is IQ's lexical and recurrent foundation. Its 2048-wide representation is widened to IQ's 4096-wide residual frame by exact replication, preserving the pretrained Mamba function on the embedded subspace. GLM-5.3 BF16 is a secondary capability-weight source: GLM53Inspector validates its MLA/DSA + sigmoid-MoE layout, then WARM-style remapping plus IQ-specific algebra transports context/DSA/MoE capability weights into the Mamba-anchored 4096-D frame. GLM does not replace the Mamba tokenizer, embedding, final norm, LM head, or recurrent dynamics. Phi-4 remains a regression/control source.

See:

  • SHADOW_TRANSFER.md
  • IQ_WEIGHT_TRANSFER_IMPLEMENTATION_PLAN.md
  • IQ_V2_IMPLEMENTATION_PLAN.md

Training runtime

Production training target:

For the next authorized full IQ inference job on H200, use the documented PyTorch 2.10/CUDA 12.8 devel image and the repository's complete-inference entrypoint:

# Inside the HF H200 inference job, with a compiled IQ checkpoint mounted:
bash scripts/hf_full_inference.sh /mounted/iq-checkpoint --max-new-tokens 16

The entrypoint verifies checkpoint file presence, creates /opt/iq-venv inheriting image-native CUDA PyTorch, pins Torch/Triton against replacement, installs the pinned Mamba-3 source and TileLang/TVM-FFI pair, then loads the full checkpoint and generates tokens. All of this is one full inference job, not a separate GPU compatibility test. The startup checks validate metadata and GPU/device properties, but cannot prove execution until generation actually runs.

The safe decode fallback is full-prefix MIMO recomputation rather than unverified CuTe step() decoding; no CPU or SISO fallback silently changes the checkpoint architecture. For CUDA toolkit, driver and CuTe limitations, see docs/hf-h200-runtime-compatibility.md.

scripts/verify_mamba3_mimo_h200.py remains available as a training/decode diagnostic, but is not an automatic deployment prerequisite and does not replace complete IQ inference.

  • PyTorch autograd
  • NVIDIA Megatron-Core for distributed parallelism
  • Transformer Engine where numerically validated
  • pinned upstream Mamba-3 MIMO implementation; missing MIMO/TileLang capability is a hard startup error
  • Mojo custom kernels only after forward/backward/state parity
  • MAX for later production inference
  • BF16 reference training before FP8/MXFP8 promotion

The legacy Mojo NIF implementation remains only as migration source until each active path has a tested replacement.

Agent runtime

iq_harness/ provides the model-independent orchestration layer:

  • Agent Skills-compatible loading
  • tools and provider boundaries
  • manager/subagent delegation
  • handoffs
  • sessions
  • approvals
  • guardrails
  • tracing

The trainable IQ model will connect through ModelBackend.generate().

Engineering rules

  • no mock tensor paths on the active model
  • no constant energies or fake checkpoint loaders
  • no placeholder production credentials/resources
  • reference implementation before optimized kernels
  • deterministic checkpoint/resume
  • immutable tokenizer/data/donor manifests
  • every trainable parameter belongs to exactly one optimizer group
  • completed green work is committed and merged into main

Repository status

Implemented today:

  • dense Phi-compatible Transformer control/teacher with packed/padded GQA
  • donor-independent Phi checkpoint inspection and executable transfer job
  • strict GLM-5.3 BF16 donor inspection/provenance gate for MLA/DSA + 256-expert MoE checkpoints
  • lazy safetensors operator access
  • functional-shadow measurements and monotonic layer matching
  • coordinate-map/operator transport + DoRA correction
  • mandatory rank-4 Mamba-3 MIMO runtime wrapper and H200 parity gate
  • explicit heterogeneous HybridSchedule validation
  • executable heterogeneous Mamba-3 MIMO / routed-MoE / dense-attention backbone for implemented layer types
  • packed/padded repository batches converted to Mamba-3 varlen cu_seqlens with document-state isolation
  • Stable LatentMoE/SiTU-GLU reference with full-width sigmoid routing, latent routed experts, full-width shared experts, delayed Quantile Balancing, plus the original routed SwiGLU control
  • K3-style Block AttnRes wired into IQHybridForCausalLM with per-physical-layer depth retrieval and checkpointed configuration
  • canonical hybrid-backbone validator requiring rank-4 Mamba-3 MIMO, Stable LatentMoE, Block AttnRes, and CSA/HCA before production bootstrap
  • sequential shared-embedding/shared-head MTP prediction stack with packed-document-safe causal chaining
  • pretraining wrapper combining NTP/MTP/MoE auxiliary objectives with checkpointed coefficients
  • real-batch H200 hybrid forward/backward and cross-document-isolation gate
  • QK-normalized RoPE dense-context anchor
  • DeepSeek V4-style CSA/HCA full-sequence PyTorch reference with sliding-window branch, learned Lightning indexer, shared K=V MQA, sinks, grouped low-rank output, and packed-document isolation
  • leading RoPE plus interleaved trailing partial/inverse RoPE reference primitives
  • scale-gate metrics
  • adaptive reasoning-time recurrence with spectral depth encoding, differentiable training-time halting, hard inference early exit, and packed-document isolation
  • optional EBM energy/energy-delta features in the halting path with a tested invariant that the critic does not alter the generated state trajectory
  • near-zero gated injection of final reasoning state back into token representations
  • model-independent agent harness

Specified / next runtime integration:

  • begin T1 Phi dense transfer; keep mHC and standard residual as non-blocking ablations rather than reopening the production backbone
  • finish CSA/HCA runtime optimization and parity work; keep dense attention as an optional teacher/control rather than a mandatory anchor
  • train/evaluate recurrence + halting on reasoning/code tasks and calibrate halt thresholds against quality/compute
  • construct successful/failed/corrupted reasoning-state pairs and train the EBM ranking objective before enabling energy-assisted halting by default
  • concept-mapper and continuous-thought ablations
  • real Muon optimizer
  • code-focused FIM/MTP/MoE training

License

See LICENSE and PROPRIETARY_LICENSE.md for repository licensing terms.

About

Personal multimodal LLM using latest 2026 LLM architecture built on MOJO

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages