GitHub v1.0.0: https://github.com/ChukarAI/qwen3.8-27b-jax-tpu Weights: streamed directly from Qwen/Qwen3.8-27B (revision 1d4bf0f2ff6012fd82039f2fa52739d0dd7c60c0) β€” this repository contains code, frozen fixtures, and reports only.

Qwen3.8-27B β€” JAX/TPU Text-Only Inference Port

Chukar AI Β· v1.0 Β· text-only release

A standalone, streaming-loaded JAX/XLA implementation of Qwen/Qwen3.8-27B (revision 1d4bf0f2ff6012fd82039f2fa52739d0dd7c60c0) targeting Kaggle TPU v5e-8 (8 Γ— TPU v5 lite, 16.9 GB HBM per chip; ~32.2 GB container cgroup RAM). The model is a hybrid decoder with 48 Gated DeltaNet + 16 full-attention layers (full attention at indices (i+1) % 4 == 0), hidden size 5120, FFN 17,408, vocab 248,320, ΞΈ = 1e7 partial RoPE on 64 of 256 head dims. The port loads the 851 text-path tensors (26.896 B parameters, 53.792 GB BF16), excluding 333 visual and 15 MTP tensors.

This release documents verified behaviour honestly, including one strict gate failure at 4096 tokens (see Verification).

Key engineering highlights

  • Single-shard streaming loader β€” safetensors shards are streamed one at a time and packed flat-to-nested; peak host RSS β‰ˆ 11.2 GB. The full 55.6 GB checkpoint is never materialized as a host state dict.
  • Layer-streamed FP32 reference β€” StreamedQwen35Ref runs the official Hugging Face Qwen3_5 modules in FP32, loading one layer at a time, with TF32 disabled and highest matmul precision. 4K hidden states + all-position logits are produced in 256-position lm_head chunks so the 4.07 GB (1,4096,248320) logits tensor is never device-resident.
  • TP = 8 sharding β€” 2D weights split on the HF output axis, embeddings and lm_head split on the vocabulary axis, rank-1/rank-3 tensors replicated; full-attention k_proj/v_proj are re-replicated (4 KV heads cannot split over 8 devices).
  • Fixed-capacity KV cache β€” jax.lax.dynamic_update_slice + scalar valid length: one decode executable reused for all steps (decode_trace_count = 1).
  • Fail-closed verification harness β€” exact record-set contracts (26 stages, 3 compiles, 8 devices), no default values, no empty-collection pass path; missing/duplicate/unexpected/malformed evidence fails.

Verification & benchmarks

512 and 1024 tokens (P0 freeze, JAX 0.10.2) β€” full PASS

Comparison mrel cosine max abs top-1 top-5
TPU 512 vs CUDA FP32 ref 4.8016e-06 0.9999999999875 2.151e-04 match 5/5
TPU 512 vs CPU FP32 ref 3.8195e-06 0.9999999999910 1.950e-04 match 5/5
TPU 1024 vs CUDA FP32 ref 2.5573e-05 0.9999999996826 3.475e-04 match 5/5
TPU 1024 vs CPU FP32 ref 2.5600e-05 0.9999999996829 3.153e-04 match 5/5

Cache consistency (496 prefill + 16 decode vs 512 prefill): mrel 2.7405e-06, cosine 0.9999999999952, top-1 match. Warm prefill 0.153 s / 0.309 s; decode 17.3–19.9 ms/token; peak HBM 12.932 GB.

Free-running generation (EN/FA/code) β€” PASS

6/6 prompts exact token-for-token match; 63/63 teacher-forced steps pass on both CPU (min margin 0.0359077) and Tesla T4 CUDA (min margin 0.0359135); 13/13 shared core modules byte-identical to the P0 freeze. Recovered artifact: tpu_report.json SHA-256 039dff4e37dcd8bf6b7eee17af8464a440ecb2d29806bc27245aa7b4d8454f47.

4096 tokens (P1 harness, JAX 0.11.0) β€” strict FAIL disclosure

Gate Measured Result
top-1 4096 / 4096 PASS
top-5 4094 / 4096 FAIL
mrel 1.008e-04 (< 5e-3) PASS
cosine 0.99999990 (> 0.999) PASS
peak HBM 15.315 GB (chip 0) / 8.552 GB (chips 1–7) < 15.5 GB PASS
compiles 590.02 / 2.54 / 308.42 s ≀ 1200 s PASS
decode traces 1 (8 steps) PASS

Warm prefill 1.200 s; decode 29.4–30.4 ms/token; max abs error 0.9572 at position 2701 (mid-rank offset, top-1/top-5 still match there). Both top-5 misses (positions 3473 and 3661) are rank-5/6 near-tie swaps (reference margins 0.0084 / 0.0144). Forensics show the divergence originates in the 64-layer backbone, with no chunk-boundary or lm_head-chunking artifact and no RoPE precision discrepancy (cos/sin ≀ 1 ULP vs transformers==5.16.1). Full report: docs/reports/13_p1_final_verdict_and_forensics.md.

Reproduction

Local integrity check (no GPU/TPU):

cd kaggle/latest
sha256sum -c SHA256SUMS        # expect 24/24 OK
python -m json.tool extraction_manifest.json > /dev/null
python -m py_compile qwen35_jax.py qwen38_model.py qwen38_generation.py \
  qwen38_decode.py m3_1_loader.py m3_1_kaggle.py m3_2_ref.py \
  logit_capture.py run_reference_recovery.py run_context_profile.py

Kaggle TPU v5e-8 execution (summary):

  1. Upload kaggle/latest + kaggle/4k_harness (including reference_bundle/) as a private Kaggle dataset; use a rotated credential configured outside this repository (never commit secrets).
  2. Run kaggle/4k_harness/run_4k_tpu.py on TPU v5e-8; download the report and 16 logits chunks (256 Γ— 248,320 float32 each).
  3. Run kaggle/4k_harness/run_4k_reference.py --backend cpu on a host with β‰₯ 32 GB RAM and pinned torch==2.10.0, transformers==5.16.1 (on Kaggle: add torchvision==0.25.0, torchaudio==2.10.0 to align the torch ABI).
  4. Run kaggle/4k_harness/compare_4k.py --tpu-run … --reference-run … locally; gates are fail-closed.
  5. Record environment, versions, timings, HBM, and gate results.

Known limitations & non-claims

  • Diagnostic precision mode only. All accepted numbers use BF16 stored weights with FP32 activations/caches and highest matmul precision (JAX) / TF32-off (PyTorch). Production BF16 activations are NOT validated.
  • Not validated: context > 4096 tokens, sampling (do_sample=True), batch > 1, Vision, MTP.
  • 4K top-5 gate is NOT met (4094/4096); no parity claim beyond the table above.
  • Kaggle TPU teardown quirk: the TPU image may raise a libtpu SIGABRT at interpreter exit after successful completion; outputs remain valid, but the kernel is marked ERROR and cannot be mounted as kernel_sources.
  • Chip-0 load-staging peak: 15.315 GB occurs during load (a 2.54 GB transient allocation); steady live HBM is ~7.03 GB.
  • P0 provenance: the exact Kaggle notebook version for the November-6 run is unresolved; provenance is SHA-256 content-verified, not version-number verified.

Methodology & attributions

This port was built with human-supervised agentic systems engineering: an engineer specified the milestones, gates, and stop-on-failure policy, and AI agents executed reconnaissance, implementation, and verification. Every claimed number is backed by an artifact in this repository; failures are reported as-is.

  • License: Apache-2.0 (see LICENSE).
  • Model: Qwen/Qwen3.8-27B, copyright the Qwen team; use subject to its model license.
  • GDN kernels: adapted from Google MaxText (Apache-2.0, commit 97273dd), cross-validated against the official torch chunked delta rule.
  • Reference: official Hugging Face transformers Qwen3_5 modules.
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 ChukarAI/Qwen3.8-27B-JAX-TPU

Base model

Qwen/Qwen3.8-27B
Finetuned
(1,003)
this model