loraspec — LoRA Subspace Auditor (KnOTS) & Per-Token Top-$k$ MoLoRA Triton Studio
Pre-flight Grassmann/SVD subspace collision & rank-collapse auditor, scalable factorized KnOTS joint-SVD alignment merger, and custom @triton.jit per-token Top-$k$ Arrow-SGMV multi-LoRA serving engine.
loraspec bridges the 2026 production gap between huggingface/peft (static merges and unbatched eager Arrow routing) and vLLM V1 (Punica SGMV kernels locked to one static LoRARequest per sequence).
Release Status: v1.0.0 Production Stable (GATE-7, Verified on NVIDIA A30 + CPU/MPS)
loraspec v1.0.0 ships a zero-pickle .safetensors inspector, factorized Grassmann/SVD subspace auditor, scalable KnOTS joint-SVD merger, custom @triton.jit per-token Top-$k$ Arrow-SGMV kernel, vLLM V1 plugin, and wheel-bundled dark-mode React 19 Telemetry Studio:
- Bounds-Safe
.safetensors& PEFT Inspector (src/loraspec/inspect/): Zero-picklebinary header + IEEE-754F32/F16/BF16tensor reader withadapter_config.jsonvalidation andlora_A/lora_Bpairing. - Factorized Rank-$r$ QR+SVD & Grassmann Subspace Math (
src/loraspec/core/): Computes singular spectra, effective stable rank $r_{\text{eff}} = |\Delta W|F^2 / |\Delta W|2^2$, spectral norm spikes, and pairwise Grassmann principal angles, chordal similarity, geodesic distance, and directional sign conflicts without materializing $O(d{\text{out}} d{\text{in}})$ matrices (atol <= 1e-9,< 10son 252-layer adapters with[spectral]). - Scalable Factorized
KnOTSJoint-SVD Alignment Merger (src/loraspec/knots/,loraspec merge): Conditioned thin-QR + compressed $R_{\text{sum}} \times R_{\text{sum}}$ core-SVD alignment across heterogeneous ranks ($r_m \in {4..128}$), supportingknots_ties,knots_dare_ties,knots_linear, factorizedGenKnowSubsubtraction (--gks-adapter), and PEFT export (78.25%sign-conflict reduction,82.79%energy retention at $r_{\text{out}}=32$, and3.5xcompositionalpass@1vspeft_tieson 5Qwen2.5-3B-Instructexperts). - Per-Token Top-$k$
ArrowRouter &@triton.jitArrow-SGMV(src/loraspec/kernels/,loraspec bench): Zero-shot unit singular routing prototypes + fused two-stage ragged-rank Triton kernels verified on liveNVIDIA A30(2.00x–2.76xsynthetic &1.59x–2.19xreal-adapter speedup,71.5%–76.8%scratchpad VRAM savings vspefteager Arrow, and100.0%single-domainpass@1on the 6-expertQwen2.5-3B-Instructstudy). vLLM V1Plugin & Wheel-Bundled React 19 Telemetry Studio (src/loraspec/serving/,ui/,loraspec serve/replay): Zero-patchvllm.general_pluginshook (loraspec_molora), FastAPI SSE/WebSocket gateway, wheel-bundledDEMO_REPLAY=truezero-GPU mode withLORASPEC_PUBLIC_DEMO_LOCK=truefilesystem lockdown, and 252-layer dark-mode React 19 Studio (Dockerfile+Dockerfile.gpu+docker-compose.yml).- Zero-CDN HTML Certification Card (
--html), OASIS SARIF 2.1.0 & GitHub Action (action.yml): Self-contained< 250 KBHTML Certification Cards, planted fault corpus (100%recall,0.0%FAR), and< 10s[spectral]BLAS CPU GitHub Action.
Empirical Highlights & Telemetry Studio Previews (NVIDIA A30 Verified)
Controlled 4-Arm Qwen2.5-3B-Instruct Study |
Pre-Flight Grassmann Subspace Collision Audit |
|---|---|
triton_arrow_sgmv reaches 100.0% single-domain pass@1; knots_ties retains 3.5x compositional pass@1 vs peft_ties (19.4% vs 5.6%). |
$0 CPU audit flags Grade D (MergeRiskScore 32.77), rank collapse (RULE-SPEC-002), and pairwise subspace collisions before merging. |
Multi-GPU Kernel Roofline (L4 / A30 / A100) |
peft Eager Stall vs @triton.jit Arrow-SGMV |
|---|---|
2.00x suite-wide mean speedup (2.76x peak on A30 64×64) with numerical error <= 3.27e-4 FP16 / <= 3.70e-3 BF16. |
76.8% scratchpad VRAM reduction (674.7 MB -> 162.2 MB on A30 64×64) with zero Python $K$-loop intermediate materialization. |
- 60fps Animated Token-Routing Studio Clip (
H.264MP4):assets/social/molora_arena_60fps.mp4 - Full Empirical Technical Report & INR Ledger:
docs/TECHNICAL-REPORT.md
Quickstart
# Out-of-tree zero-install via uvx (or pip install "loraspec[spectral,studio]")
uvx "loraspec[spectral]" doctor
# Or install workspace extras (runs 100% on CPU/MPS; add CUDA torch+triton on Linux GPUs)
uv sync --extra spectral --extra kernels --extra studio
# 1. Safely inspect a PEFT LoRA adapter directory (zero-pickle)
uv run loraspec inspect ./path/to/adapter
# 2. Audit >= 2 adapters for rank collapse & Grassmann collision -> JSON + SARIF 2.1.0 + HTML
uv run loraspec audit ./adapters/sql_lora ./adapters/rust_lora \
--out-dir ./artifacts/audit-01 \
--sarif ./artifacts/audit-01/report.sarif \
--html ./artifacts/audit-01/report.html \
--fail-on high
# 3. Align & merge heterogeneous LoRAs via factorized KnOTS joint-SVD
uv run loraspec merge ./adapters/sql_lora ./adapters/rust_lora \
--method knots_ties \
--target-rank 32 \
--out-dir ./artifacts/merged_knots_lora
# 4. Benchmark Arrow-SGMV parity & roofline or launch the bundled zero-GPU Telemetry Studio
uv run loraspec bench --synthetic --smoke
DEMO_REPLAY=true LORASPEC_PUBLIC_DEMO_LOCK=true uv run loraspec serve --port 8000
GitHub Actions Gate (action.yml)
permissions:
contents: read
actions: read
security-events: write
steps:
- uses: actions/checkout@v4
- uses: sashwat2212/loraspec@v1
with:
paths: "./adapters/sql_lora ./adapters/rust_lora" # or adapter-paths
fail-on: high
See action/README.md for full inputs and outputs.
Development Checks & Benchmarks
uv run ruff format --check .
uv run ruff check .
uv run pyright
uv run pytest -v
(cd ui && npm ci && npx tsc --noEmit && npm run build && npx playwright test)
uv run python benchmarks/planted_collisions/generate_corpus.py --out-dir /tmp/loraspec-corpus --verify
Documentation Index (SPEC-GATE SDLC Stages 0–7)
| Stage | Document | Description |
|---|---|---|
| Public Audit | results/public_lora_audit/AUDIT_REPORT.md | $0 CPU spectral & Grassmann audit of 31 real public Hugging Face Hub PEFT LoRAs (20.9% mean rank utilization, 48.4% rank collapse) |
| Walkthrough | docs/06-STUDIO-AND-APPLICATION-WALKTHROUGH.md | End-to-end application flow, tab-by-tab React 19 Studio walkthrough & non-AI geometric brand system |
| Runbook | docs/07-HARDENING-AND-A100-RUNBOOK.md | Production hardening matrix & step-by-step optional NVIDIA A100 (40GB/80GB) execution runbook |
| Report | docs/TECHNICAL-REPORT.md | Empirical v1.0.0 report: live NVIDIA A30 Arrow-SGMV roofline & 6-expert 4-arm Qwen2.5-3B study |
| Changelog | CHANGELOG.md | Complete release history from v0.1.0-alpha through v1.0.0 (GATE-5 → GATE-7) |
| Research | docs/RESEARCH-DOSSIER.md | 2025–2026 LoRA interference, Grassmann geometry, KnOTS, Arrow, GenKnowSub & vLLM V1 dossier |
| Stage 0 | docs/00-CHARTER.md | Charter, 4-Gate rename collision process (loraspec), SPEC-GATE 8-Stage SDLC & Unified Grading Rubric, ₹2,000–₹3,000 budget |
| Stage 1 | docs/01-BRD.md | Graded Business Requirements (BRD-REQ-01–22), KPIs (KPI-ENG/RES/SHW), risk register & Stakeholder Sign-Off Matrix |
| Stage 2 | docs/02-FRD-PRD.md | Complete PRD (EPIC-01–07, Graded FEAT-01–22) & FRD (Graded FRD-REQ-01–36, CLI/API/Pydantic v2 contracts, Graded NFR-01–08) |
| Stage 3 | docs/03-ARCHITECTURE.md | 5-Plane Architecture (ARCH-COMP-01–12), sequence diagrams, threat model & ADR-001–009 |
| Stage 4 | docs/04-DESIGN-SPECTRAL-AUDITOR.md | SDD-01: Bounds-safe .safetensors, factorized QR+SVD, Grassmann angles & MergeRiskScore |
| Stage 4 | docs/04-DESIGN-KNOTS-MERGER.md | SDD-02: Memory-safe Gram-QR KnOTS alignment, TIES/DARE, GenKnowSub & PEFT export |
| Stage 4 | docs/04-DESIGN-TRITON-MOLORA.md | SDD-03: Arrow prototype router, @triton.jit Top-$k$ Arrow-SGMV & PyTorch parity spec |
| Stage 4 | docs/04-DESIGN-VLLM-STUDIO.md | SDD-04: vLLM V1 plugin, FastAPI SSE/WS gateway, DEMO_REPLAY=true & React 19 Studio |
| Stage 4 | docs/04-DESIGN-CLI-CI-BENCHMARKS.md | SDD-05: CLI, SARIF 2.1.0/HTML reports, action.yml & L4/A30/A100 4-arm empirical study |
| Stage 5–7 | docs/05-IMPLEMENTATION-PLAN.md | Exhaustive 1-to-1 Bidirectional RTM (36/36 FRDs, 22/22 Features, exact symbols/tests), file-by-file plan, GATE-0..7 & INR ledger |
License
Apache License 2.0 — see LICENSE.
Metadata
Release files for loraspec 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| loraspec-1.0.0.tar.gz | 2.9 MB | With provenance | Details for loraspec-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| loraspec-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for loraspec-1.0.0-py3-none-any.whl |
Total release size: 3.2 MB
Release files / loraspec-1.0.0.tar.gz
| Download URL | loraspec-1.0.0.tar.gz |
|---|---|
| Size | 2.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1938b9e348859416eefb22d921dc3c62edc4df3a8c2bb7094864a79936e0a82c
|
|
BLAKE2b-256 checksum How to use checksums |
8feb87780e73c5efd6b4002e6a5fd655b5d95dae63529b45d1ac1e60cdc7c289
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logRelease files / loraspec-1.0.0-py3-none-any.whl
| Download URL | loraspec-1.0.0-py3-none-any.whl |
|---|---|
| Size | 281.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b84d9c01bffdcd69dc519ef81247fb704578424b65b643c0e8543897e5fba883
|
|
BLAKE2b-256 checksum How to use checksums |
3a1e4be6dcb3c49cec472383eb584a872f7e9a2e10ee27779b0653b22db920c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logSecurity for loraspec 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for loraspec-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.