Repository navigation
Conversation
… reads, read convolutions, per-stream inputs: token tables, n-grams, bytes; narrower streams)
…-variants-2026-10-19b # Conflicts: # src/prime_rl/trainer/models/init.py # src/prime_rl/trainer/models/prime_moe/attention.py # src/prime_rl/trainer/models/prime_moe/modeling_prime_moe.py # src/prime_rl/trainer/models/prime_moe/moe.py
…n-table and n-gram stream
…and narrower streams (no gain in gr-variants)
…ed Residual bottleneck (default off)
… Residual read (default off)
…s; no gain in gr-variants)
…tches specialize it in causal_conv1d)
… streams: no gain)
…-variants-2026-10-19b # Conflicts: # src/prime_rl/trainer/models/init.py
…n the GR variants branch)
…GR variants branch)
…ower streams (default off; kept on the GR variants branch)
… read (default off)
…-variants-2026-10-19b
…utput; add 'output_only' and hc_write_output_zero_init
…tween blocks (default off); hc_stream_stats logs their absmax and RMS per layer
…-variants-2026-10-19b
…the custom autograd Function was skipped in compiled training forwards)
…its), first-K windows for long tokens (hc_byte_first_k); default off
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gated Residual variants for
prime_moe(pretraining)Stacked on #4062 (
feat/pretrain). Options for the pretraining MoE's Gated Residual (GR) connections and residual-stream inputs, used by the GR-variants screen (pretrain-experimentsexperiments/arch/2026-10-19-gr-variants/report.md). All options default off; with them off the model is unchanged (the control's step-1 loss is bitwise identical to2769909d22/ the modern base).New
PrimeMoeConfigfields:hc_qkv_readshc_moe_readshc_qkv_convhc_qkv_conv, residual form, zero-initialized) after the attention read, one per q/k/v input; flacausal_conv1dwithcu_seqlens, so they reset at document boundarieshc_stream_widthdfrom chunks, writes use one scalar per (stream, chunk)hc_stream_inputscopy(default: the token embedding in every stream),tables(one token table per stream), or token tables +ngram/bytesstreams (several joined by_, e.g.ngram_bytes,ngram_ngram,ngram_ngram_ngram; repeated kinds are independent copies with their own hash layouts)hc_ngram_vocab_sizeNGramEmbedding: bi- and trigrams, document- and EOS-aware)hc_byte_window,hc_byte_tableByteWindowEmbedding): the last K UTF-8 bytes ending with each token, pulled within the document from a static token-to-bytes tablehc_byte_addtables) or n-gram stream (ngrams) instead of a byte streamhc_parallel_blockshared_read/separate_reads), both outputs written to all streams with their own scalarshc_writenorm(RMS-normalize the block output before the write),output(write scalars also from the normalized block output, zero-initialized term),channel(a gate per stream and channel from the read's bottleneck)Where the code lives: the generic, default-off
HyperConnectionextensions (read_count,write_count,stream_width, the read convolution,write_mode) are in the sharedmodels/layers/hyper_connection.py(which Qwen3.8-Flash-Next also uses; its defaults keep the original kernels, and the Qwen3.8 tiny-model forward is unchanged); everything prime_moe-specific (stream inputs,ByteWindowEmbedding, separate attention / MoE inputs, the parallel block) is inmodels/prime_moe/. Supporting changes: the attention and the MoE accept separate inputs (separate q/k/v inputs needmodel.fusionswithoutqkv);init_weightszero-initializes the read convolutions; GR projections and convolutions train with AdamW (existinghyper_connectionrole); extra embedding tables, n-gram and byte tables are embedding-role parameters (AdamW, weight decay as the token embedding); grad norms of extra tables log underembed.Checks (details in the report): control step-1 loss bitwise equal to the base tree (and, after merging
feat/pretrain5c0bfa6129, bitwise equal to unmodifiedfeat/pretrain: 11.792655944824219 on the d384 control; the Qwen3.8-Flash-Next tiny-model forward is identical onfeat/pretrainand the merged branch); byte windows equal a direct reference on packed multi-document rows (K 16 / 32); n-gram ids reset at document starts; each later commit leaves the previous configs' step-1 loss unchanged; 30-step smokes of every option on H100 / H200.Commits = the frozen source trees the screen ran (sha256 of
git diff 2769909d22):05db158f9e=code-f95bfdda(stage 1-3 screen)ed0a0d713b=code-fec107db(zero-init read convolutions)code-e4bf0f7b(round 2)code-dca8a291code-969c64ea(r2nn / r2bb)code-e894a72a(input program)509d6e7b2e=code-80e2e174feat/pretrain5c0bfa6129(hyper_connection.py moved tomodels/layers/, the merged branch's diff vsfeat/pretrainsha25684bdc669..., frozen ascode-m84bdc669)