Source provenance#

Qwen3.5 GDN adaptation — 2026-11-04#

integrations/_sglang_qwen35.py is independently implemented against the inspected SGLang 0.5.22 model/loader interfaces and the official Qwen3.5 config. It copies no framework source. References and the exact compatibility boundary are in qwen35.md; validation artifacts record runtime file hashes. The four-slice RowExpand instantiation extends the existing project-owned kernel below, retaining its author/source notices and original three-slice shared-memory footprint. The synthetic adapters in the pilot are generated test data, not research model outputs or imported trained adapters.

The B-only row_tile=2/4/8 extension is new LoRAForge scheduling code around the existing attributed RowExpand reduction. It splits each existing segment inside B without changing A metadata, rank accumulation or BF16 rounding. The original row_tile=16 kernel remains the default low-level implementation. benchmarks/rowexpand_tiles.py and its graph/rank/route regression cases are new project code; no additional probe or framework implementation is copied. MI250 validation and cache-regime timings are recorded in qwen35-rowtiles-mi250.json.

The opt-in Qwen3.5 tiny-rank dispatch is new LoRAForge policy code derived from the project’s rank-4/rank-8 operator and full-model experiments. It selects the already attributed HIP shrink, RowExpand and native implementations; no new probe or framework kernel is imported. Its separate timing opt-in preserves the original strict logprob result while allowing token-matched performance measurements. See qwen35.md for scope and results.

benchmarks/qwen35_gdn_consumer.py is an independently implemented research kernel for the fixed Qwen3.5-0.8B contiguous projection boundary. It computes BF16-rounded LoRA B corrections while producing QKV/Z/b/a for the original GDN consumer. It copies no upstream kernel. Its functions match the measured prototype AST; the experiment report records GPU checks, framework hashes, whole-model controls and remaining scope limits.

The new benchmark-only qwen35_tiny_fused.cu and qwen35_wide_fused.cu retain the attributed ops/csrc/rowexpand.cu HIP shrink reduction, BF16 conversion helpers and original probe source notice. Their shared-A, fused A+B and direct GDN unpack scheduling are new LoRAForge experiment code; no additional upstream kernel is imported. qwen35_fused_lora.py supplies explicit lazy ROCm loaders, and check_qwen35_wide_fusion.py is a portable operator check against the existing HIP/RowExpand/consumer implementations. Both native source files are byte-identical to the GPU-study sources. Benchmark .cu files accompany the source archive, alongside their Python callers; they do not become installed runtime operators. The follow-up report records numerical checks, shape exclusions and whole-model controls.

benchmarks/qwen35_rank4_fused.cu specializes the same attributed HIP reduction and BF16 conversion helpers to capacity 4 and the two measured narrow input widths, with unrolled chunks and vector B loads. Its lazy loader and portable 30-case operator check are new experiment code. Live retained ranks and routes remain GPU metadata, with mixed-rank and changed-metadata graph equality checks. This source is also a benchmark prototype, not an installed library kernel.

Foundation#

Created on 2026-10-31 as new packaging, documentation, and CPU checks under Apache-2.0. This commit imports no numerical kernels, research results, third-party framework code, or paper content.

The migration reference is lishenghui/probe at 5fd6ae060d106066b306959f9a34b726a281ef4c. This is a baseline for inspection, not an assertion that its entire tree is licensed for redistribution or has been migrated. Local uncommitted probe work is outside this baseline and must be recorded explicitly if later selected.

Code import ledger#

FlashTSQR tensor extraction#

Source: lishenghui/probe commit 5fd6ae060d106066b306959f9a34b726a281ef4c, authored by Shenghui Li (including the lishenghui Git identity), as recorded in source history. The project-owned implementation is migrated under this repository’s Apache-2.0 license, with author and source notices in the adapted files. No external framework implementation or vendor source is copied.

Source path under probe

Destination

FlashTSQR/flashtsqr.py

src/loraforge/ops/flashtsqr.py, ops/_extension.py, compression/spectral.py

FlashTSQR/kernels/tsqr_full.cu

src/loraforge/ops/csrc/tsqr_full.cu

FlashTSQR/kernels/tsqr_wide.cu

src/loraforge/ops/csrc/tsqr_wide.cu

FlashTSQR/kernels/jacobi_eigh.cu

src/loraforge/ops/csrc/jacobi_eigh.cu

Original file hashes are in flashtsqr-source-hashes.json. New bindings, result types, tests, and example code were written for this extraction. Intentional changes:

  • Replace static g_h with per-call reflector tensors owned by a Python handle. Build WY factors eagerly to avoid mutable state during concurrent application.

  • Guard the input GPU and launch on its current PyTorch stream; record completion and consumer-stream lifetimes. Preserve input-device semantics.

  • Return execution metadata instead of global last_path / last_eigh values.

  • Disable ambient autocast, validate shapes/dtypes, and document inference-only behavior. Explicitly reject graph capture.

  • Return physically compact cloned factors by default; legacy padding is opt-in. Support 2D and batched 3D factors through one interface.

  • Zero numerical null eigenvalues at a documented FP64 relative threshold and check Jacobi eigen-residuals instead of silently accepting nonconvergence.

  • Package one copy of native sources for lazy compilation; remove cluster-specific compiler mutations. Keep the existing Householder method and backend selection.

The opt-in experimental cuSOLVER batched EVD wrapper is not migrated. CUDA uses the original default torch.linalg.eigh core. No production generic QR path or unreported fallback is introduced. Source repositories and paper content are unchanged. Validation scope and commands are in flashtsqr.md.

PEFT file workflow#

The PEFT file layer (src/loraforge/adapters/), its example and reload tests were written for this repository on 2026-11-01. They implement the documented PEFT 0.18.0 file/scaling contract without copying PEFT implementation code or importing experiment scripts. References and the supported surface are recorded in peft.md. Actual compression reuses the maintained FlashTSQR tensor API at baseline 15734fdd7e983b2e2a97bda1861115fb600f9423; no native kernels or numerical algorithms change in this file-workflow step.

The rsLoRA extension at baseline 3082b452dd59d9749ac659ee4b76dcd8b6c47b42 adds PEFT’s alpha/sqrt(r) convention to the file layer, preserves the flag on export, and records the scaling type in each manifest module. It is new project code based on the same referenced PEFT contract; no kernels or upstream source files are copied or changed.

Future entries#

Each import must add:

  • Source repository URL, immutable commit, and source paths.

  • Destination paths and retained authorship/copyright notices.

  • Applicable license and any required third-party notices.

  • Intentional API, algorithm, layout, and numerical changes.

  • Verification commands, hardware/software environment, and results.

A new package license does not replace the terms of imported source files.

Spectral budget planner (2026-11-03)#

New dependency-free implementation in compression/allocation.py, following Shenghui Li’s global singular-value ordering in probe commit b217b17fac6cd6105cd3f04865962fb51d8a8ba3, vla_fleet/compress_oft_gpu.py lines 50–59. No source code is copied. The source file was inspected locally; its uncommitted experiments are not imported. The API accepts an integer direction budget and sorted spectra, validates inputs, and resolves ties by module name and index. It does not perform compression. CPU tests exhaustively compare all budgets in a small instance with every feasible prefix-rank allocation. No GPU algorithm or hardware support changes.

The budget-to-PEFT extension adds a minimum retained rank (default zero in the standalone planner, one in the file workflow), an explicit budget keyword, and a two-pass FlashTSQR spectrum/compression workflow. This is new library orchestration; no additional source files or numerical kernels are imported. The objective deliberately uses unscaled spectra as in the recorded research source. The export manifest records this convention and the selected ranks.

Quality-curve budget planning (2026-11-03)#

New implementation: compression/quality.py, with CPU exhaustive-search tests. Conceptual reference: Shenghui Li’s tools/llm_fleet/allocate_qwen_tasks.py, function dp, at local probe commit b217b17fac6cd6105cd3f04865962fb51d8a8ba3. No source code is copied. The library uses exact integer costs and sparse dominated-state pruning rather than the experiment’s rounded-up cost grid. Calibration, isotonic fitting, minimax objectives, experiment results and framework dependencies are not imported. Losses and costs are explicit caller data; tie-breaking is documented.

Compact CPU slot ownership (2026-11-03)#

runtime/slots.py and its tests are new project code. No research loader or framework implementation is copied. Design inspection included local probe tools/llm_fleet/sglang_plugin/probe_sglang_gemv/fast.py and the untracked tools/llm_fleet/test_paging_loader.py; these remain research evidence, not imported source. The inspected checkout HEAD is b217b17fac6cd6105cd3f04865962fb51d8a8ba3, but fast.py has local edits and the test file is untracked, so that commit does not identify their working content.

The new component deliberately implements synchronous CPU snapshots and explicit pool/generation ownership. It reuses LoRAForge’s maintained PEFT validator and preserves scaling. It does not claim equivalence to the research GPU loader, persistent shadows, fused projections or graph replay. No numerical kernel changes.

GPU residency and scoped leases (2026-11-03)#

runtime/gpu.py and tests/test_runtime_gpu.py are new library code, building on the CPU slot contract from commit 4f15389. No research or third-party code is copied and no numerical kernel changes. The implementation uses pinned host staging, per-load completion events, explicit read leases and PyTorch stream recording. Reload publishes freshly allocated compact factors rather than mutating old addresses. GPU graph replay and SGLang/vLLM registration remain outside the supported scope. Validation results are recorded in runtime docs.

Decode GEMV and SGLang integration (2026-11-03)#

Imported mathematical kernels: tools/llm_fleet/sglang_plugin/probe_sglang_gemv/kernels.py from probe commit b217b17fac6cd6105cd3f04865962fb51d8a8ba3, authored by Shenghui Li (file history commit 5ab76d171374d313ec7594dc7c24acfd5ccce796). The working file is unchanged from this pinned revision. Source checksum is recorded in gemv-source-hashes.json. The project-owned implementation is migrated under Apache-2.0 with retained authorship/source notices.

Destination: ops/_gemv_kernels.py contains the three extracted shrink, reduce and expand kernels. ops/gemv.py supplies adapted lazy public wrappers. integrations/sglang.py is new orchestration implementing the source backend’s decode/native-prefill boundary through SGLang’s installed public method contract. No upstream SGLang implementation or source experiment/result trees are copied.

Intentional differences from the source: remove import-time Torch/Triton loading from public modules, remove environment-driven tuning/global rank buckets, use one explicit flat split-K schedule, initialize shrink output to zero, validate shape/dtype/device contracts, and reject autograd. Kernel math, actual-rank A slice packing, max-rank B stride, FP32 accumulation and intermediate/delta rounding are retained. Compile specialization decorators and symbol names are simplified. Native SGLang buffers and loader/scheduler own fixed addresses and lifetimes; LoRAForge’s independent runtime pools are not substituted into the framework.

The inspected LUMI SGLang checkout reports version 0.5.22 and source commit baa9befa381511cd4d56f83980951e5a45fffc6d. The integration is version-gated and conflict-aware, opt-in per worker, and retains native eager prefill/pruned paths. Validation scope and commands live in sglang.md.

BF16 decode numerical correction#

The original project-owned split-K/tree GEMV reduction failed full-model BF16 parity despite passing operator tolerances. LoRAForge now implements separate BF16 routed-token matrix-dot kernels: shrink uses sequential K=256 blocks and 16 output columns; expand uses sequential rank blocks of 16 and 64 output columns. Each uses FP32 accumulation and BF16 intermediate/delta rounding. These new kernels were implemented here against the observed SGLang 0.5.22 default reduction contract, retaining native slot layout but no framework dependency. FP32/FP16 retain the extracted GEMV kernels. This is a correctness compatibility path; performance equivalence and tuned SGLang configurations are not claimed. Hardware/full-model results are tracked in sglang.md.

Probe rank-aware policy extraction (2026-11-03)#

integrations/_sglang_rank_aware.py extracts the non-split segmented shrink kernel from public probe commit 5fd6ae060d106066b306959f9a34b726a281ef4c, tools/llm_fleet/sglang_plugin/probe_sglang_gemv/rank_aware_shrink.py. The source identifies itself as derived from SGLang 0.5.22’s sglang/kernels/ops/lora/dense/chunked_sgmv_shrink.py (Apache-2.0), with Shenghui Li’s actual-rank column-block early exit. This extraction retains that attribution and algorithm; it renames the kernel, omits the custom cache decorator and split-K/prefill tuning, and adds a narrow wrapper using installed native launch configuration. Native expand remains native. Explicit native split-K settings delegate back to native shrink. No Qwen-specific table, global config patch or Fleet adapter shadow pool is installed. The previous statement that no upstream implementation was copied describes the original GEMV extraction; this separately attributed extraction does include a derived SGLang kernel.

Pinned probe source SHA-256: 0af480cc8ead0a7c40292dee1d20551232a6228c3a189758051f9c92bd56a92a.

Isolated Fleet gate/up expansion experiment#

The benchmark-only sglang_gate_expand_experiment.py follows the compact B layout and device metadata design in public probe commit 5fd6ae060d106066b306959f9a34b726a281ef4c, tools/llm_fleet/sglang_plugin/probe_sglang_gemv/fast.py and fast_decode.cu. Its Python wrapper was implemented here with fixed per-slot regions, only for gate/up, refreshed from native B buffers after native loading. It does not import the per-checkpoint manifest cache, Qwen tuning tables or prefill replacement. The explicitly supplied compiled HIP library remains external; its hash is recorded by the service pilot. No native source is copied into the installed package by this experiment. GPU/serving validation is recorded separately in the SGLang guide.

Complete Fleet / RowExpand extraction#

The opt-in fleet SGLang policy extracts the measured retained-rank path from probe commit 5fd6ae060d106066b306959f9a34b726a281ef4c, under tools/llm_fleet/sglang_plugin/probe_sglang_gemv/. Attribution: Shenghui Li, Apache-2.0. The source ledger is:

Source

SHA-256

Destination

fast_decode.cu

e26ca56e16945362cb9c96a2be6f01de78920e42eee63908161deeb226a87260

ops/csrc/rowexpand.cu

fast.py

bd6a953ac82782dcdfafb05e4c4351ccc7f32109e0bf4cc19599b78312dfb1bc

runtime/retained.py, integrations/_sglang_fleet.py

mi250x_qwen50_fleet_dispatch.json

245318e64963720c2ba13034598a1aa815c7320aee52438519082b67bb5b63da

integrations/data/mi250x_fleet_dispatch.json (byte-identical)

stable_prefill.py

5cb43562ab9e53648ad024b31ed7bc9f8d68c2ce6cbb40b3b866f0b507e8d6a0

integrations/_sglang_stable_prefill.py

Native arithmetic and the frozen profile are retained: table-selected decode A, all supported decode B ranks, prefill B only through rank 16, rank-aware native fallback elsewhere. The B fields in the historical tuning table do not override this measured profile. The native padded pool remains resident; compact B regions belong to known checkpoints, with per-slot device ranks and offsets. Fused A slices are repacked after native loading using effective module ranks.

Intentional maintenance changes: package and lazily compile the extension; separate runtime layout from framework integration; use weak pointer registries and pool-owned entries; make the adapter catalog explicit; validate padded headers and nonzero tails before execution; reject unknown reloads before native mutation; add same-device/shape/dtype/stride guards and autograd rejection; separate launch statements for PyTorch HIPify parsing; replace probe environment names and remove implicit stable-prefill enablement. Qwen stable prefill remains an explicit, narrowly guarded hook; it is not enabled for Llama or by default. The frozen dispatch is currently gated to gfx90a. This does not claim CUDA Fleet validation, mixed-attention extensions, speculative/MoE/TP support or performance portability. Other exploratory probe backends are not part of this measured path.

adapters/sglang.py is new integration glue: it explicitly pads compact PEFT exports, folds per-module scaling into BF16 B and publishes true module ranks. This is a recorded format/scaling conversion, not another compression algorithm. The conversion can introduce BF16 rounding and requires corresponding validation.

The Qwen3.5 bounded-grid experiment used SGLang 0.5.22’s sorted adapter groups and fixed-size chunk contract. Its capacity bound and tests were new LoRAForge code; no new upstream kernel was copied. Although numerically unchanged, it regressed full-model service throughput and was reverted. It is recorded as a rejected experiment in the Qwen3.5 guide, not an enabled optimization.

Qwen3.5 prefill and metadata reuse prototypes#

benchmarks/qwen35_prefill_fused.py, qwen35_decode_silu.py and qwen35_metadata_cache.py are new LoRAForge research implementations. They use SGLang 0.5.22’s native sorted 16-token segment/pool contracts and the attributed Fleet retained-rank layout; no additional upstream kernel is copied. The two-dot prefill implementation keeps BF16 intermediates; B-at-SiLU preserves the tested native BF16 activation rounding. The cache reuses only consecutive static decode metadata, scoped to Fleet TP1/no-overlap workers and non-DP execution. These benchmark helpers do not replace the installed backend. Their check programs and source comparison receipts are documented in docs/qwen35-high-concurrency.md.

Qwen3.5 cold-prefill graph experiment#

benchmarks/qwen35_cold_prefill_metadata.py and qwen35_cold_prefill_graph.py are new process-local benchmark glue against SGLang 0.5.22’s ForwardMetadata, prefill graph runner and GDN eager metadata contracts. They add plain EXTEND preparation without copying upstream GPU kernels. Cold 8x128 queries use fixed independent metadata buffers; physical GDN state-slot translation remains native. Native convolution, recurrent, attention, KV writes and LoRA computations retain their order. The capture fixture must also be 8x128, because the default 1024+empty-requests fixture captures different convolution/chunk grids. These helpers are explicit benchmark opt-ins, not an installed-library runtime change.

NF4 base with BF16 LoRA benchmark#

prepare_qwen35_packed.py and prepare_qwen35_nf4.py generate a canonical Qwen3.5-0.8B fixture using native BF16 row concatenation and bitsandbytes0.50.2 NF4 block64/double-quantization operations. No quantization kernel is copied. The direct check_qwen35_nf4.py program uses those same library operations with the measured projection geometries. qwen35_nf4_compat.py is version-scoped process-local compatibility glue: it extends one SGLang0.5.22 ROCm method list while preserving the remaining verification, supplies the already-fused name map and separates the BF16 adapter file loader configuration from the quantized base loader. It changes no installed library default or shared SGLang file.

qwen35_packed_loader.py handles canonical fused checkpoint names directly through native full-weight loading and verifies114 actual projection tensors against their checkpoint values. This avoids upstream substring matching of qkv_proj as v_proj and gate_up_proj as up_proj, which silently skipped those parameters in rejected attempts. Other weights retain upstream loading. Numerical validation rejects null/nonfinite logprobs before any timing. See docs/qwen35-nf4.md for scope, rejected evidence and measured results.

NF4 scale reuse and projection screening#

benchmarks/qwen35_nf4_ops.py and check_qwen35_nf4_ops.py are new LoRAForge benchmark implementations. They interpret bitsandbytes 0.50.2’s canonical NF4 nibble order, codebook and block-64 scale format; no upstream GPU kernel is copied. The block-scale reconstruction calls the installed bitsandbytes API. The Triton MFMA candidate follows the documented tl.dot operation contract; it is screened separately and is not the selected serving path.

qwen35_nf4_linear.py is a process-local SGLang 0.5.22 benchmark adapter for the prepared 114-projection fixture. It retains NF4 parameter bytes, caches only FP32 block scales, and uses temporary BF16 dequantization followed by the native linear operation at larger batches. Small batches and unsupported layouts use the original method. Versioned tensor/state changes invalidate eager scale reuse; captured graphs require immutable base weights. The experiment changes neither installed dependencies nor BF16 LoRA factors. See the NF4 guide for the explicit opt-in, exact-output checks, rejected kernels and same-card results.

NF4 rank-32 to rank-4 fixture comparison#

benchmarks/compress_qwen35_fixture.py applies the maintained loraforge.compression.truncate_lora API to deterministic rank-32 synthetic adapter files, then exports physical BF16 rank-4 factors with unchanged unit scaling. It uses the actual reported FlashTSQR/Jacobi backend; no QR or SVD implementation is substituted. For the 16-output GDN b/a branches, temporary zero output rows satisfy the rank-32 API dimension contract and are removed before export. Small-Gram norm identities check the BF16 export against the reported discarded spectrum without materializing dense weight updates. The source and destination files, dimensions, scaling and hashes are recorded. The comparison is an inference throughput experiment, not trained compression quality; random spectra and changed outputs remain explicit in its results.

Training transfer feasibility probe#

benchmarks/lora_training.py and check_lora_training.py are new LoRAForge experiments using standard frozen-base LoRA derivatives and the existing NF4 decoder. No Unsloth kernel or autograd implementation was copied. The reviewed reference is Unsloth commit 157305f6596d6196189bbc3e393bb8fe8ed604a0: unsloth/kernels/fast_lora.py blob b61333c1261ef29980509ecd7b057267f0c11f2d and swiglu.py blob b82c396c2bf02243c38baece006f3cb0d3b6d554, Apache-2.0, Daniel Han-Chen and the Unsloth team. The custom frozen-base lifetime and rematerialization concepts are attributed prior work, not new algorithm claims. The probe is first-order only and does not alter inference autograd restrictions or install training hooks. See docs/lora-training-transfer.md for exact forward/gradient evidence, scope, failed checker attempts and limitations.

BF16 LoRA MLP training fusion experiment#

benchmarks/lora_swiglu_training.py, lora_swiglu_kernels.py and check_lora_swiglu_training.py are new LoRAForge benchmark implementations of standard LoRA and SwiGLU forward/first-order backward equations. No Unsloth source was copied. The saved-wide-activation/rematerialization approach is established prior work; the same pinned Unsloth fast_lora.py and swiglu.py references above informed the experiment. This is not a novelty claim.

The new kernels combine tiny-rank expansion with activation consumption, and combine input-gradient LoRA corrections with residual addition. BF16 rounding boundaries remain explicit. The compact backward scales a freshly generated gradient buffer only after the frozen-base input-gradient GEMM has consumed it on the same stream. It never writes into saved input/activation/parameter storage. Trainable FP32 masters are recast on every invocation; no inference weight shadow is reused across optimizer updates. GPU kernels run only through the explicit standalone benchmark, with a CPU dense path solely for derivative and checkpoint tests. See docs/lora-swiglu-training.md for measured scope, compiled-baseline comparisons and rejected rank-32 scheduling.

Whole-model Qwen3.5 training harness#

prepare_qwen35_training.py, qwen35_training_mlp.py, benchmark_qwen35_training.py, run_qwen35_training.py and analyze_qwen35_training.py are new standalone benchmark glue, not extracted model or FLA kernels. They call Transformers 5.10.1’s native Qwen3.5 text model and PEFT 0.21.1, preserve actual trainable Parameter ownership, and compare complete forward/loss/backward/AdamW steps. Original HF weights are preserved with explicit text-only name mapping and a complete tensor audit.

FLA 0.6.0 is a separate isolated test dependency, using its published MIT license and upstream implementation; no FLA source is vendored into LoRAForge. The dependency wheel hashes and numerical/timing scope are recorded in docs/qwen35-training.md. The dependency selection follows the upstream backend installation guide without resolving or replacing the working ROCm Torch/Triton installation.

Separate native-base training consumers#

lora_native_training.py and the separate-base kernel in lora_swiglu_kernels.py are new LoRAForge benchmark implementations. They retain PEFT’s actual projection modules, master Parameters, input-cast boundaries and separate base-projection autograd nodes. The expansion-only, activation-only and combined consumer ablations do not copy an upstream implementation. They use the same standard first-order LoRA/SwiGLU equations and prior-work attribution as the preceding training experiments. check_native_silu.py screens Triton’s ROCm math interfaces against the installed native Torch activation on a stated finite BF16 input range; it is not a new activation algorithm or a whole-model equivalence test. The numerical failures and limited complete-step gains remain explicit in docs/qwen35-training.md. The optional --compile-backend cudagraphs path calls Torch’s installed AOT/ graph backend through its public compile interface; it vendors no compiler or graph implementation. Backend-managed capture warnings and failed native gates are retained rather than relabeled as consumer-kernel improvements.

Native-autograd graph isolation#

benchmarks/qwen35_training_graph.py is new LoRAForge benchmark glue around Torch’s installed torch.cuda.make_graphed_callables API. No Torch graph, Transformers model, FLA or causal-convolution implementation is copied or edited. It keeps original trainable Parameters and independent base projections, binds fixed-shape loss execution, disables AMP weight caching during capture, and owns the static input copy. Capture/replay counters instrument only graph objects constructed in this worker and restore the original factory after capture. The separate Dynamo-eager, AOT-eager and AOT graph-backend controls call Torch’s installed compiler backends; they are not LoRAForge compiler or kernel implementations. The optimizer remains outside graph capture and updates real FP32 LoRA masters. Changed-input, timed-loss and per-parameter acceptance checks remain explicit in the standalone model training experiment.

benchmarks/qwen35_training_mask.py is new fixed-scenario registration glue for Transformers 5.10.1. It reuses the original SDPA attention callable under a distinct interface key and guards the unpadded, unpacked, uncached causal contract. It copies no attention/mask/packing implementation. The explicit three rotary-position axes equal the native text model’s four-axis default after its [1:] selection; removing the separate automatic packing axis is scoped to the benchmark’s known single contiguous sequence. Original framework files and the sdpa registry entry remain unchanged. Native source hashes and rejected automatic-packing guard attempts are retained with the experiment.

Larger Qwen3.5 training fixture#

The existing LoRAForge text-checkpoint preparer now reads indexed HF shards while checking duplicate/missing/misindexed weights, unchanged BF16 matrices, complete expected text names and serialized values. It copies no model loader or framework implementation. The original public Qwen3.5-4B revision and LFS checksums are pinned in docs/qwen35-training-4b-mi250.json; no model weights are vendored. Benchmark layer/attention counts and full PEFT parameter names are configuration-derived, preserving the old native methods. The new --native-graph-only selection calls the previously recorded native graph and fixed-causal policy with original PEFT controls. Its 4B performance and exact gradient/update results are separate from the earlier 0.8B evidence.

Real-microbatch training sweep#

benchmarks/run_qwen35_training_batches.py is new standalone LoRAForge orchestration, not an imported trainer. It invokes the existing native PEFT and Torch graph experiments in isolated processes, retains recognized GPU OOMs separately from ordinary failures, and performs CPU comparisons after GPU use. The benchmark input helper builds independent deterministic sequence rows; gradient accumulation remains one. The fixed-causal registration is extended to positive rectangular unpadded/unpacked batches without copying or editing native attention, model, graph, FLA or convolution implementations. Audit sampling now covers every sequence and adds a per-sequence numerical gate. The unchanged 4B checkpoint and prior-work attribution above still apply. See docs/qwen35-training-batches.md for the protocol, measurements and limits.

Isolated Unsloth cross-entropy experiment#

benchmarks/qwen35_training_loss.py, check_unsloth_training_loss.py and run_qwen35_training_loss.py and diagnose_unsloth_training_loss.py are new experiment glue around pinned external Unsloth source. They do not vendor a kernel, import the complete trainer, or apply upstream global model patches. The caller supplies the original Apache-2.0 files at Unsloth revision a0197ca266e14d22f66c0dcffc452fe1ce42bb0f: unsloth/kernels/cross_entropy_loss.py, utils.py and rope_embedding.py. Copyright Daniel Han-Chen and the Unsloth team. All three SHA256 values are checked before selecting unchanged definitions through Python AST. The original notices remain with the external files. On ROCm/Triton 3.6, the dependency bindings use native Torch device context, Triton casts/libdevice and the HIP predicate. The optional, explicitly reported HIP launch selects 16384 elements and eight warps for the original chunked forward kernel; it does not change the forward/backward equations. The original launch is checked separately.

Unsloth Zoo revision 771dcfb9d9da713db32cc2abda73299ff3db33cd, unsloth_zoo/loss_utils.py and unsloth_zoo/fused_losses/cross_entropy_loss.py (LGPLv3) were reviewed to understand fused CE registration and the separate chunked LM-head/loss path. No Zoo implementation is copied or executed by this ablation. The model instance’s loss alone is replaced after unchanged weight loading; its LM-head GEMM, original adapters, FLA layers and optimizer remain in place. This is not a measurement of the complete Unsloth training stack.

The opt-in eager first-step audit saves sampled real head logits, initial adapter gradients and the first AdamW update before interpreting multi-step drift. Its actual-logit kernel comparison uses a stated BF16-rounded FP64 oracle; parameter comparisons run separately on CPU. Diagnostic tensor copies are outside step timing and do not change parameter ownership or loss scaling.

Frozen LM-head and native CE chunking#

benchmarks/qwen35_training_head.py, check_qwen35_training_head.py and run_qwen35_training_head.py are new LoRAForge benchmark code using native Torch linear/CE/autograd operations. No Unsloth or Zoo implementation is copied or executed by these paths. Chunked loss and precomputed first-order gradients are established approaches; the pinned Unsloth/Zoo references above informed the experiment, not a novelty claim.

The frozen-head function computes owned dHidden chunks in forward and returns them through the original model’s backward. It updates no Parameter or caller storage. It rejects a trainable head and supports first derivatives only. The benchmark uses unit upstream loss gradients with BF16 compute and no GradScaler; scaled BF16 loss gradients can have different rounding. A fully chunked head avoids a full-vocabulary output/gradient matrix. The separate full-reuse control preserves the original large GEMM shapes and reuses one private BF16 logits buffer for dLogits after each native CE backward has consumed that chunk. No output consumer or saved graph retains the overwritten logits. These are distinct strategies and their memory claims must not be conflated.

The wrapper calls the original already-adapted text backbone, retaining the identical original trainable Parameter objects and external AdamW optimizer. It is scoped to the existing single-adapter, dropout-zero, unpadded/unpacked Qwen3.5 experiment, not arbitrary PEFT hooks, trainable heads or a public Trainer integration. Graph mode passes this loss module to the existing native Torch graph API; no framework/GDN/attention kernel is replaced. Optional first-step full-vocabulary audit samples are detached and copied before private scratch is reused, then disabled before timing.

Qwen3.5 memory and phase accounting#

qwen35_resource_audit.py, run_qwen35_resources.py and analyze_qwen35_resources.py are new LoRAForge benchmark observers and CPU accounting tools. They use SGLang 0.5.22’s model-load/pool/graph lifecycle and native profiling endpoint, PyTorch allocator counters and Chrome trace events. No upstream GPU kernel is copied or replaced by these observers. Runtime peak resets/snapshots use untimed sentinels; profiler windows run after throughput and memory measurements. Phase attribution uses enclosing GPU annotations or explicit CPU runtime correlation links, retaining unknowns. Generic attention names require a source-verified allowlist; fused LoRA consumers remain separate from pure A/B costs. GPU sums, activity unions and inclusive CPU ranges are reported separately. Component storage accounting counts unique storages within each component; categories can share backing storage and are not automatically additive. Initial logprob-enabled traces are retained as diagnostic evidence, and the corrected requests disable logprob returns to match throughput. A NumPy scalar byte-count serialization failure in the first corrected-profile attempt is retained separately from accepted measurements; explicit integer conversion is regression-tested.

GDN storage sharing and NF4 byte-pair reconstruction#

qwen35_gdn_storage.py is new benchmark ownership code for the existing BF16 packed GDN prototype. It validates immutable TP1 weights before making the original parameter objects contiguous views into the packed owner. It preserves parameter metadata and covers explicit and closure-based lazy initialization before graph capture; no framework source is copied. Initial class-method-only interception failed to reach the prototype’s lazy closure. That no-op attempt is retained separately; regression coverage exercises the actual closure-based pattern. Storage accounting now measures the union of parameters and packed owners, making aliases and duplicate bytes explicit.

The byte-pair and split-K candidates extend the project’s NF4 Triton benchmark code above; no vendor implementation is copied. The selected byte-pair path loads each NF4 byte once, decodes its two values through the canonical FP32 codebook and interleaves exact BF16 reconstruction. It retains native linear accumulation and does not cache BF16 weights. Split-K candidates use FP32 partials with a separate reduction, were slower, and remain isolated screening code rather than serving dispatch. check_qwen35_nf4_candidates.py exposes the screen as a portable fixture-based program. Its numerical/timing-loop AST matches the GPU screen after equivalent function/output-path normalization. Opt-ins, paired controls, source hashes, failures and limits are recorded in the follow-up.

Installed experimental interfaces — 2026-11-05#

The selected implementations above are promoted from this repository’s 6b2e36a98406f43adf469de35d7835a4e2f93ce3 snapshot into the installed package. No new probe or third-party implementation is copied. The four selected reconstruction kernel ASTs are unchanged; rejected MFMA/split-K candidates remain benchmark-only. Source checksums are recorded with the API validation.

Previous benchmark implementation

Installed implementation

qwen35_nf4_ops.py selected reconstruction kernels

ops/_nf4_kernels.py, ops/nf4.py

qwen35_nf4_linear.py

integrations/_sglang_nf4_linear.py

qwen35_nf4_compat.py

integrations/_sglang_nf4_compat.py

qwen35_packed_loader.py

integrations/_sglang_qwen35_loader.py

qwen35_gdn_storage.py

integrations/_sglang_gdn_storage.py

Legacy benchmark imports now delegate to those implementations. Intentional changes add a validated, graph-compatible tensor entrypoint, explicit mode selection and conflicts, runtime/hardware/checkpoint guards and worker-plugin propagation. Admission source structure is still checked before rewriting the single allowed quantization list; other upstream checks remain intact. Public validation uses explicit exceptions rather than removable local assertions.

annotations.py is new dependency-free code, inspired by public alpha API annotation conventions. It copies no Ray code and adds no Ray dependency. It attaches immutable metadata and documentation, preserves object identity by default, and optionally warns once per process at synchronous entrypoints. The new sglang_experimental.py publishes actual installed NF4 and GDN APIs. _sglang_gdn.py independently wires one packed BF16 base projection to the original Linear adapter calls during decode, with unchanged prefill fallback. It covers native csgmv metadata preparation and does not require the private consumer/tiny-rank research hooks. Storage sharing reuses the attributed project-owned implementation above. Numerical/shape and package-validation boundaries are in experimental APIs.

vLLM linear decode extraction#

Source: Shenghui Li’s lishenghui/probe commit 5fd6ae060d106066b306959f9a34b726a281ef4c, files tools/llm_fleet/gemv_lora.py and tools/llm_fleet/vllm_gemv_patch.py. Original content hashes are recorded in vllm-source-hashes.json. The project-owned implementation is migrated under Apache-2.0 with source and authorship notices. No upstream vLLM code, experiment artifacts or launchers are copied. The inspected vLLM tag is 0.26.0, upstream commit 568afb3a13806beb53bb2e6bd518269357b237c0.

Destinations: ops/_vllm_gemv_kernels.py retains the shrink/expand mathematical kernels; ops/vllm_gemv.py provides lazy validated launchers; integrations/vllm.py adapts the reference linear-method replacement. Native slot layouts, FP32 intermediates, split-K atomic accumulation and the tokens/active-count heuristic are retained. Wrappers add device guarding, input validation and lazy imports. Registration is explicit, version-gated, repeatable and conflict-aware. An opaque torch.library.custom_op declares the output mutation and fake behavior. Prefill and unspecialized execution retain the original framework method.

This code intentionally lives separately from SGLang’s packed-slice operators; the two layouts and intermediate rounding contracts differ. No code on the concurrently developed SGLang branch is modified. See vllm.md for activation, validation scope and numerical limitations.

Retained-rank row operators#

Source: Shenghui Li’s lishenghui/probe commit 5fd6ae060d106066b306959f9a34b726a281ef4c, tools/llm_fleet/sglang_plugin/probe_sglang_gemv/fast_decode.cu. The original SHA256 is in row-source-hashes.json. The project-owned kernels are extracted under Apache-2.0 with source/authorship notices into ops/csrc/lora_rows.cu; ops/lora_rows.py and ops/_row_extension.py are new framework-independent validation/build wrappers. No SGLang/vLLM implementation, tuning table or experiment tree is imported.

The selected source already includes the CUDA/HIP warp-width split, current-stream launches, base-route guards and launch error checks. It differs from the frozen 2026-10-28 MI250X experiment snapshot; it is not represented as byte-identical Figure 12 code. The extraction preserves the packed effective-rank layout, vector B loads, shared Z staging, BF16 rounding and segmented persistent work schedule. Kernels are formatted/renamed; host wrappers add same-device checks. The Python interface additionally checks structures, alignment, inference-only use and output aliasing. Device metadata values remain a documented caller contract, without per-call host synchronization. The launch default uses twice the detected SM/CU count rather than the source’s AMD-specific 880-block default. No environment-variable compiler mutations, global workspaces, pointer registries or framework hooks are retained. L40S tests and hardware limits are documented in row-operators.md.

Current-main integration — 2026-11-08#

The existing NVIDIA compatibility patch is retained from main. The new vLLM and row implementations are taken from their extraction branches without numerical edits. ExperimentalAPI imports/decorators are the only changes to the three Python API modules; full module AST comparisons, after removing only those additions, match the source branches. The native row builder/kernel and Triton vLLM kernel sources are byte-identical. Baseline commit IDs and both source hashes are in row-validation-l40s.json. The record also checks the three row source hashes stored in both raw L40S XML receipts. These provenance checks do not turn synthetic operator tests into full-model or performance validation.