Run this model with HF Jobs

Run jeweled/inkling-2-next on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/jeweled/inkling-2-next. Ask me which dataset to train on, then push the fine-tuned model to a new private model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/jeweled/inkling-2-next on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/jeweled/inkling-2-next. Ask me which benchmark to run, then save the scores and the per-example results to a new private dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/jeweled/inkling-2-next. Push it to a new private model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

Inkling 2 Next

Release Status β€” Partial Checkpoint Available (Marin Step 5,000 196.6B Engram Only; Backbone & LoRA Weights Pending Head-to-Head Benchmarking): This repository currently hosts the Marin Step 5,000 partial checkpoint of the 196.6B Conditional Engram ONLY (16 ENGDLT01 sparse .delta.zst shards + 8 TP8 dense projection/gating shards + canonical BPE LUT, trained on 163.80M Marin tokens atop the 122.5M-token V18 seed = 286.3M cumulative tokens / 1.92B row updates). Base Inkling-2-Small backbone weights, Stage A.5 shared-expert/AttnRes weights, and Stage B0/B1 LoRA adapters are not included here yet pending head-to-head benchmark publication.


1. Architectural Thesis

thinkingmachines/Inkling-2-Small is a 594B-parameter (~17B active) hybrid local/global Mixture-of-Experts model (48 layers, 384 routed experts per layer in native NVFP4 for L0–39 and MXFP8 for L40–47, top-8 sigmoid routing, 6-layer Block Attention Residuals, and a 5-layer Multi-Token Prediction speculative drafter).

While sparse MoE scales parameter capacity efficiently, empirical layer-ablation scans on Inkling-2-Small exposed three structural bottlenecks:

  1. Static Lexical Reconstruction Inside Early MoE Layers: Early-to-mid MoE layers expend substantial routed-expert compute and memory bandwidth reconstructing static local N-gram collocations, multi-token code/ABI identifiers, LaTeX idioms, and named entities that do not require deep non-linear expert routing.
  2. Uniform top-8 Tail Noise & Missing Shared Expert: Under energy-conserving sigmoid routing (route_scale = 8.0), the 7th and 8th lowest-scoring experts on high-certainty tokens contribute marginal residual signal while paying full NVFP4/MXFP8 expert memory-read cost β€” yet Inkling-2-Small natively sets n_shared_experts = 0, making naive top-k pruning brittle without a dense fallback pathway.
  3. Quantized Expert Fragility Under Post-Training: Directly updating NVFP4/MXFP8 routed experts during SFT or RL introduces 4-bit/8-bit dequantize-requantize drift and degrades speculative drafter acceptance.

Inkling 2 Next resolves all three bottlenecks through four co-designed architectural layers:

Component Base Inkling-2-Small Inkling 2 Next Primary Architectural Role
Total Parameters 594B 790.6B (594B backbone + 196.6B Engram) $O(1)$ offloaded lexical & structural N-gram capacity
Conditional N-Gram Memory None 196.61B Engram at L1 & L13 (n = 2, 3, 4, 24 prime-hash heads/layer) Offloads static N-gram/entity recall from early MoE experts
Tokenizer N-Gram Addressing Raw 201,024 BPE IDs Canonical LUT Compression (201,024 -> 128,650, -36.0%) Collapses casing, spacing, and Unicode surface variants onto shared N-gram slots
MoE Routing Policy Static top-8 everywhere (100% active MoE) Dynamic top-p = 0.85 (k in [3, 6], mean k = 4.83) Cuts routed-expert memory reads by -39.6% by dropping low-weight tail experts
Shared Expert Pathway n_shared_experts = 0 dim = 512 BF16 Mini Shared Expert (L0–47, Muon-trained) Always-on dense residual anchor stabilizing aggressive top-p expert shedding
Speculative Decoding 5-layer MTP drafter Hybrid Prefix-Seeded Suffix Automaton (SAM) + Static N-Gram + 5-Layer MTP Zero-overhead N-gram continuation drafting with strict 0-ULP target verification
Domain RL Adaptation Base policy NVFP4-Safe BF16 Attention Adaptation (Dr.GRPO + ExPPO + Clip-Higher + TIS) Zero expert requantization; 0.0% runtime serving overhead after static BF16 merge

2. Deep Dive: Conditional N-Gram Architecture (196.6B Engram + Hybrid N-Gram Speculation)

2.1 Canonical Tokenizer Compression (36.0% Vocabulary Collapse)

Addressing N-gram tables with raw BPE token IDs fragments statistical support across trivial surface variations (e.g., " Theorem", "theorem", "THEOREM", and Unicode compatibility forms all hash to unrelated rows).

Before computing any N-gram hash, Inkling 2 Next maps every token through a static lookup table:

LUT(t):NFKCβ†’NFDβ†’strip combining accentsβ†’lowercaseβ†’whitespace collapse\text{LUT}(t): \text{NFKC} \rightarrow \text{NFD} \rightarrow \text{strip combining accents} \rightarrow \text{lowercase} \rightarrow \text{whitespace collapse}

  • Collapses Inkling-2-Small's 201,024 padded vocabulary (200,058 active BPE + control tokens) down to 128,650 canonical equivalence classes (36.0% reduction) β€” nearly 2x higher canonical compression density than comparable byte-heavy tokenizers.
  • Special wire/control tokens (chat turn delimiters, <think> reasoning spans, and structured tool-invocation tags) map to dedicated isolated sentinels so structural control boundaries never alias with natural-language N-grams.

2.2 Multi-Order Prime-Modulus N-Gram Hash Tables (196.61B Parameters)

At each Engram injection layer, Inkling 2 Next extracts causal suffix N-grams of orders $n \in {2, 3, 4}$ over the canonically compressed token stream:

  • Multi-Head Prime Hashing: Each of the 3 N-gram orders is hashed across 8 independent heads (3 x 8 = 24 hash heads per layer, head_dim = 256, concatenated engram_dim = 6,144). Each head $h \in {0, \dots, 23}$ indexes a table of distinct prime modulus $P_h \approx 16\text{M}$ rows (~384M rows per layer), eliminating systematic modular collision patterns across orders and heads: $$(384,006,168 + 384,016,682) \times 256 = 196,613,849,600 \text{ parameters } (\mathbf{196.61\text{B}})$$
  • Tail-Noise Filtering (min_count = 3): Rare 4-grams appearing fewer than 3 times in the training corpus are masked from table updates, preventing single-occurrence sequence memorization and hash-collision pollution while concentrating capacity on reusable mathematical, code, and domain N-grams.

2.3 Why Inject at L1 and L13? Exploiting 6-Layer Block Attention Residuals

A naive N-gram lookup design either attaches tables to every transformer layer (multiplying metadata and projection overhead by 48x) or injects only at the input embedding (where early residual updates overwrite lexical detail).

Inkling-2-Small organizes its 48 layers into eight 6-layer Block Attention Residual groups (n_layers_per_attn_res_block = 6), where layers attend directly over normalized block-level residual states via learned inter-block queries:

Input -> [L0 -> L1(Engram #1) -> L2..L5] ==> Block 0 Residual
                |
                +--> [L6..L11]           ==> Block 1 Residual
                        |
                        +--> [L12 -> L13(Engram #2) -> L14..L17] ==> Block 2 Residual
                                        |
                                        +--> [L18..L47] (Global + Local Reasoning Layers)
  1. L1 (Early Lexical Offload): Placed immediately after L0 contextualizes raw token embeddings, supplying $O(1)$ surface/phrase N-grams right at the start of Block 0.
  2. L13 (Mid-Depth Structural & Compositional N-Grams): Placed near the entry of Block 2, after two full local/global attention cycles (L5, L11), capturing higher-order syntactic, API, and symbolic patterns while remaining directly reachable by deeper layers (L18–L47) via Block Attention Residuals.
  3. Empirical Verification (engram_cushion_bpb): In single-layer expert-shedding sweeps across L0–L17 (top-8 -> top-6 / top-4 with vs. without Engram), 31 of 32 candidates across L0–L15 exhibited positive Engram cushion β€” proving that L1 + L13 N-gram memory directly absorbs the representational load lost when pruning early-to-mid MoE experts, before naturally tapering off at L16–L17 where abstract reasoning dominates.

2.4 Zero-Init Context-Gated Injection & Tiered NVMe/RAM Architecture

Raw N-gram embeddings are static with respect to broader context (e.g., "bank" in finance vs. systems memory banking). Inkling 2 Next gates every retrieved $6,144$-d N-gram vector against the live hidden state $h_\ell \in \mathbb{R}^{4608}$:

  1. Project the concatenated 24-head N-gram vector via a TP-sharded linear map wkv into key $k_e$ and value $v_e$.
  2. Modulate $v_e$ by normalized query-key agreement $\sigma(\text{RMSNorm}(h_\ell) \odot \text{RMSNorm}(k_e))$ and scale by a zero-initialized scalar residual gate ($\alpha_\ell = 0$ at Step 0).
    • Because $\alpha_\ell = 0$ at initialization, attaching 196.6B parameters introduces exact 0.000 $\Delta\text{bpb}$ perturbation at Step 0 and smoothly opens ($\alpha_1 \approx 0.36$, $\alpha_{13} \approx 0.65$) only where N-gram lookups genuinely reduce cross-entropy and self-teacher KL.
  3. Zero-Penalty Serving & SparseRowAdagrad Training: Because N-gram indices depend only on input token IDs (known before L0 executes!), L1 and L13 lookups are prefetched asynchronously from sharded NVMe backing stores through a power-of-2 direct-mapped Zipfian RAM/GPU hot cache (~80–90% hit rate in 2–4 GiB/shard), hiding off-chip latency completely behind L0 and L2–L12 compute. During retrofit training, SparseRowAdagrad maintains a single FP32 scalar per row (0.38 GiB/shard) and updates only active rows touched in each micro-batch.

2.5 Inference-Time N-Gram Synergy: Hybrid SAM + Static N-Gram + 5-Layer MTP

In addition to representation-level Engram tables at L1/L13, Inkling 2 Next exploits N-gram structure during decoding by coupling Inkling-2-Small's neural 5-layer MTP drafter (32,768 frequency-ranked hot vocabulary shortlist) with an online Suffix Automaton (SAM) + static corpus N-gram table:

  • Multi-Turn Prefix Seeding: In agentic code, proof, and security workflows, variable names, file paths, JSON tool schemas, and Lean/Solidity/C identifiers repeat heavily across turns. Seeding the Suffix Automaton from cached prompt prefixes allows $O(1)$ exact multi-token span proposals whenever high-confidence N-gram matches exist, seamlessly handing off to the 5-layer neural MTP drafter on novel reasoning steps.
  • Multimodal & 0-ULP Target Safety: Contiguous vision-pad token runs are collapsed to bounded sentinels so image inputs never pollute text N-gram transitions, and every drafted token β€” whether proposed by SAM, static N-grams, or neural MTP β€” is verified by the full target model with zero-ULP greedy invariance (and exact residual rejection recovery norm(max(0, p - q)) for temperature > 0).

3. MoE Compute Reallocation: Dynamic top-p Routing & Mini Shared Expert

Once 196.6B Engram offloads static lexical memory from L0–L15, Inkling 2 Next reallocates active MoE compute onto a sharper Pareto frontier:

  1. Dynamic top-p = 0.85 Routing (k_min = 3, k_max = 6):
    • Replaces static top-8 expert selection across all 48 layers with cumulative router-probability thresholding: each token activates only as many top-ranked experts (between 3 and 6) as needed to cover 85% of normalized routing probability mass.
    • Reduces mean active experts from 8.00 -> 4.83 (60.38% active MoE, -39.62% routed expert reads) β€” concentrating bandwidth on high-leverage reasoning tokens (k -> 6) while fast-pathing predictable syntax/boilerplate tokens (k -> 3).
  2. Muon-Trained dim = 512 BF16 Mini Shared Expert (L0–L47):
    • Attaches a compact always-on BF16 shared expert (hidden = 4,608 -> d_shared = 512 -> 4,608) using Inkling-2-Small's exact interleaved softcapped SiTU activation (gate_cap = 4.0, up_cap = 25.0).
    • Jointly trained via 5-iteration quintic Newton-Schulz Muon orthogonalized updates alongside 48 router scale calibrations, 96 Block Attention Residual queries, and 8 global-attention (L5, 11, 17, 23, 29, 35, 41, 47) BF16 adapters under forward Self-Teacher KL regularization so probability calibration and MTP speculative acceptance remain tightly anchored.

4. Lossless NVFP4-Safe Post-Training & Verifiable Multi-Turn RL

To specialize Inkling 2 Next across Mathematics, Cybersecurity, and Applied Cryptography without degrading quantized expert precision or general capabilities:

  • 100% Frozen Quantized Experts (0 Requantization Error): All 384 NVFP4 (L0–39) and MXFP8 (L40–47) routed experts remain bit-for-bit untouched. Trainable rank-16/32 adapters attach strictly to BF16 attention projections (wq_du, wk_dv, wv_dv, wo_ud across L1–47) and fold losslessly into BF16 weights at load time prior to kernel prepacking (0.0% runtime serving latency penalty).
  • Stacked-Champion Reference Anchoring: Sequential RL iterations pre-merge the promoted prior champion into the frozen reference policy (KL = 0 at Step 0), preventing KL gravity from pulling newly acquired multi-turn skills back toward the pre-RL base policy.
  • Verifiable Execution Harnesses & RL Mechanics: Trained strictly against real executable verifiers β€” clang/AddressSanitizer/MemorySanitizer/UndefinedBehaviorSanitizer crash reproduction & minimal patching, standalone Lean 4 kernel proof checking (0 sorry/axiom escapes), multi-file Foundry (forge test) differential Solidity exploit & patch verification, finite-field R1CS / Fiat-Shamir / Merkle verifier soundness forging, and Olympiad mathematics β€” using:
    • Length-Unbiased Dr.GRPO sequence loss normalization (preventing long 16K trajectories from diluting gradient signal or rewarding brevity/stall hacks),
    • ExPPO prompt-relative surprisal advantage shaping within equal-reward classes,
    • Asymmetric DAPO Clip-Higher ([0.20, 0.28]) to preserve exploration on low-prior reasoning tokens,
    • Truncated Importance Sampling (TIS) against rollout behavior log-probabilities, and
    • Post-RL Weight-Space Trajectory Blending (50/50 Raw + Step-EMA) to combine peak late-stage long-context discovery with smooth early-stage calibration.

5. Benchmarks (Inkling 2 Next vs. thinkingmachines/Inkling-2-Small)

Coming next: Standardized, apples-to-apples evaluations comparing Inkling 2 Next directly against base thinkingmachines/Inkling-2-Small under identical prompts, tool harnesses, context caps, and 0-ULP decoding settings will be added to this section prior to weight upload.


License & Lineage

Derived from thinkingmachines/Inkling-2-Small under the Apache-2.0 License.


6. Marin Step 5,000 Partial Engram Checkpoint & NVMe Reconstruction

6.1 Checkpoint Summary

  • Source Run: gs://calibre-web-436521-engram-marin/tpu_marin_run1/ (v5p-16 Cloud TPU, TP = 8, full_196b preset)
  • Training Progress (resume_state.json): Step 5,000 (batches_consumed = 10,000, 163,800,000 Marin tokens trained atop the 122.5M-token V18 seed = 286.3M cumulative tokens, 1,924,683,120 sparse row updates)
  • Layer 1 Total Active Rows (count >= 3): 222,398,807 / 384,244,442 (57.880%), 1.res_gate = 0.709562 (from engram_dense_tpu_r0.pt)
  • Layer 13 Total Active Rows (count >= 3): 223,011,847 / 387,123,992 (57.607%), 13.res_gate = -1.355688 (from engram_dense_tpu_r0.pt)
  • Combined Active Rows (L1 + L13, count >= 3): 445,410,654 / 771,368,434 (57.743%)
  • Scope (29 files total): Hosts the 196.6B Conditional Engram partial checkpoint ONLY. Base Inkling-2-Small backbone weights, Stage A.5 shared_expert_a5 / attn_res_queries, Stage B0/B1 LoRA adapters, and Adagrad/Adam optimizer states (sparse_accum_*, dense_opt_state_*) are not included here yet pending head-to-head benchmark publication.

6.2 Per-Rank Active Row Breakdown (count >= 3)

TP8 Rank L1 Total Rows L1 Active (>=3) L13 Total Rows L13 Active (>=3)
r0 48,030,413 27,813,893 (57.909%) 48,390,341 27,868,377 (57.591%)
r1 48,030,449 27,811,180 (57.903%) 48,390,387 27,866,988 (57.588%)
r2 48,030,471 27,787,420 (57.854%) 48,390,439 27,891,902 (57.639%)
r3 48,030,549 27,811,777 (57.904%) 48,390,469 27,892,803 (57.641%)
r4 48,030,585 27,784,418 (57.847%) 48,390,531 27,890,817 (57.637%)
r5 48,030,613 27,812,026 (57.905%) 48,390,583 27,865,923 (57.585%)
r6 48,030,665 27,786,480 (57.852%) 48,390,613 27,865,936 (57.585%)
r7 48,030,697 27,791,613 (57.862%) 48,390,629 27,869,101 (57.592%)
Total 384,244,442 222,398,807 (57.880%) 387,123,992 223,011,847 (57.607%)

6.3 Repository File List (29 Files)

  • .gitattributes β€” Git LFS tracking rules (*.delta.zst, *.zst, *.pt, *.npy, etc.)
  • README.md β€” Architectural thesis & Marin Step 5,000 partial Engram checkpoint documentation
  • resume_state.json β€” Exact TPU training step metadata (steps_done = 5000, batches_consumed = 10000, total_tokens_trained = 163800000, total_row_updates = 1924683120)
  • inkling2_canonical_lut.npy β€” Canonical BPE token lookup table (201,024 -> 128,650, INKLING_ENGRAM_LUT)
  • engram_dense_tpu_r{0..7}.pt (8 files) β€” TP8-sharded PyTorch state dicts ({1,13}.{wkv, k_weight, q_weight, res_gate}) compatible with vllm_v18/engram_v18_runtime.py (INKLING_ENGRAM_DENSE_PREFIX)
  • engram_L1_r{0..7}.delta.zst (8 files) β€” zstd-compressed ENGDLT01 sparse delta shards for Layer 1 (active BF16 rows + full uint16 counts + embedded SHA-256 digests for indices, weights, and counts)
  • engram_L13_r{0..7}.delta.zst (8 files) β€” zstd-compressed ENGDLT01 sparse delta shards for Layer 13
  • SHA256SUMS β€” Exact SHA-256 manifest of all checkpoint files

6.4 Reconstructing NVMe Serving Shards (engram_sparse_delta.py apply-nvme)

tpu_engram_train.py zero-initializes the full 196.6B sparse Engram table in host RAM, so inactive (count < 3) rows are exact 0.0 BF16 (0x0000). On each TP8 serving node r (0..7), create sparse zero-initialized .bf16.bin files via truncate on ext4 and apply the .delta.zst shards:

RANK=0  # set 0..7 on each TP8 node
SSD_DIR="/home/jeweled/ernie55-engram/ssd_inkling2_v18_purified_196b"
mkdir -p "$SSD_DIR"

# 1. Inspect local_rows from ENGDLT01 header and pre-create sparse zero-init .bf16.bin files
for LID in 1 13; do
  LOCAL_ROWS=$(python3 src/engram_sparse_delta.py inspect \
    --delta "engram_L${LID}_r${RANK}.delta.zst" | python3 -c "import sys,json; print(json.load(sys.stdin)['local_rows'])")
  rm -f "$SSD_DIR/engram_L${LID}_r${RANK}.bf16.bin"
  truncate -s "$((LOCAL_ROWS * 256 * 2))" "$SSD_DIR/engram_L${LID}_r${RANK}.bf16.bin"

  # 2. Apply sparse delta (verifies ENGDLT01 magic + indices/weights/counts SHA-256s)
  python3 src/engram_sparse_delta.py apply-nvme \
    --delta "engram_L${LID}_r${RANK}.delta.zst" \
    --ssd-dir "$SSD_DIR"
done

Then copy engram_dense_tpu_r${RANK}.pt to your INKLING_ENGRAM_DENSE_PREFIX (<prefix>_r${RANK}.pt) and point INKLING_ENGRAM_DIR="$SSD_DIR" and INKLING_ENGRAM_LUT=/path/to/inkling2_canonical_lut.npy when launching vllm_v18.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for jeweled/inkling-2-next

Finetuned
(12)
this model