Skip to main content

NCM: Sovereign Next-Concept Modeling Engine

PyPI version Python Versions CI Status License: MIT Release Zero Pickle

"Next-Concept Modeling proves that the industry's default reliance on 70B cloud autoregressive LLMs for basic document classification and triage is an inefficient legacy pattern.

By replacing sequential token iteration with multiscale discrete concept refinement, enterprises achieve 100% data sovereignty, sub-$0.00 marginal unit economics, and verified accuracy on existing enterprise hardware."


The Paradigm Shift

Traditional autoregressive LLMs generate text token by individual token ($L$ sequential steps). Diffusion models take 64–128 expensive denoising iterations.

Next-Concept Modeling (NCM) (arXiv:2610.14162, Stanford Hazy Research & Together AI) encodes knowledge into a coarse-to-fine hierarchy of discrete concept codes. Generation requires only one parallel forward pass per hierarchy level ($K=8\dots12$ total passes).

ncm-benchmarks is the independent, production-grade systems engineering stack that proves this architecture delivers on consumer laptops, legacy servers, and sovereign air-gapped appliances.

       AUTOREGRESSIVE (Legacy)                  NEXT-CONCEPT MODELING (NCM)
   Token 1 → Token 2 → ... → Token 512          Level 0: [ Coarse Gist / Topics  ]  Pass 1
        (512 Sequential Steps)                  Level 1: [ Structural Outline     ]  Pass 2
       High Latency & Cloud Lock-in             Level 2: [ Syntactic Refinement   ]  Pass 3
                                                Level 3: [ Exact Surface Details  ]  Pass 4
                                                    ↳ Only 8–12 Parallel Passes Total

⚡ Executive Breakthroughs (Real Hardware Receipts)

All figures measured and recorded in results/ across a consumer Ryzen AI 9 HX 370 CPU and a 2018 Tesla V100-SXM2:

Capability / Benchmark Industry Baseline NCM Sovereign Measured Result Strategic Impact
XSum Full Test Census (11,334 docs) Paper H100 GPU (28.0 ROUGE-L) 27.93 ROUGE-L on 2018 V100 (34.92 / 12.71) Exact full-corpus reproduction (within 0.07 pp) at 9.47 docs/sec.
Sudoku-Hard Reasoning (2,000 boards) 86.1% solved (Paper H100) 86.30% solved on V100
91.0% on CPU with Best-of-4 + Repair
+7.0 pp breakthrough over greedy baselines via bounded constraint search.
Zero-Pickle Safetensors + INT8 FP32 Python Pickles (untrusted code) 1.68x CPU Speedup (33.26s vs 55.93s) at -0.24 pp R-L Strict SHA-256 weight integrity, air-gapped security, sub-second latency.
Consensus Decoding (MBR $N=4$) Greedy single-shot draft +1.82 ROUGE-L (25.26 → 27.08)
+2.54 ROUGE-1
Minimum Bayes Risk draft-selection beats single pass without retraining.
Coarse Early-Exit (L0..L2) Full L0..L8 generation 3.38x CPU Speedup (356.02 ms vs 1205.13 ms/doc) Skip fine levels for rapid routing, deduplication & schema triage (results/hx370-cpu/frontier_checks.json).
Marginal Unit Economics Cloud APIs: $0.003–$0.02 / doc $0.0000 Marginal Cost on existing hardware Zero per-token billing, zero third-party data egress, zero GPU cluster requirements.

🚀 30-Second Quickstart

1. Install via PyPI

pip install ncm-benchmarks

2. Instant CLI Usage

# Summarize text directly from terminal using dynamic INT8 acceleration
echo "The Federal Reserve announced interest rate adjustments..." | ncm-bench summarize --quantize int8

# Run MBR consensus decoding (4 parallel candidates, +1.82 R-L boost)
ncm-bench mbr --text "Long legal brief or financial report..." --candidates 4

# Offline long-document chunking, PII scrubbing, and cryptographic audit receipts
ncm-bench summarize --input-file contract.pdf --long-doc --redact-pii --restore-pii --audit-receipt --json

# Early-exit sovereign triage (Level 0..2 classification + Best-of-K schema-repaired extraction)
ncm-bench triage --text "Urgent breach noticed by alice@corp.com ($480,000) on 2026-11-12" --labels finance,security,legal --max-level 2 --redact-pii --restore-pii --json

# Benchmark early-exit Level 0..2 vs full Level 0..8 decoding
ncm-bench early-exit-bench --n 8 --max-level 2 --quantize int8

# Generate sovereign GDPR/SOC2/HIPAA Markdown or HTML compliance report from audit JSONL
ncm-bench report --input audit_log.jsonl --output-file audit_report.html --html

3. Launch Local Sovereign API

# Start async FastAPI server with Prometheus metrics & OpenAI /v1/chat/completions
ncm-bench serve --port 8031 --quantize int8

🏢 Enterprise Architecture & Features

┌────────────────────────────────────────────────────────────────────────┐
│                        NCM SOVEREIGN PIPELINE                          │
├──────────────────┬────────────────────────────┬────────────────────────┤
│   DATA INGEST    │     CONCEPT ENGINE         │    ENTERPRISE OPS      │
│                  │                            │                        │
│ • PDF/HTML/CSV/  │ • Multi-scale Discrete VQ  │ • OpenAI Compatible API│
│   EML / Text / MD│ • 8–12 Parallel Passes    │ • Prometheus /metrics  │
│ • PII+Key+IBAN   │ • INT8 Dynamic Quantized   │ • HMAC-SHA256 Audits   │
│ • Sentence Chunk │ • Best-of-K MBR Consensus  │ • /triage/feedback &   │
│ • Span Provenance│ • LRU Coarse Code Cache    │   Compliance Reporter  │
└──────────────────┴────────────────────────────┴────────────────────────┘

🔒 Zero-Trust Air-Gapped Security

  • Zero-Pickle Safetensors: Eliminates Python pickle CVE attack vectors using standard .safetensors signed with SHA-256 digests in artifacts/SHA256SUMS.
  • Automated PII Sanitization: Client-side regex redaction/restoration guarantees Personally Identifiable Information never touches the model execution plane.
  • Air-Gapped Operation: Native enforcement of HF_HUB_OFFLINE=1 ensures zero outbound telemetry or dependency downloads during production runtime.

🧩 High-Reasoning Discrete Constraint Satisfaction

NCM's discrete code generation excels at structured reasoning. By pairing NCM parallel generation with deterministic clue-clamping and bounded 64-node backtracking (repair_sudoku_board), Sudoku-Hard accuracy reached 91.0% on CPU (98.47% cell accuracy, Wilson 95% CI: [83.77, 95.19]).

📦 Clean-Room Training, Concept RL & Distillation (ncm_train/)

While upstream releases provided inference-only evaluation, ncm-benchmarks delivers clean-room training, alignment, and distillation implementations:

  • Stage-1 & Stage-2 Pretraining: Multiscale Residual VQ-VAE + Next-Concept Transformer (194.08 → 3.79 Stage-1 loss in 40 steps via ncm-bench train-smoke).
  • Discrete Concept-Space GRPO / RLVR & DPO (ncm_train/rl_distill.py): Group Relative Policy Optimization (+0.0938 reward delta 0.5820 → 0.6758 in 24 CPU steps via ncm-bench rl-smoke) plus clean-room Concept-Space Direct Preference Optimization (DPOConfig, train_stage2_dpo).
  • Teacher-Student Concept Distillation: KL-guided distillation in hierarchical concept space (9.398 → 6.3534 loss in 20 CPU steps via ncm-bench distill-smoke).

🔬 Interactive Progressive Visualizer & Early-Exit Triage

  • Zero-Backend Explorer (docs/index.html): Inspect live Level 0..8 concept refinement, V100/CPU hardware receipts, interactive TCO comparisons, or connect directly to ncm-bench serve (POST /progressive_summarize, POST /triage, POST /triage/feedback).
  • Sovereign Structured Triage (ncm_bench/triage.py): Combines bounded LRU-cached coarse L0..L2 early-exit signatures (ConceptIndex, ConceptClassifier.partial_fit online learning) with CVE/IP/entity entity_spans provenance, custom enum/required-field schema repair, PII scrubbing/restoration, and NCMClient.triage_feedback().

🛠️ Python SDK & Integration

Minimal Python Client

from service.client import NCMClient

# Resilient client with automatic 429/503 exponential backoff
client = NCMClient(base_url="http://127.0.0.1:8031")

# Fast single-shot summary
result = client.summarize("Executive document text...")
print(f"Summary: {result['summary']} ({result['latency_ms']} ms)")

# Minimum Bayes Risk (MBR) consensus
consensus = client.mbr_summarize("Complex research analysis...", num_candidates=4)
print(f"Consensus: {consensus['summary']}")

# Early-exit Level 0..2 classification + schema-validated extraction
triaged = client.triage("Urgent invoice dispute for $12,000...", labels=["finance", "legal"])
print(f"Category: {triaged['category']} (valid={triaged['schema_valid']})")

High-Throughput Batch Triage

Process massive document archives with crash-safe resume tokens and dead-letter queue isolation:

python scripts/batch_triage.py --input raw_docs.jsonl --output triaged.jsonl --errors-out errors.jsonl --resume --concurrency 8

📊 Comprehensive Hardware Verification

Hardware Environment Workload Latency / Throughput Quality Score Source Receipt
Ryzen AI 9 HX 370 (CPU) XSum (FP32) 2.34 s/doc (marginal) 27.89 ROUGE-L results/hx370-cpu/
Ryzen AI 9 HX 370 (CPU) XSum (INT8 Quantized) 1.04 s/doc (1.68x speedup) 27.65 ROUGE-L results/hx370-cpu/
Ryzen AI 9 HX 370 (CPU) XSum Early-Exit (L0..L2, INT8) 356.02 ms/doc (3.38x vs L0..L8) 3/9 concept passes results/hx370-cpu/frontier_checks.json
Ryzen AI 9 HX 370 (CPU) Concept GRPO / RLVR (24 steps) Tiny clean-room smoke +0.0938 reward (0.582→0.676) results/hx370-cpu/frontier_checks.json
Ryzen AI 9 HX 370 (CPU) Sudoku-Hard (Greedy) 18.93 s (100 boards) 84.0% solved results/hx370-cpu/
Ryzen AI 9 HX 370 (CPU) Sudoku-Hard (Best-of-4 + Repair) 26.46 s (100 boards) 91.0% solved results/hx370-cpu/
Tesla V100-SXM2 (16GB) XSum Full Census (11,334 docs) 9.47 docs/sec (0.097 s/doc) 27.93 ROUGE-L results/v100-sxm2/
Tesla V100-SXM2 (16GB) XSum Batched (bs=64, FP32) 2,728.5 docs/min (0.022 s/doc marginal) FP32 Batch Sweep results/v100-sxm2/xsum_batch_sweep.json
Tesla V100-SXM2 (16GB) WMT14 En-De Full (3,003 sent, bs=32) 35.16 sent/sec (85.4 s wall) 21.72 BLEU results/v100-sxm2/wmt14_full_bleu.json
Tesla V100-SXM2 (16GB) Sudoku-Hard Full Test (2,000 boards) 76.9 boards/sec (26.0 s wall) 86.30% solved results/v100-sxm2/
Tesla V100-SXM2 (16GB) Sudoku Multi-Tier (6,000 boards, Best-of-4 + Repair) 97.03 / 77.77 / 48.2 boards/s 99.8% / 98.55% / 90.7% results/v100-sxm2/sudoku_multi_tier.json

Honest Engineering Note: Sub-second single-shot summarization does not hold on laptop CPUs in FP32 (2.34 s/doc); dynamic INT8 brings it down to 1.04 s. CPU batching (bs=8 vs bs=1) yields -1.9% because FP32 GEMMs already saturate 16 cores on a single document. On dedicated V100 GPUs, throughput scales linearly to 9.47 docs/sec.


🚢 Enterprise Deployment Options

  • Docker Compose: Pre-hardened container running unprivileged user (ncmuser), read-only root filesystem, cap_drop: ALL:
    docker compose up -d
    
  • Kubernetes Helm Chart: Production autoscaling deployment with liveness/readiness probes:
    helm install ncm-summarizer deploy/helm/ncm-summarizer/
    
  • Systemd Service: Host daemon configuration with memory quotas and watchdog timers:
    sudo cp deploy/systemd/ncm-summarizer.service /etc/systemd/system/
    sudo systemctl enable --now ncm-summarizer
    

📑 Strategic Whitepaper & Research References

  • Enterprise Whitepaper: Deep dive into sovereign unit economics, data compliance frameworks, and cold-storage triage architecture.
  • 100-Item Frontier Roadmap: Full 10-pillar engineering roadmap tracking delivered v2.0.0 / v2.1.0 capabilities and upcoming frontier milestones.
  • Launch & Press Kit: Verified publication hooks, technical executive briefs, and media statements.
  • Hermes EPYC Runbook: Automation runbook for high-throughput GPU/CPU stress testing and multi-dataset evaluation.

📄 License & Attribution

  • Implementation, CLI, SDK, and Benchmark Suite: MIT License (LICENSE).
  • Upstream Architecture & Checkpoints: Stanford Hazy Research & Together AI (MIT License). GPT-2, Qwen3, and BERT tokenizers adhere to their respective upstream licenses. See NOTICE for comprehensive provenance.

Metadata

Release files for ncm-benchmarks 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ncm-benchmarks 2.1.0
File Size Uploaded Provenance Actions
ncm_benchmarks-2.1.0.tar.gz 81.7 kB With provenance Details for ncm_benchmarks-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ncm-benchmarks 2.1.0
File Interpreter ABI Platform Actions
ncm_benchmarks-2.1.0-py3-none-any.whl Python 3 none any Details for ncm_benchmarks-2.1.0-py3-none-any.whl

Total release size: 146.0 kB

Release files / ncm_benchmarks-2.1.0.tar.gz

Download URL ncm_benchmarks-2.1.0.tar.gz
Size 81.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5d799e50e60a6f0112390761fc34b5fbc1a3136e6be23ddde92fa56b6cc2ec54
BLAKE2b-256 checksum
How to use checksums
4997a151f9dfd56f0d5250fbfa7639876fe00d7962a890a27904983e00d9ce59
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 Nov 14, 2026.

Transparency log

Release files / ncm_benchmarks-2.1.0-py3-none-any.whl

Download URL ncm_benchmarks-2.1.0-py3-none-any.whl
Size 64.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd03271bbf442e5c025cc057fc7cf21c93c1f1ee4da0e389d34ca978708ff955
BLAKE2b-256 checksum
How to use checksums
935edd98df38342bc86dfd8ac4f5a2e9620171d3480643b8e14b35603025ea1c
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 Nov 14, 2026.

Transparency log

Security for ncm-benchmarks 2.1.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.

Select from 2 files

Attestation for ncm_benchmarks-2.1.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 Nov 14, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page