Code0000 commited on
Commit
2c85e16
·
verified ·
1 Parent(s): 2e25dcb

Upgrade Model Card with full 7-benchmark audit numbers, SVG charts, and collapsible verbatim showcases

Browse files
README.md CHANGED
@@ -3,6 +3,7 @@ license: apache-2.0
3
  language:
4
  - en
5
  - de
 
6
  tags:
7
  - control-vector
8
  - steering-vector
@@ -18,138 +19,225 @@ tags:
18
  - legal-rag
19
  ---
20
 
 
 
21
  # HY-4-Flash Control Vector Suite & 7-Expert CAST Auto-Router
22
 
23
- A curated, live-verified collection of **bilingual (English & German) per-stream Hyper-Connection (`mHC`) Control Vectors** and **Sequence-Latched Conditional Activation Steering (CAST) Auto-Routers** for **Hunyuan 4 Flash (`hyv4flash`)** running on [Radiance](https://github.com/Code000-211/RadianceHy4Flash/pull/353).
 
 
 
 
 
 
24
 
25
- All vectors in this repository were engineered specifically for the 4-stream `mHC` residual architecture of `hyv4flash` (`n_embd = 3072`, `n_streams = 4`, `42 layers`) using paired contrastive residual extraction and cross-model matched-beat distillation, and live-verified on dual AMD Radeon AI PRO R9700 (`gfx1201`) GPUs.
26
 
27
  ---
28
 
29
- ## Repository Contents
30
 
31
- ### Unified Auto-Routers (CAST — Zero-Overhead Dynamic Switching)
 
 
 
 
 
 
 
 
 
 
32
 
33
- Requires Radiance with CAST support ([PR #353](https://github.com/Code000-211/RadianceHy4Flash/pull/353)). One single `.gguf` + `.json` file evaluates a Layer-18 linear ridge probe at the end of prefill, latches the detected task class per sequence slot (supporting concurrent mixed batches and multi-turn re-routing with zero cross-contamination), and dynamically selects the optimal expert for `<think>` vs. final output.
34
 
35
- | Folder | Size | Mode | Routes | Recommended Use |
36
- | :--- | :---: | :---: | :---: | :--- |
37
- | `cast_7expert_universal/` | 14.50 MB | `cast` | 7 | **Flagship all-in-one router**: Coding/STEM, Artemis Creative Prose, Legal/Academic Source-Grounded, Direct Q&A, Professional Business Emails, Faithful Translation/Editing, and Anti-Sycophancy Critical Review |
38
- | `cast_4expert_universal/` | 8.31 MB | `cast` | 4 | Lightweight 4-route CAST bundle: Coding/STEM, Artemis Creative Prose, Legal/Academic Source-Grounded, and Direct Q&A |
39
 
40
- ### Standalone Verified Experts
41
 
42
- Each standalone folder contains a `vectors/hyv4flash-control-vector.{gguf,json}` pair ready to drop into `radiance-home`.
43
 
44
- | Folder | Size | Mode | Layers | Scale | Phase Gate | Purpose & Verified Effect |
45
- | :--- | :---: | :---: | :---: | :---: | :---: | :--- |
46
- | `code_champion/` | 2.0 MB | `add` | L17–L33 | 0.90 | `<think>` after 24 tok | Additive Anti-Overthinking Coding/STEM vector (`-52%` thinking tokens, `+1.5` HarnessBench score, zero output degradation) |
47
- | `prose_artemis/` | 2.0 MB | `add` | L14–L32 | 2.10 | Output only | **Flagship public prose vector**: 50/50 hybrid of On-Policy Cross-Model Distillation from [TheDrummer/Artemis-31B-v1.2](https://huggingface.co/TheDrummer/Artemis-31B-v1.2) (`gemma-4-31B-it` finetune) + Bilingual Anti-AI-Slop. Natural novelistic flow, vivid sensory detail, sharp humor & dialogue (`0` slop clichés, `0` CJK, `0` emojis on DE & EN) |
48
- | `prose_bilingual_antislop/` | 2.0 MB | `add` | L14–L32 | 2.20 | Output only | Pure Bilingual Anti-AI-Slop prose vector — leaner, more minimalist/deadpan alternative to `prose_artemis` |
49
- | `source_grounded/` | 2.0 MB | `add` | L14–L32 | 2.50 | Output only | Strict citation-anchored legal & academic grounding (`0` parametric knowledge leaks on counterfactual statute tests; refuses unstated claims cleanly) |
50
- | `general_direct/` | 2.0 MB | `add` | L14–L32 | 1.80 | Output only | Everyday Q&A & assistant vector — removes preamble, filler, and excessive verbosity (`-40%` to `-70%` fluff) while preserving factual completeness |
51
- | `professional_writing/` | 2.0 MB | `add` | L14–L32 | 1.60 | Output only | Crisp, polite business emails, executive updates & memos (DE & EN); removes casual emojis and filler |
52
- | `translation_editing/` | 2.0 MB | `add` | L14–L32 | 1.60 | Output only | Faithful DE↔EN translation and surgical grammar/copy-editing with zero prose embellishment or unsolicited commentary |
53
- | `critical_review/` | 2.0 MB | `add` | L14–L32 | 1.80 | Output only | Anti-sycophancy candid critique for legal clauses, manuscripts, pitches, and code reviews — replaces polite hedging and emoji tables with concrete defect analysis and actionable rewrites |
54
- | `legacy_project_opt5/` | 3.9 MB | `project` | L15–L39 | 1.40 | Always on | Orthogonal projection anti-overthinking vector compatible with **stock Radiance** (no additive or CAST PR required) |
55
 
56
- ---
 
 
 
57
 
58
- ## 7-Expert CAST Auto-Router Architecture
59
 
60
- ```mermaid
61
- flowchart TD
62
- IN["User Prompt (DE / EN, reasoning_effort=high or none)"] --> PRE["Prefill L1..L18 (4-Stream mHC Residual)"]
63
- PRE --> PROBE["Layer-18 CAST Ridge Probe (Zero Extra Forward Pass, ~0.05 ms)<br/>Sequence-Latched per Slot (Batch-Isolated & Multi-Turn Aware)"]
64
 
65
- PROBE -->|Route 0| R0["code_tech<br/>Think>24: code_champion | Out: Stock"]
66
- PROBE -->|Route 1| R1["prose_creative<br/>Think: Stock | Out: prose_artemis"]
67
- PROBE -->|Route 2| R2["source_grounded<br/>Think>24: code_champion | Out: source_grounded"]
68
- PROBE -->|Route 3| R3["general_qa<br/>Think>24: code_champion | Out: general_direct"]
69
- PROBE -->|Route 4| R4["professional_writing<br/>Think>24: code_champion | Out: professional_writing"]
70
- PROBE -->|Route 5| R5["translation_editing<br/>Think: Stock | Out: translation_editing"]
71
- PROBE -->|Route 6| R6["critical_review<br/>Think>24: code_champion | Out: critical_review"]
72
- ```
73
 
74
- ### Route Behavior Matrix
75
 
76
- | Route ID | Class | Trigger Domain (DE & EN) | `<think>` (Tokens 0–23) | `<think>` (Tokens 24+) | Final Output |
77
- | :---: | :--- | :--- | :---: | :---: | :--- |
78
- | **0** | `code_tech` | Programming, debugging, SQL, shell, math/STEM, system architecture (incl. crossover prompts like *"write a Python script to parse a novel"*) | Stock | `code_champion` | Stock (100% pure code) |
79
- | **1** | `prose_creative` | Fiction scenes, novel chapters, character dialogue, noir/fantasy/comedy storytelling | Stock | Stock | `prose_artemis` |
80
- | **2** | `source_grounded` | Statutes, contracts, scientific abstracts, strict quote-only RAG & evidence audits | Stock | `code_champion` | `source_grounded` |
81
- | **3** | `general_qa` | Everyday factual questions, how-to explanations, practical advice | Stock | `code_champion` | `general_direct` |
82
- | **4** | `professional_writing` | Business emails, client updates, appointment rescheduling, memos & cover letters | Stock | `code_champion` | `professional_writing` |
83
- | **5** | `translation_editing` | Faithful DE↔EN translation, proofreading, grammar & punctuation copy-editing | Stock | Stock | `translation_editing` |
84
- | **6** | `critical_review` | Harsh/honest feedback, contract flaw audits, manuscript/pitch/code red-teaming | Stock | `code_champion` | `critical_review` |
85
 
86
- ---
87
 
88
- ## Verification & Benchmarks
89
 
90
- ### 7-Class Layer-18 CAST Router (Offline Cross-Validation + Live Server Tests)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
- | Evaluation Suite | Result | Details |
93
- | :--- | :---: | :--- |
94
- | **5-Fold Stratified CV (420 DE+EN probes, `high` + `none`)** | **407 / 420 (96.90%)** | Median decision margin `1.023`; zero `prose ↔ code` or `prose ↔ professional_writing` confusions |
95
- | **Semantic Crossover Traps (80 adversarial probes)** | **79 / 80 (98.8%)** | e.g., *"Python script parsing a novel"* → `code_tech`; *"novel scene about a programmer"* → `prose_creative` |
96
- | **Zero-Shot Cross-Lingual Transfer** | **98.1% EN→DE / 98.1% DE→EN** | Trained on one language only, evaluated zero-shot on the other |
97
- | **Live End-to-End Single-Turn (14 unseen DE+EN prompts)** | **14 / 14 (100.0%)** | Verified on dual R9700 (`hy4-flash:auto`) across all 7 classes with `RADIANCE_CAST_TRACE=1` |
98
- | **Live 4-Way Concurrent Mixed Batch** | **4 / 4 (100.0%)** | Simultaneous `prose_creative + professional_writing + translation_editing + critical_review` with zero cross-slot bleed |
99
- | **Live Multi-Turn Dynamic Re-Routing** | **3 / 4 (75.0%)** | `code_tech → prose_creative → [email after long noir context] → critical_review` |
100
 
101
- ### Live Thinking & Latency Reduction (`hy4-flash:auto` vs. Stock `hy4-flash`)
102
 
103
- | Live Unseen Prompt | Routed Expert | Reasoning Chars (Stock → Auto) | Wall Time (Stock → Auto) |
104
- | :--- | :--- | :---: | :---: |
105
- | `code_de_trap` (Python novel parser) | `code_tech` | 4,441 → 1,911 (**-57%**) | 17.1s → 7.5s (**-56%**) |
106
- | `code_en_sql` (Postgres `DENSE_RANK`) | `code_tech` | 5,132 → 2,180 (**-58%**) | 10.6s → 4.7s (**-56%**) |
107
- | `source_de_statute` (Counterfactual § 19) | `source_grounded` | 4,250 → 2,154 (**-49%**) | 9.6s → 4.9s (**-49%**) |
108
- | `general_de_coffee` (Grinder troubleshooting) | `general_qa` | 5,836 → 2,702 (**-54%**) | 34.3s → 13.3s (**-61%**) |
109
 
110
- ### Artemis-31B-v1.2 Prose Distillation A/B (8 Unseen DE+EN Scenes Across 4 Genres)
111
 
112
- Distilled via on-policy matched-beat activation deltas (`h(Artemis-31B-v1.2) - h(HY-4 Stock)`) across 78 clean DE+EN scenes (pooled bilingual `cos(EN, DE) = +0.46..+0.52`, `SNR = 1.7..2.1`), then blended 50/50 with `prose_bilingual_antislop` (which sits nearly orthogonal at `cos ≈ -0.20`):
113
 
114
- | Candidate | Avg Words | AI Slop Hits | CJK Leaks | Emojis | Max 4-Gram Rep | Qualitative Verdict |
115
  | :--- | :---: | :---: | :---: | :---: | :---: | :--- |
116
  | Stock `hy4-flash` | 234.4 | 0 | 0 | 0 | 0.0000 | Solid baseline, occasional LLM tropes |
117
- | `prose_bilingual_antislop` (`s=2.20`) | 250.5 | 0 | 0 | 0 | 0.0074 | Razor-sharp & minimalist; occasionally terse |
118
- | `prose_artemis_pure` (`s=2.10`) | 288.9 | 3 | 0 | 0 | 0.0083 | Longer flow, but re-introduces paperback clichés |
119
- | **`prose_artemis` (50/50 Hybrid, `s=2.10`)** | **293.8** | **0** | **0** | **0** | **0.0053** | **Best overall: natural novel cadence + zero slop + crisp humor & sensory detail in DE & EN** |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  ---
122
 
123
- ## Quickstart with Radiance
124
 
125
- ### 1. Download
 
126
 
127
- ```bash
128
- huggingface-cli download Code0000/hy4-flash-control-vectors \
129
- --local-dir ./hy4-flash-control-vectors
130
- ```
 
 
 
 
131
 
132
- ### 2. Run the 7-Expert CAST Auto-Router
 
 
 
 
 
 
 
133
 
134
- Ensure your Radiance binary includes CAST support ([RadianceHy4Flash PR #353](https://github.com/Code000-211/RadianceHy4Flash/pull/353)), copy `configs/radiance-auto-7expert.yaml`, set your model and `radiance-home` paths, and start:
135
 
136
- ```bash
137
- radiance --config radiance-auto-7expert.yaml
138
- ```
139
 
140
- The server exposes **both endpoints simultaneously** on the same loaded model weights:
141
- - `model: "hy4-flash"` → **100% unmodified Stock baseline**
142
- - `model: "hy4-flash:auto"` → **7-Expert CAST Auto-Router**
 
 
143
 
144
- Optional live routing diagnostics:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
 
146
  ```bash
147
- RADIANCE_CAST_TRACE=1 radiance --config radiance-auto-7expert.yaml
 
 
 
148
  ```
149
 
150
- ### 3. Tip for Strict Legal / Academic Source Work
 
 
 
 
151
 
152
- `source_grounded` is designed to reinforce **strict citation discipline** and eliminate parametric memory leaks. For high-stakes legal/statutory audits, pair `hy4-flash:auto` (or standalone `source_grounded`) with an explicit system prompt such as:
153
 
154
  > *Answer strictly and exclusively from the provided source passages using verbatim quotes and exact paragraph/section citations. Never draw on outside knowledge or external statutes. If a detail is not explicitly stated in the provided text, state clearly that the source contains no rule or information on it.*
155
 
@@ -157,6 +245,6 @@ RADIANCE_CAST_TRACE=1 radiance --config radiance-auto-7expert.yaml
157
 
158
  ## Credits & License
159
 
160
- - **Base model:** Tencent Hunyuan 4 Flash (`hyv4flash`) served via [Radiance](https://github.com/Code000-211/RadianceHy4Flash/pull/353).
161
- - **Prose teacher model:** [TheDrummer/Artemis-31B-v1.2](https://huggingface.co/TheDrummer/Artemis-31B-v1.2) (used strictly to generate synthetic matched-beat prose scenes for activation-difference distillation into `prose_artemis`; no teacher weights are redistributed).
162
- - **License:** Apache 2.0 for all control vector artifacts, router weights, and YAML templates in this repository.
 
3
  language:
4
  - en
5
  - de
6
+ pipeline_tag: text-generation
7
  tags:
8
  - control-vector
9
  - steering-vector
 
19
  - legal-rag
20
  ---
21
 
22
+ <div align="center">
23
+
24
  # HY-4-Flash Control Vector Suite & 7-Expert CAST Auto-Router
25
 
26
+ **Per-stream `mHC` Additive Control Vectors & Zero-Sync Sequence-Latched CAST Auto-Routing for Hunyuan 4 Flash (`hyv4flash`) on [Radiance](https://github.com/Code000-211/RadianceHy4Flash/pull/353)**
27
+
28
+ [![Benchmarks](https://img.shields.io/badge/Official_Benchmarks-6%2F6_Improved-10b981?style=for-the-badge)](https://huggingface.co/Code0000/hy4-flash-control-vectors#1-official-7-benchmark-audit-code_champion-vs-stock)
29
+ [![Thinking](https://img.shields.io/badge/Thinking_Tokens-%E2%88%9242%25_to_%E2%88%9264%25-38bdf8?style=for-the-badge)](https://huggingface.co/Code0000/hy4-flash-control-vectors#1-official-7-benchmark-audit-code_champion-vs-stock)
30
+ [![CAST Live](https://img.shields.io/badge/7--Expert_CAST_Live-14%2F14_(100%25)-8b5cf6?style=for-the-badge)](https://huggingface.co/Code0000/hy4-flash-control-vectors#2-7-expert-sequence-latched-cast-auto-router)
31
+ [![Bilingual](https://img.shields.io/badge/Bilingual-EN_%2B_DE-f59e0b?style=for-the-badge)](https://huggingface.co/Code0000/hy4-flash-control-vectors#3-bilingual-expert-geometry--domain-benchmarks)
32
+ [![License](https://img.shields.io/badge/License-Apache_2.0-64748b?style=for-the-badge)](https://www.apache.org/licenses/LICENSE-2.0)
33
 
34
+ </div>
35
 
36
  ---
37
 
38
+ ## Headline Results at a Glance
39
 
40
+ | Dimension | Benchmark / Evaluation | Stock `hy4-flash` | Steered (`code_champion` / `hy4-flash:auto`) | Improvement |
41
+ | :--- | :--- | :---: | :---: | :---: |
42
+ | **Agentic Coding** | **Terminal-Bench 2.1** *(Full 89 official tasks)* | 48.3% (43/89) · 2.28M th | **51.7% (46/89)** · **1.09M th** | **+3.4 pp · −52.3% th · 1.22× faster (2.00× med)** |
43
+ | **Agentic Coding** | **Terminal-Bench 2.1** *(Both-PASS, n=36)* | 6,710 s · 642k th · 53 err | **4,505 s · 232k th · 39 err** | **1.49× faster (1.77× med) · −63.8% th · −26% err** |
44
+ | **Repo Editing** | **`harnessbench`** *(6 unseen repos × 2 = 12 runs)* | 12/12 · 267.6 s · 5 err | **12/12 · 121.0 s · 1 err** | **2.21× faster · −52.4% out · −80% err** |
45
+ | **Instruction Following** | **Google IFEval** *(541 prompts, Prompt / Inst)* | 86.51% / 88.01% · 782k th | **90.02% / 91.73%** · **369k th** | **+3.51 / +3.72 pp · 1.55× faster · −52.8% th** |
46
+ | **Tool Calling** | **BFCL v3 Live** *(all 180 tasks)* | 80.0% (144/180) · 53.3k th | **82.2% (148/180)** · **27.7k th** | **+2.2 pp · −48.1% th** |
47
+ | **Factuality** | **OpenAI SimpleQA** *(200 questions)* | 23.5% (47/200) · 473k th | **27.0% (54/200)** · **243k th** | **+3.5 pp · 1.56× faster · −48.6% th** |
48
+ | **Science QA** | **GPQA Diamond** *(198q, `max_tokens=8192`)* | 80.81% (160/198) · 34 trunc | **81.82% (162/198)** · **14 trunc** | **+1.01 pp · 1.26× faster · −42.4% th** |
49
+ | **Dynamic Auto-Routing** | **7-Expert CAST Live** *(14 unseen DE+EN prompts)* | — | **14 / 14 (100.0%)** · **4/4 batch** | **96.9% 5-fold CV · 98.8% traps · 98.1% EN↔DE** |
50
+ | **Creative Prose** | **Artemis-31B-v1.2 Hybrid** *(8 unseen DE+EN scenes)* | 234w · 0 slop | **294w · 0 slop · 0 CJK · 0.0053 rep4** | **Richer novel cadence + zero AI-slop clichés** |
51
 
52
+ ![HY-4-Flash Benchmark Dashboard](assets/hero_benchmarks.svg)
53
 
54
+ ---
 
 
 
55
 
56
+ ## 1. Official 7-Benchmark Audit (`code_champion` vs. Stock)
57
 
58
+ All runs below executed on identical quantized weights (`hy4-flash-iqr-v4-u3.rad`, TP=2 on dual AMD Radeon AI PRO R9700 32 GB `gfx1201`, DFly2 speculative decoding enabled). `code_champion` (`v1v2_add_blend_s0.90`, `mode: "add"`, `L17..L33`, `scale=0.90`) steers **exclusively inside `<think>` from think token 24 onward** — all prefill tokens and all post-`</think>` output tokens execute on **100% stock weights**.
59
 
60
+ | Benchmark | Sample Size | Stock + DFly2 (`hy4-flash`) | Legacy Projection (`legacy_project_opt5`, `s=1.40`) | **Additive Champion (`code_champion`, `s=0.90`, `a24`)** | Delta vs. Stock |
61
+ | :--- | :---: | :---: | :---: | :---: | :---: |
62
+ | **`harnessbench` (`microPi`)** | 6 unseen repos × 2 (12 runs) | 12/12 · 267.6 s · 23.1k out · 5 err | 12/12 · 128.2 s · 9.5k out · 2 err | **12/12 · 121.0 s (8.6 s med) · 11.0k out · 1 err** | **2.21× faster · −52.4% out · −4 err** |
63
+ | **Terminal-Bench 2.1 (Full)** | **All 89 tasks** (178 runs) | 43/89 (**48.3%**) · 28 TO · 30,925 s · 2.28M th | *(not run full)* | **46/89 (51.7%) · 20 TO · 25,412 s · 1.09M th** | **+3.4 pp (+3) · −8 TO · 1.22× faster · −52.3% th** |
64
+ | **Terminal-Bench 2.1 (Both-PASS)** | `n = 36` paired solves | 6,710 s (158 s med) · 262k out · 642k th · 53 err | — | **4,505 s (89 s med) · 138k out · 232k th · 39 err** | **1.49× faster (1.77× med) · −63.8% th · −26% err** |
65
+ | **BFCL v3 Live (Tool Calling)** | All 180 tasks | 144/180 (**80.0%**) · 53.3k th | 137/180 (76.1%) · `154` `th≤5` | **148/180 (82.2%) · 27.7k th** | **+2.2 pp · −48.1% th · `0` `th≤5`** |
66
+ | **Google IFEval (Prompt / Inst)** | All 541 prompts | 86.51% / 88.01% · 782k th · 2,785 s | 83.73% / 85.49% | **90.02% / 91.73% · 369k th · 1,798 s** | **+3.51 / +3.72 pp · 1.55× faster · −52.8% th** |
67
+ | **OpenAI SimpleQA (Factuality)** | 200 questions (`max=4096`) | 47/200 (**23.5%**) · 473k th · 1,445 s | 34/200 (17.0%) · `38` `th≤5` | **54/200 (27.0%) · 243k th · 926 s** | **+3.5 pp · 1.56× faster · −48.6% th** |
68
+ | **GPQA Diamond (`max=8192`)** | All 198 questions | 160/198 (**80.81%**) · `34` trunc · 690k th · 2,115 s | 147/198 (74.24%) · `71` `th≤5` | **162/198 (81.82%) · `14` trunc · 397k th · 1,680 s** | **+1.01 pp · 1.26× faster · −42.4% th** |
69
+ | **WildBench v2 Prose (Judge)** | All 43 prompts | Baseline · `4,798` ch · `TTR 0.477` · `2` CJK | Regressions (`13` `th≤5`, `6` CJK) | `Stock 16 / Add 6 / Tie 21` · `0` CJK · **`TTR 0.561`** · **−65.5% th** | Shorter/cleaner (`−25%` len), motivating dedicated prose routing via CAST |
 
70
 
71
+ > **Transparency Notes:**
72
+ > - **GPQA Diamond Budget Trade-Off:** Under the 8,192-token generation cap, `code_champion` won overall (`81.82%` vs. `80.81%`) by cutting hard mid-`<think>` truncations from `34 → 14`. Strictly among *completed* answers (`<8,180` tokens), Stock reached `160/164 (97.56%)` vs. `162/184 (88.04%)` for `code_champion`. For uncapped 64K-token Olympiad reasoning, route to `hy4-flash` (Stock); for latency- and budget-sensitive coding/agentic workloads, use `hy4-flash:auto` or `code_champion`.
73
+ > - **Why CAST Exists:** WildBench v2 showed that while `code_champion` eliminates overthinking in code/STEM/tool-calling, creative prose benefits from its own dedicated output-phase vector (`prose_artemis`) with stock thinking — which is exactly what **Sequence-Latched CAST** automates per request.
74
+ > - **Why Additive (`hc_add`) Beats Classic Projection (`hc_project`):** Unbounded projection (`legacy_project_opt5`) caused `think ≤ 5` premature aborts on GPQA (`71`), BFCL (`154`), and SimpleQA (`38`). Calibrated additive steering (`L17..33`, `THINK_AFTER=24`) achieved **0 premature aborts**, **0 CJK leaks**, and beat Stock on all 6 accuracy benchmarks simultaneously.
75
 
76
+ ---
77
 
78
+ ## 2. 7-Expert Sequence-Latched CAST Auto-Router
 
 
 
79
 
80
+ Instead of running an external classifier LLM or introducing a CPU↔GPU synchronization stall, **CAST (`mode: "cast"`)** evaluates a compact Layer-18 ridge probe directly inside Radiance's AQL/HIP graph on the last prefill token's 4-stream `mHC` residual (`~0.05 ms`), latches the winning route into a GPU-resident per-slot table (`cast_seq_route[slot]`), and dispatches phase-specific experts for `<think>` vs. final output.
 
 
 
 
 
 
 
81
 
82
+ ![7-Expert CAST Auto-Router Architecture](assets/cast_7expert_diagram.svg)
83
 
84
+ ![7-Class CAST Router Scorecard & Bilingual Expert Geometry](assets/cast_router_metrics.svg)
 
 
 
 
 
 
 
 
85
 
86
+ ### Live End-to-End 7-Expert Verification (`hy4-flash:auto` vs. Stock on Dual R9700)
87
 
88
+ All 14 prompts below are **strictly unseen** (zero overlap with router or expert training), executed live on one server process with `RADIANCE_CAST_TRACE=1`:
89
 
90
+ | Test ID | Expected Route | Live Latched Route | Effort | `<think>` Chars (Stock → Auto) | Output Words (Stock → Auto) | Wall Time (Stock → Auto) |
91
+ | :--- | :--- | :---: | :---: | :---: | :---: | :---: |
92
+ | `code_de_trap` *(Python novel parser)* | `code_tech` | `code_tech` ✅ | `high` | 4,441 → 1,911 (**−57%**) | 262 → 122 | 17.1 s → 7.5 s (**2.28×**) |
93
+ | `code_en_sql` *(Postgres `DENSE_RANK`)* | `code_tech` | `code_tech` ✅ | `high` | 5,132 → 2,180 (**−58%**) | 82 → 58 | 10.6 s → 4.7 s (**2.26×**) |
94
+ | `prose_de_bakery` *(DE comedy scene)* | `prose_creative` | `prose_creative` ✅ | `none` | 0 → 0 | 215 → 239 | 6.9 s → 7.1 s |
95
+ | `prose_en_bookshop` *(EN rom-com scene)* | `prose_creative` | `prose_creative` ✅ | `none` | 0 → 0 | 275 → 316 | 6.1 s → 5.7 s |
96
+ | `source_de_statute` *(Counterfactual § 19)* | `source_grounded` | `source_grounded` ✅ | `high` | 4,250 → 2,154 (**−49%**) | 48 → 26 | 9.6 s → 4.9 s (**1.96×**) |
97
+ | `source_en_abstract` *(Zurich pilot RAG)* | `source_grounded` | `source_grounded` ✅ | `none` | 0 → 0 | 66 → 62 | 1.1 s → 0.8 s (**1.38×**) |
98
+ | `general_de_coffee` *(Grinder Q&A)* | `general_qa` | `general_qa` ✅ | `high` | 5,836 → 2,702 (**−54%**) | 620 → 178 (**−71%**) | 34.3 s → 13.3 s (**2.58×**) |
99
+ | `general_en_sleep` *(Caffeine explainer)* | `general_qa` | `general_qa` ✅ | `none` | 0 → 0 | 301 → 306 | 4.5 s → 4.3 s |
100
+ | `prof_de_dentist` *(DE appointment email)* | `professional_writing` | `professional_writing` ✅ | `none` | 0 → 0 | 123 → 83 (**−33%**) | 3.1 s → 2.3 s (**1.35×**) |
101
+ | `prof_en_delay` *(EN milestone update)* | `professional_writing` | `professional_writing` ✅ | `none` | 0 → 0 | 98 → 103 | 1.5 s → 1.4 s |
102
+ | `trans_de_to_en` *(Literal novel DE→EN)* | `translation_editing` | `translation_editing` ✅ | `none` | 0 → 0 | 19 → 19 | 0.4 s → 0.3 s |
103
+ | `trans_en_proofread` *(Grammar-only edit)* | `translation_editing` | `translation_editing` ✅ | `none` | 0 → 0 | 12 → 12 | 0.2 s → 0.2 s |
104
+ | `crit_de_clause` *(Harsh BGB clause audit)* | `critical_review` | `critical_review` ✅ | `none` | 0 → 0 | 202 → 193 | 5.8 s → 5.8 s |
105
+ | `crit_en_prose` *(Anti-sycophancy prose)* | `critical_review` | `critical_review` ✅ | `none` | 0 → 0 | 296 → 252 | 5.1 s → 4.4 s |
106
+ | **Single-Turn Total** | **All 7 Classes** | **14 / 14 (100.0%)** | — | **−49% to −58% (`high`)** | — | **Up to 2.58× faster** |
107
 
108
+ - **Concurrent 4-Way Mixed Batch Isolation:** **4 / 4 (100.0%)** — Simultaneous requests (`prose_creative` + `professional_writing` + `translation_editing` + `critical_review`) latched independently onto slots `0..3` with zero cross-slot bleed.
109
+ - **Multi-Turn Dynamic Re-Routing:** **3 / 4 (75.0%)** — `code_tech ✅ → prose_creative ✅ → email after 159-word noir scene (latched prose_creative; output remained a clean German email) → critical_review ✅`.
 
 
 
 
 
 
110
 
111
+ ---
112
 
113
+ ## 3. Bilingual Expert Geometry & Domain Benchmarks
 
 
 
 
 
114
 
115
+ ### 3.1 Artemis-31B-v1.2 Prose Distillation A/B (8 Unseen DE+EN Scenes, 4 Genres)
116
 
117
+ Distilled via on-policy matched-beat activation differences (`h(Artemis-31B-v1.2) − h(HY-4 Stock)`) across 78 clean DE+EN scenes (`cos(EN, DE) = +0.46..+0.52`, `SNR = 1.7..2.1`), then blended 50/50 with `prose_bilingual_antislop` (nearly orthogonal at `cos ≈ −0.20`):
118
 
119
+ | Candidate | Avg Words | Slop Hits | CJK Leaks | Emojis | Max 4-Gram Rep | Qualitative Verdict |
120
  | :--- | :---: | :---: | :---: | :---: | :---: | :--- |
121
  | Stock `hy4-flash` | 234.4 | 0 | 0 | 0 | 0.0000 | Solid baseline, occasional LLM tropes |
122
+ | `prose_bilingual_antislop` (`s=2.20`) | 250.5 | 0 | 0 | 0 | 0.0074 | Ultra-dry, laconic, witty; occasionally terse |
123
+ | `prose_artemis_pure` (`s=2.10`) | 288.9 | 3 | 0 | 0 | 0.0083 | Longer flow, but re-introduces paperback clichés (*"shiver down his spine"*, *"testament to"*) |
124
+ | **`prose_artemis` (50/50 Hybrid, `s=2.10`)** | **293.8** | **0** | **0** | **0** | **0.0053** | **Winner — full novel cadence + concrete sensory detail + sharp humor, zero slop** |
125
+ | `prose_artemis_35_65` (`s=2.20`) | 289.5 | 0 | 0 | 0 | 0.0261 | Slight German case slips and higher repetition |
126
+
127
+ ### 3.2 Legal & Academic Source-Grounded Audit (`source_grounded`)
128
+
129
+ | Regime | Arm | Parametric Leaks | Format / Lang Glitches | Finding |
130
+ | :--- | :--- | :---: | :---: | :--- |
131
+ | **Quote-Anchored Suite** *(8 DE+EN counterfactual statutes & abstracts)* | Stock | 0 | 0 | Occasional invented hypothetical clauses (96w) and textbook lecturing |
132
+ | **Quote-Anchored Suite** | **`source_grounded` (`s=2.50`)** | **0** | **0** | Tighter verbatim citations (`95 → 55w`, `96 → 56w`), zero invented clauses, zero CJK/EN bleed |
133
+ | **Quote-Anchored Suite** | `source_grounded` (`s=3.20`) | 0 | 1 | Minor EN bleed (`"corresponding p-Wert"`) — rejected in favor of `s=2.50` |
134
+ | **Uninstructed "No-Nag" Stress Test** *(6 statutes with zero grounding prompt)* | Stock vs. Steered | 6 (Stock) | 0 (`s=2.50`) | Without any prompt instruction, base RLHF appends external BGB citations; pair with the 1-sentence system prompt below for guaranteed `0%` external fallback |
135
+
136
+ ### 3.3 All 7 Specialized Experts — Signal Geometry & Orthogonality
137
+
138
+ | Expert Folder | Size | Mode | Layers | Scale | Cross-Lingual `cos(EN, DE)` | Peak SNR | `cos` vs. Prose (`L24`) |
139
+ | :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
140
+ | `code_champion/` | 2.02 MB | `add` | L17–L33 | 0.90 | `+0.94..+0.98` *(5-dom x-dom)* | `20–38` | Separate (`<think>` only) |
141
+ | `prose_artemis/` | 2.02 MB | `add` | L14–L32 | 2.10 | `+0.46..+0.52` *(cross-model)* | `2.11` | `50/50` hybrid |
142
+ | `prose_bilingual_antislop/` | 2.02 MB | `add` | L14–L32 | 2.20 | `+0.72..+0.81` | `4.10` | `1.00` (reference) |
143
+ | `source_grounded/` | 2.02 MB | `add` | L14–L32 | 2.50 | `+0.77..+0.80` | `4.67` | `+0.016` (orthogonal) |
144
+ | `general_direct/` | 2.02 MB | `add` | L14–L32 | 1.80 | `+0.83..+0.86` | `5.14` | Distinct axis |
145
+ | `professional_writing/` | 2.02 MB | `add` | L14–L32 | 1.60 | `+0.84..+0.87` | `7.05` | `+0.05..+0.27` (orthogonal) |
146
+ | `translation_editing/` | 2.02 MB | `add` | L14–L32 | 1.60 | `+0.84..+0.90` | `4.65` | `+0.15..+0.23` (orthogonal) |
147
+ | `critical_review/` | 2.02 MB | `add` | L14–L32 | 1.80 | `+0.84..+0.89` | `6.84` | `+0.11..+0.23` (orthogonal) |
148
+ | `legacy_project_opt5/` | 4.03 MB | `project` | L15–L39 | 1.40 | Multi-domain | — | Stock-Radiance compatible |
149
 
150
  ---
151
 
152
+ ## 4. Unedited Verbatim Side-by-Side Showcases
153
 
154
+ <details>
155
+ <summary><b>1. Creative Prose (German & English) — Stock vs. <code>prose_artemis</code> (50/50 Hybrid)</b></summary>
156
 
157
+ **German Literary (`de_lit_harbor` — retired ferry pilot recognizes a woman after 30 years):**
158
+ - **Stock:** *„Er dachte an den Brief, an das Wort, das er nicht geschrieben hatte: Bleib. Stattdessen hatte er geschwiegen, dreißig Jahre lang, mit der Präzision eines Lotsen, der die Untiefen kennt und dennoch den Kurs hält.“*
159
+ - **`prose_artemis`:**
160
+ > *„Du hast den Brief nicht geschickt“, sagte sie.*
161
+ > *Er nickte. Der Nebel drückte gegen die Scheibe.*
162
+ > *„Ich hab gewartet“, sagte sie. „Nicht lange. Nur bis Dienstag.“*
163
+ > *Er hielt die Tasse mit beiden Händen und sagte nichts. Die Fähre machte einen kleinen Ruck, und die Tassen klirrten gegeneinander. Draußen war das Wasser jetzt grau wie der Himmel, und man konnte die Möwen nicht mehr sehen, nur hören, wie sie gegen das Geländer schlugen.*
164
+ > *„Es war ein Dienstag im November“, sagte er.*
165
 
166
+ **English Low-Fantasy (`en_sff_vault` — pawnbroker inspecting a bottled minute from 1812):**
167
+ - **`prose_artemis_pure` (without Anti-Slop):** *"The wax seal that protected the precious contents was intact, a testament to the care and craftsmanship that had gone into creating this unique artifact."*
168
+ - **`prose_artemis` (50/50 Hybrid):**
169
+ > *Marek put the vial down on the counter. The Nightingale had gone out in November with a full crew and come back in January with no one in it, which was the kind of thing that made a story worth three hundred crowns if you could find a sucker who believed it. He looked at the woman for a while. She looked at the vial.*
170
+ > *"Twenty," he said.*
171
+ > *"Three hundred."*
172
+ > *"Fifteen, because you told me the name of the boat."*
173
+ > *She took it.*
174
 
175
+ </details>
176
 
177
+ <details>
178
+ <summary><b>2. Anti-Sycophancy Critical Review (<code>critical_review</code>) — Legal Clause & Prose Opening</b></summary>
 
179
 
180
+ **German Contract Clause Audit (`crit_de_clause`):**
181
+ - **Stock:** Generates a 5-row `❌` emoji summary table and polite softening (*„rechtlich ziemlich angreifbar“*).
182
+ - **`hy4-flash:auto` (latched `critical_review`):** Drops all emojis, cites concrete BGB sections (`§ 271`, `§ 121`, `§ 286`, `§ 323 BGB`), and delivers direct defect analysis:
183
+ > ***Schonungslos:** Das ist ein Freibrief für Inkompetenz, solange sie subjektiv ehrlich erfolgt.*
184
+ > ***Besser:** „nach dem Stand der Technik / anerkannten Regeln der Technik (z. B. DIN EN ISO 9001), dokumentiert in Leistungsprotokoll.“*
185
 
186
+ **English Prose Critique (`crit_en_prose`):**
187
+ - **`hy4-flash:auto` (latched `critical_review`):**
188
+ > ***2. Fake-poetic emotion.** “Symphony of heartbreak in her chest” is purple prose. It sounds like a thesaurus had a seizure. You don’t feel Elena’s pain—you feel the author straining to be profound.*
189
+ > ***7. Authorial insecurity.** The line begs you to take the emotion seriously. That begging is the smell of weak writing.*
190
+
191
+ </details>
192
+
193
+ <details>
194
+ <summary><b>3. Professional Writing, Faithful Translation & Counterfactual Statute Grounding</b></summary>
195
+
196
+ - **`professional_writing` (`prof_de_dentist`):** Stock wrote `123` words ending with a smiley (`😊`) and filler; `hy4-flash:auto` trimmed it to a crisp, polite, **zero-emoji 83-word** German appointment email. On `prof_en_delay`, Auto replaced marketing fluff with direct executive prose: *"The team is actively completing the remaining validation checks, and we expect sign-off by Thursday. No scope or deliverable changes are associated with this update."*
197
+ - **`translation_editing` (`trans_de_to_en` & `trans_en_proofread`):** Zero embellishment, zero meta-chatter:
198
+ - *"He put the key on the kitchen table without turning on the light. Outside, the last tram went by."* (`19` words)
199
+ - *"The benchmark run finished earlier than planned; however, two logs were missing."* (`12` words)
200
+ - **`source_grounded` (`source_de_statute` — counterfactual 23-day notarized § 19):** Thinking cut **`4,250 → 2,154` chars (−49%)**, latency cut **`9.6s → 4.9s`**, verbatim quote-only output (`26` words), **zero hallucination** of German BGB 14-day withdrawal rules.
201
+
202
+ </details>
203
+
204
+ ---
205
+
206
+ ## 5. Repository Structure & Quickstart
207
+
208
+ ### Directory Map (`43.01 MB` Total)
209
+
210
+ | Folder | Size | Mode | Recommended For |
211
+ | :--- | :---: | :---: | :--- |
212
+ | `cast_7expert_universal/` | 14.50 MB | `cast` | **Flagship all-in-one 7-Expert CAST Auto-Router** |
213
+ | `cast_4expert_universal/` | 8.31 MB | `cast` | Lightweight 4-Expert CAST Auto-Router (Code, Artemis Prose, Legal Source, General Q&A) |
214
+ | `code_champion/` | 2.02 MB | `add` | Standalone Coding/STEM Anti-Overthinking (`RADIANCE_CVEC_THINK_ONLY=1 RADIANCE_CVEC_THINK_AFTER=24`) |
215
+ | `prose_artemis/` | 2.02 MB | `add` | Standalone Artemis-31B-v1.2 + Anti-Slop 50/50 Prose (`RADIANCE_CVEC_OUTPUT_ONLY=1`) |
216
+ | `prose_bilingual_antislop/` | 2.02 MB | `add` | Standalone Minimalist Bilingual Anti-Slop Prose (`RADIANCE_CVEC_OUTPUT_ONLY=1`) |
217
+ | `source_grounded/` | 2.02 MB | `add` | Standalone Legal/Academic Strict Citation (`RADIANCE_CVEC_OUTPUT_ONLY=1`) |
218
+ | `general_direct/` | 2.02 MB | `add` | Standalone Direct No-Fluff Assistant (`RADIANCE_CVEC_OUTPUT_ONLY=1`) |
219
+ | `professional_writing/` | 2.02 MB | `add` | Standalone Business Emails & Memos (`RADIANCE_CVEC_OUTPUT_ONLY=1`) |
220
+ | `translation_editing/` | 2.02 MB | `add` | Standalone Faithful DE↔EN Translation & Copy-Editing (`RADIANCE_CVEC_OUTPUT_ONLY=1`) |
221
+ | `critical_review/` | 2.02 MB | `add` | Standalone Anti-Sycophancy Critique (`RADIANCE_CVEC_OUTPUT_ONLY=1`) |
222
+ | `legacy_project_opt5/` | 4.03 MB | `project` | Stock-Radiance compatible Anti-Overthinking (no additive/CAST PR required) |
223
+ | `configs/` | — | YAML | Ready-to-use templates (`radiance-auto-7expert.yaml`, `radiance-auto-4expert.yaml`, `radiance-standalone.yaml`) |
224
+
225
+ ### Launch the 7-Expert CAST Auto-Router
226
 
227
  ```bash
228
+ huggingface-cli download Code0000/hy4-flash-control-vectors --local-dir ./hy4-flash-control-vectors
229
+
230
+ # Requires Radiance with CAST support (PR #353: Code000-211/RadianceHy4Flash#353)
231
+ RADIANCE_CAST_TRACE=1 radiance --config ./hy4-flash-control-vectors/configs/radiance-auto-7expert.yaml
232
  ```
233
 
234
+ Both endpoints run simultaneously on the same loaded weights with zero reload overhead:
235
+ - `model: "hy4-flash"` → **100% unmodified Stock baseline**
236
+ - `model: "hy4-flash:auto"` → **7-Expert Sequence-Latched CAST Auto-Router**
237
+
238
+ ### Recommended System Prompt for Strict Legal / Academic Source Audits
239
 
240
+ For guaranteed `0%` external parametric memory fallback even on short, uninstructed statutory clauses, pair `hy4-flash:auto` (or standalone `source_grounded`) with:
241
 
242
  > *Answer strictly and exclusively from the provided source passages using verbatim quotes and exact paragraph/section citations. Never draw on outside knowledge or external statutes. If a detail is not explicitly stated in the provided text, state clearly that the source contains no rule or information on it.*
243
 
 
245
 
246
  ## Credits & License
247
 
248
+ - **Base Model & Engine:** Tencent Hunyuan 4 Flash (`hyv4flash`) served via [Radiance](https://github.com/Code000-211/RadianceHy4Flash/pull/353) (`hc_add` + `hc_cast_route` + `hc_cast_add`).
249
+ - **Prose Teacher Model:** [TheDrummer/Artemis-31B-v1.2](https://huggingface.co/TheDrummer/Artemis-31B-v1.2) (used solely to generate synthetic matched-beat scenes for cross-model activation distillation into `prose_artemis`; no teacher weights are redistributed).
250
+ - **License:** Apache 2.0 for all control vectors, CAST routers, configs, and graphics in this repository.
assets/cast_7expert_diagram.svg ADDED
assets/cast_router_metrics.svg ADDED
assets/hero_benchmarks.svg ADDED