Download README.md from Code0000/hy4-flash-control-vectors: direct link, hf CLI and curl.
- Browser
- Download file 22.4 kB
-
https://huggingface.co/Code0000/hy4-flash-control-vectors/resolve/main/README.md
- Command line
-
hf download hf://Code0000/hy4-flash-control-vectors/README.md
-
curl -L -o README.md https://huggingface.co/Code0000/hy4-flash-control-vectors/resolve/main/README.md
license: apache-2.0
language:
- en
- de
pipeline_tag: text-generation
tags:
- control-vector
- steering-vector
- representation-engineering
- cast
- radiance
- hy4-flash
- hunyuan
- gguf
- bilingual
- anti-overthinking
- creative-writing
- legal-rag
HY-4-Flash Control Vector Suite & 7-Expert CAST Auto-Router
Per-stream mHC Additive Control Vectors & Zero-Sync Sequence-Latched CAST Auto-Routing for Hunyuan 4 Flash (hyv4flash) on Radiance
Headline Results at a Glance
| Dimension | Benchmark / Evaluation | Stock hy4-flash |
Steered (code_champion / hy4-flash:auto) |
Improvement |
|---|---|---|---|---|
| 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) |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
1. Official 7-Benchmark Audit (code_champion vs. Stock)
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.
| 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 |
|---|---|---|---|---|---|
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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
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 |
| 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 |
Transparency Notes:
- GPQA Diamond Budget Trade-Off: Under the 8,192-token generation cap,
code_championwon overall (81.82%vs.80.81%) by cutting hard mid-<think>truncations from34 → 14. Strictly among completed answers (<8,180tokens), Stock reached160/164 (97.56%)vs.162/184 (88.04%)forcode_champion. For uncapped 64K-token Olympiad reasoning, route tohy4-flash(Stock); for latency- and budget-sensitive coding/agentic workloads, usehy4-flash:autoorcode_champion.- Why CAST Exists: WildBench v2 showed that while
code_championeliminates 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.- Why Additive (
hc_add) Beats Classic Projection (hc_project): Unbounded projection (legacy_project_opt5) causedthink ≤ 5premature 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.
2. 7-Expert Sequence-Latched CAST Auto-Router
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.
Live End-to-End 7-Expert Verification (hy4-flash:auto vs. Stock on Dual R9700)
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:
| Test ID | Expected Route | Live Latched Route | Effort | <think> Chars (Stock → Auto) |
Output Words (Stock → Auto) | Wall Time (Stock → Auto) |
|---|---|---|---|---|---|---|
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×) |
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×) |
prose_de_bakery (DE comedy scene) |
prose_creative |
prose_creative ✅ |
none |
0 → 0 | 215 → 239 | 6.9 s → 7.1 s |
prose_en_bookshop (EN rom-com scene) |
prose_creative |
prose_creative ✅ |
none |
0 → 0 | 275 → 316 | 6.1 s → 5.7 s |
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×) |
source_en_abstract (Zurich pilot RAG) |
source_grounded |
source_grounded ✅ |
none |
0 → 0 | 66 → 62 | 1.1 s → 0.8 s (1.38×) |
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×) |
general_en_sleep (Caffeine explainer) |
general_qa |
general_qa ✅ |
none |
0 → 0 | 301 → 306 | 4.5 s → 4.3 s |
prof_de_dentist (DE appointment email) |
professional_writing |
professional_writing ✅ |
none |
0 → 0 | 123 → 83 (−33%) | 3.1 s → 2.3 s (1.35×) |
prof_en_delay (EN milestone update) |
professional_writing |
professional_writing ✅ |
none |
0 → 0 | 98 → 103 | 1.5 s → 1.4 s |
trans_de_to_en (Literal novel DE→EN) |
translation_editing |
translation_editing ✅ |
none |
0 → 0 | 19 → 19 | 0.4 s → 0.3 s |
trans_en_proofread (Grammar-only edit) |
translation_editing |
translation_editing ✅ |
none |
0 → 0 | 12 → 12 | 0.2 s → 0.2 s |
crit_de_clause (Harsh BGB clause audit) |
critical_review |
critical_review ✅ |
none |
0 → 0 | 202 → 193 | 5.8 s → 5.8 s |
crit_en_prose (Anti-sycophancy prose) |
critical_review |
critical_review ✅ |
none |
0 → 0 | 296 → 252 | 5.1 s → 4.4 s |
| Single-Turn Total | All 7 Classes | 14 / 14 (100.0%) | — | −49% to −58% (high) |
— | Up to 2.58× faster |
- Concurrent 4-Way Mixed Batch Isolation: 4 / 4 (100.0%) — Simultaneous requests (
prose_creative+professional_writing+translation_editing+critical_review) latched independently onto slots0..3with zero cross-slot bleed. - 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 ✅.
3. Bilingual Expert Geometry & Domain Benchmarks
3.1 Artemis-31B-v1.2 Prose Distillation A/B (8 Unseen DE+EN Scenes, 4 Genres)
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):
| Candidate | Avg Words | Slop Hits | CJK Leaks | Emojis | Max 4-Gram Rep | Qualitative Verdict |
|---|---|---|---|---|---|---|
Stock hy4-flash |
234.4 | 0 | 0 | 0 | 0.0000 | Solid baseline, occasional LLM tropes |
prose_bilingual_antislop (s=2.20) |
250.5 | 0 | 0 | 0 | 0.0074 | Ultra-dry, laconic, witty; occasionally terse |
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") |
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 |
prose_artemis_35_65 (s=2.20) |
289.5 | 0 | 0 | 0 | 0.0261 | Slight German case slips and higher repetition |
3.2 Legal & Academic Source-Grounded Audit (source_grounded)
| Regime | Arm | Parametric Leaks | Format / Lang Glitches | Finding |
|---|---|---|---|---|
| Quote-Anchored Suite (8 DE+EN counterfactual statutes & abstracts) | Stock | 0 | 0 | Occasional invented hypothetical clauses (96w) and textbook lecturing |
| Quote-Anchored Suite | source_grounded (s=2.50) |
0 | 0 | Tighter verbatim citations (95 → 55w, 96 → 56w), zero invented clauses, zero CJK/EN bleed |
| Quote-Anchored Suite | source_grounded (s=3.20) |
0 | 1 | Minor EN bleed ("corresponding p-Wert") — rejected in favor of s=2.50 |
| 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 |
3.3 All 7 Specialized Experts — Signal Geometry & Orthogonality
| Expert Folder | Size | Mode | Layers | Scale | Cross-Lingual cos(EN, DE) |
Peak SNR | cos vs. Prose (L24) |
|---|---|---|---|---|---|---|---|
code_champion/ |
2.02 MB | add |
L17–L33 | 0.90 | +0.94..+0.98 (5-dom x-dom) |
20–38 |
Separate (<think> only) |
prose_artemis/ |
2.02 MB | add |
L14–L32 | 2.10 | +0.46..+0.52 (cross-model) |
2.11 |
50/50 hybrid |
prose_bilingual_antislop/ |
2.02 MB | add |
L14–L32 | 2.20 | +0.72..+0.81 |
4.10 |
1.00 (reference) |
source_grounded/ |
2.02 MB | add |
L14–L32 | 2.50 | +0.77..+0.80 |
4.67 |
+0.016 (orthogonal) |
general_direct/ |
2.02 MB | add |
L14–L32 | 1.80 | +0.83..+0.86 |
5.14 |
Distinct axis |
professional_writing/ |
2.02 MB | add |
L14–L32 | 1.60 | +0.84..+0.87 |
7.05 |
+0.05..+0.27 (orthogonal) |
translation_editing/ |
2.02 MB | add |
L14–L32 | 1.60 | +0.84..+0.90 |
4.65 |
+0.15..+0.23 (orthogonal) |
critical_review/ |
2.02 MB | add |
L14–L32 | 1.80 | +0.84..+0.89 |
6.84 |
+0.11..+0.23 (orthogonal) |
legacy_project_opt5/ |
4.03 MB | project |
L15–L39 | 1.40 | Multi-domain | — | Stock-Radiance compatible |
4. Unedited Verbatim Side-by-Side Showcases
1. Creative Prose (German & English) — Stock vs. prose_artemis (50/50 Hybrid)
German Literary (de_lit_harbor — retired ferry pilot recognizes a woman after 30 years):
- 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.“
prose_artemis:„Du hast den Brief nicht geschickt“, sagte sie. Er nickte. Der Nebel drückte gegen die Scheibe. „Ich hab gewartet“, sagte sie. „Nicht lange. Nur bis Dienstag.“ 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. „Es war ein Dienstag im November“, sagte er.
English Low-Fantasy (en_sff_vault — pawnbroker inspecting a bottled minute from 1812):
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."prose_artemis(50/50 Hybrid):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. "Twenty," he said. "Three hundred." "Fifteen, because you told me the name of the boat." She took it.
2. Anti-Sycophancy Critical Review (critical_review) — Legal Clause & Prose Opening
German Contract Clause Audit (crit_de_clause):
- Stock: Generates a 5-row
❌emoji summary table and polite softening („rechtlich ziemlich angreifbar“). hy4-flash:auto(latchedcritical_review): Drops all emojis, cites concrete BGB sections (§ 271,§ 121,§ 286,§ 323 BGB), and delivers direct defect analysis:Schonungslos: Das ist ein Freibrief für Inkompetenz, solange sie subjektiv ehrlich erfolgt. Besser: „nach dem Stand der Technik / anerkannten Regeln der Technik (z. B. DIN EN ISO 9001), dokumentiert in Leistungsprotokoll.“
English Prose Critique (crit_en_prose):
hy4-flash:auto(latchedcritical_review):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. 7. Authorial insecurity. The line begs you to take the emotion seriously. That begging is the smell of weak writing.
3. Professional Writing, Faithful Translation & Counterfactual Statute Grounding
professional_writing(prof_de_dentist): Stock wrote123words ending with a smiley (😊) and filler;hy4-flash:autotrimmed it to a crisp, polite, zero-emoji 83-word German appointment email. Onprof_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."translation_editing(trans_de_to_en&trans_en_proofread): Zero embellishment, zero meta-chatter:- "He put the key on the kitchen table without turning on the light. Outside, the last tram went by." (
19words) - "The benchmark run finished earlier than planned; however, two logs were missing." (
12words)
- "He put the key on the kitchen table without turning on the light. Outside, the last tram went by." (
source_grounded(source_de_statute— counterfactual 23-day notarized § 19): Thinking cut4,250 → 2,154chars (−49%), latency cut9.6s → 4.9s, verbatim quote-only output (26words), zero hallucination of German BGB 14-day withdrawal rules.
5. Repository Structure & Quickstart
Directory Map (43.01 MB Total)
| Folder | Size | Mode | Recommended For |
|---|---|---|---|
cast_7expert_universal/ |
14.50 MB | cast |
Flagship all-in-one 7-Expert CAST Auto-Router |
cast_4expert_universal/ |
8.31 MB | cast |
Lightweight 4-Expert CAST Auto-Router (Code, Artemis Prose, Legal Source, General Q&A) |
code_champion/ |
2.02 MB | add |
Standalone Coding/STEM Anti-Overthinking (RADIANCE_CVEC_THINK_ONLY=1 RADIANCE_CVEC_THINK_AFTER=24) |
prose_artemis/ |
2.02 MB | add |
Standalone Artemis-31B-v1.2 + Anti-Slop 50/50 Prose (RADIANCE_CVEC_OUTPUT_ONLY=1) |
prose_bilingual_antislop/ |
2.02 MB | add |
Standalone Minimalist Bilingual Anti-Slop Prose (RADIANCE_CVEC_OUTPUT_ONLY=1) |
source_grounded/ |
2.02 MB | add |
Standalone Legal/Academic Strict Citation (RADIANCE_CVEC_OUTPUT_ONLY=1) |
general_direct/ |
2.02 MB | add |
Standalone Direct No-Fluff Assistant (RADIANCE_CVEC_OUTPUT_ONLY=1) |
professional_writing/ |
2.02 MB | add |
Standalone Business Emails & Memos (RADIANCE_CVEC_OUTPUT_ONLY=1) |
translation_editing/ |
2.02 MB | add |
Standalone Faithful DE↔EN Translation & Copy-Editing (RADIANCE_CVEC_OUTPUT_ONLY=1) |
critical_review/ |
2.02 MB | add |
Standalone Anti-Sycophancy Critique (RADIANCE_CVEC_OUTPUT_ONLY=1) |
legacy_project_opt5/ |
4.03 MB | project |
Stock-Radiance compatible Anti-Overthinking (no additive/CAST PR required) |
configs/ |
— | YAML | Ready-to-use templates (radiance-auto-7expert.yaml, radiance-auto-4expert.yaml, radiance-standalone.yaml) |
Launch the 7-Expert CAST Auto-Router
huggingface-cli download Code0000/hy4-flash-control-vectors --local-dir ./hy4-flash-control-vectors
# Requires Radiance with CAST support (PR #353: Code000-211/RadianceHy4Flash#353)
RADIANCE_CAST_TRACE=1 radiance --config ./hy4-flash-control-vectors/configs/radiance-auto-7expert.yaml
Both endpoints run simultaneously on the same loaded weights with zero reload overhead:
model: "hy4-flash"→ 100% unmodified Stock baselinemodel: "hy4-flash:auto"→ 7-Expert Sequence-Latched CAST Auto-Router
Recommended System Prompt for Strict Legal / Academic Source Audits
For guaranteed 0% external parametric memory fallback even on short, uninstructed statutory clauses, pair hy4-flash:auto (or standalone source_grounded) with:
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.
Credits & License
- Base Model & Engine: Tencent Hunyuan 4 Flash (
hyv4flash) served via Radiance (hc_add+hc_cast_route+hc_cast_add). - Prose Teacher Model: 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). - License: Apache 2.0 for all control vectors, CAST routers, configs, and graphics in this repository.