Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-architecture-mv/issues/33fd5d0dfa424d1c # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers # Flint on Spark: native Omega integration, memory/expert crossover qualification and local specialization Open · #353 · open 2026-10-29 20:49 UTC Imported from GitHub aien-dev/aien-architecture-mv#353, by drakestapleton drakestapleton wrote on 2026-10-29 20:49 UTC Source evidence, 2026-10-29: Flint config and executable reference implementations establish 49 layers, first 2 dense, 47 MoE layers, 256 experts/layer, top-6 sigmoid routing, shared width 1024, routed width 512, hidden width 2048, 35 sliding layers (513 positions) and 14 full attention layers. Wolfram evaluated the formulas below. Native Flint implementation, checkpoint-header inventory, Spark benchmarks and training remain NOT_RUN. ## Executive summary Prepare a native Omega Flint candidate carrying forward applicable 30B/35B optimizations and a bounded Spark fine-tuning path. This finite workstream extends existing serving/training owners under CURRENT_EXECUTION_PLAN.md and release desk #190. Status PROPOSED; executor unassigned. Filing issues does not claim an active hardware job. ## Sources and inspected code - https://huggingface.co/RecursiveSI/flint and /blob/main/config.json (config page identifies `2a247be`; full revision and file hashes still required). - https://github.com/huggingface/transformers/blob/main/src/transformers/models/flint/modeling_flint.py inspected blob `746898fe08c2aba8152b00f2b8e7fb9ebe686e0c`. - https://github.com/ggml-org/llama.cpp/blob/master/src/models/flint.cpp inspected blob `e7e6f6b792df45b079434de06e1b372e829de13a`. - Core qwen38_engine.rs: Qwen-specific admission, post-lock memory admission, GPU greedy sampling; omega_engine.rs blob `fe4e29338a6f08899ca2df6dc7fe17fdd42bf458`: resident weights, whole-prompt prefill, device routing/combine, persistent prefixes. - Core qwen36_batch.rs blob `476f138a71e4107a7647326e2c0e523564b494a6`: RowStep, bounded slots, prompt chunks, reuse, cancellation/backpressure. Stage-1 comments coexist with later stroke support; inspect consumed native archive before declaring actual batching behavior. - Existing delivery: aien-sovereign-core-mv#742 (35B bytes), #753 (.om migration), #797 (canonical CUDApp admission), #715 and #710-#721 (27B reuse/quantization/speculation/tool contracts); CUDApp#33; aien-train#6. Reconcile current PRs/comments and archived work before edits. ## Architecture and weight map Zero-based dense layers 0,1; routed expert banks in layers 2..48, expert IDs 0..255 separately per layer. Full attention at 0,1,5,9,13,17,21,25,29,33,37,41,45,48. Read layer_types verbatim. Expected logical tensors: Q [4096,2048], K/V [512,2048], O [2048,4096]; per-head Q/K norms width 128; learned 32 sink logits. Expert gate/up each [512,2048], down [2048,512]; shared gate/up [1024,2048], down [2048,1024]. Dense gate/up [6144,2048], down [2048,6144]. Router [256,2048]. Untied embedding and head each [150144,2048]. Per-expert tensors in checkpoint are fused in Transformers to gate_up [256,1024,2048], down [256,2048,512]; checkpoint softmax_offset maps to sinks. Exact shard names, offsets, dtype exceptions, packed block sizes and byte ranges must come from headers. No checkpoint payload/header completeness claim yet. ## Calculated budgets, MODELED GiB = bytes/2^30; GB = bytes/10^9. Formula-derived parameter count 39,785,287,456 pending header reconciliation. Routed bank = 4725632048512 = 37,849,399,296 parameters (95.134% of derived total). BF16 bank 70.5 GiB; raw 4-bit bank 17.625 GiB, excluding scales/padding. All-BF16 derived payload 74.1059 GiB. W4 routed bank + BF16 remainder 21.2309 GiB before scales/padding; FP32 router adds 0.0459 GiB. Sinks and accumulation precision must follow numerical contract. BF16 KV logical payload K(B,T)=B2048(14T+35min(T,513)): | tokens/session | 1 session GiB | 8 sessions GiB | |---|---:|---:| |4096|0.143621|1.148972| |49152|1.346746|10.773972| |131072|3.534246|28.273972| |262144|7.034246|56.273972| Page rounding, rollback/copy-on-write, allocator backing, activations, prefill/quantization scratch, metadata, OS reserve and other resident services are additional. Admit against actual available bytes after taking the existing device lock. Separate load peak, steady-state and training peak. Retaining full history in sliding layers forfeits most savings. ## Three crossovers - Expert overlap: under independent uniform top-6 routing, U(B)=256*(1-(1-6/256)^B). B=1,2,4,8 gives 6,11.859375,23.169356,44.241763 distinct experts per layer. At B=8 selection reuse=48/U=1.084948. This model is a null hypothesis; capture actual per-layer frequencies, skew, co-occurrence, unique experts and temporal reuse. - KV versus weight traffic: ideal single-read-per-stroke model with W4 routed experts, BF16 other matrices/head, FP32 router gives weight bytes 3.`749617216`,4.`182769216`,5.`0188551535`,6.`5766245688` GB for B=1,2,4,8. BF16 KV read traffic equals those around T=129494,71659,42478,27389 respectively. These are analytical traffic crossovers, excluding scale loads, repeated GQA reads, launches and bandwidth variation. They are not measured latency crossovers or guaranteed ceilings. - Flint versus incumbent / GEMV versus grouped GEMM / speculation versus plain decoding: UNKNOWN until matched hardware trials. Measure effective bandwidth and compute per path; t_step >= max(bytes/BW_eff,FLOPs/F_eff) is a lower bound, with launch/sync/queue costs measured separately. No speed claim from total/active parameters. ## Carry-forward ledger Reuse resident single-copy weights, bounded streaming load, cached GPU scratch and CPU-visible control separation, command-list replay, fused norm/residual/projections, on-device route/combine and sampling, shape-keyed kernel cache, small-M/large-M path selection, whole/chunked prefill, concurrent rows, complete-state prefix reuse, cancellation/backpressure, tracing and admission. Adapt rather than copy Qwen DeltaNet-specific state/overlap or tokenizer constants. Flint requires sink-aware attention, correct sliding masks, selective RoPE, FP32 sigmoid routing/normalization and ungated shared expert. Qualify greedy head screening separately from sampled full logits. Speculation requires a verified compatible draft method and complete rollback; do not assume Flint ships Qwen MTP weights. First-party implementation/tests/build automation in seeded .om, canonical CUDApp device boundary, existing serving and training owners. Third-party inference/training tools are separately pinned independent references. ## Training direction User explicitly requests specialization on Spark. Start frozen-base attention LoRA ranks 8/16/32, router/sinks frozen, with compiled-and-tested Omega examples and tool trajectories. Add expert/shared adapters only after ablation. Attention Q/K/V/O LoRA rank16 has 13,647,872 trainable parameters and approximately 0.203369 GiB at 16 bytes/trainable parameter, excluding base and activations. Full-model mixed Adam state at 16 bytes/parameter is approximately 592.847 GiB before activations. Local adapter feasibility remains a measurement gate. Quantized inference support alone does not establish backward/QLoRA support. ## Research/tool status Undermind found The Cost of Expertise: Understanding MoE Decode Performance (2026) and Every Expert Counts: ExactMoE for Memory-Efficient W4A16 Inference (2026). Abstract-level supporting context only; no reported gains transferred to Spark. Wolfram Language evaluations and WolframAlpha agreed on routed count. WolframContext returned internal error; no result claimed from it. PartnerProf knowledge map and manifest reviewed: bounded custom admissibility can represent a declared candidate resource field, but measured scratch/available-memory/throughput and calibrated mappings are absent. No prepared or executed PartnerProf job, certified placement, performance or global optimality claim. Any conclusion would apply only to declared constraints/geometry/tolerances/bounds. Use exact byte accounting and physical measurements first. ## Acceptance and execution order - Immutable checkpoint/header inventory plus independent numerical fixtures. - Single-sequence native correctness with real weights. - Memory/attention and expert execution optimizations, isolated ablations. - Serving, tools, complete reuse and 1/2/4/8-row correctness. - Uncontended Spark comparison across context and workload, then separate adapters. Freeze task quality floors before benchmarks; record TTFT/TPOT p50/p95, queue time, aggregate tokens and successful tasks/minute, bytes, peak memory, energy if instrumented, reasoning tokens and errors. Keep same-model backend parity separate from cross-model quality. Every PR references its issue and records source/compiler/model/tokenizer/template/quantization/archive hashes, commands, raw receipts and discriminating mutants. Preserve current service until a qualified promotion with rollback. Hardware tests NOT_RUN here; no Spark connection was established. ## Delivery ledger - Flint P0: checkpoint tensor inventory and numerically checked native forward path - Flint P1: bounded sliding/full KV, packed experts and measured kernel crossover - Flint P2: serving parity, state reuse and incumbent crossover benchmark - Spark specialization and native adapter training ## Reproducible calculation receipt Executed 2026-10-29 via WolframLanguageEvaluator. Inputs derive from the model config and inspected modeling code; byte results model logical payload and idealized traffic. Alpha independently evaluated `3*2048*512*47*256` as `37849399296`. ``` h=2048; v=150144; e=3*h*512; att=49*(h*4096+2*h*512+4096*h); dense=2*3*h*6144; shared=47*3*h*1024; router=47*256*h; norm=49*(2*h+2*128+32)+h; embed=2*v*h; bank=47*256*e; total=att+dense+shared+router+norm+embed+bank; base=2*(att+dense+shared+v*h)+4*router+2*norm; ew=47*e/2; kv[t_,b_]:=b*2048*(14*t+35*Min[t,513]); {total,bank,N[2*total/2^30],N[(bank/2+2*(total-bank))/2^30], Table[{t,N[kv[t,1]/2^30],N[kv[t,8]/2^30]}, {t,{4096,49152,131072,262144}}], Table[{b,N[256*(1-(1-6/256)^b)], N[(base+ew*256*(1-(1-6/256)^b))/10^9], N[(base+ew*256*(1-(1-6/256)^b)-b*2048*35*513)/(b*2048*14)]}, {b,{1,2,4,8}}]} ``` The equations were executed in component queries; equivalent consolidated reproduction above. Weight/KV output units GiB, stroke traffic GB, crossover positions tokens, expert counts unitless. For sinks the above simplified traffic treats norm scalars at two bytes; FP32 sinks add a small additional correction to a physical inventory. This does not change the reported approximate crossover interpretation. Scale metadata, embedding row lookup, padding and repeated reads remain outside the simplified traffic model. did:key:`z6MkhL6jkVBvyZTg9eMGkJWKQKjnKA1wbA7ym3PkTXt4M6Jd` wrote on 2026-11-18 17:21 UTC Recovered GitHub comment. Original comment `6508887128` Status for Core #802 (P0). Inventory and manifest reader: IMPLEMENTED and EXERCISED on host. Not merged, not GPU-qualified. - Branch `feat/flint-p0-manifest` at `f1259d12`; the PR is queued. - `check.sh` PASS (70): 38 refusal fixtures and 25 guard mutants. - 36734 tensors, `39785287456` parameters total and `37849399296` routed. Both totals match the expectations in this issue (checked with Wolfram). - Inventory TSV sha256 `60ff4dbd…83f5`. Details: https://github.com/aien-dev/aien-sovereign-core-mv/issues/802 The forward path, parity, #803, #804 and aien-train#44 are NOT_RUN. Every Spark measurement needs a GPU window. Sign in to comment