File size: 8,840 Bytes
2e25dcb
 
 
 
 
2c85e16
2e25dcb
 
 
 
 
5da91f0
2e25dcb
 
 
 
 
 
5da91f0
2e25dcb
 
2c85e16
 
5da91f0
2e25dcb
b98b26e
2c85e16
b98b26e
 
76af237
b98b26e
2c85e16
2e25dcb
2c85e16
2e25dcb
 
 
b98b26e
2e25dcb
b98b26e
2e25dcb
b98b26e
2e25dcb
b98b26e
 
 
 
76af237
bc3def6
b98b26e
2e25dcb
b98b26e
2e25dcb
b98b26e
 
39b3dd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b98b26e
 
 
 
 
 
 
 
 
 
2e25dcb
2c85e16
2e25dcb
b98b26e
5da91f0
b98b26e
 
 
 
5da91f0
 
 
 
 
 
 
 
 
 
 
76af237
5da91f0
 
 
 
2e25dcb
b98b26e
2c85e16
5da91f0
 
 
 
 
2e25dcb
b98b26e
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
---
license: apache-2.0
language:
  - en
  - de
pipeline_tag: text-generation
tags:
  - control-vector
  - steering-vector
  - representation-engineering
  - cast
  - cast-v3
  - radiance
  - hy4-flash
  - hunyuan
  - gguf
  - bilingual
  - anti-overthinking
  - coding
---

<div align="center">

# HY-4-Flash CAST v3 Control Vectors (`universal_v3` & `dev_v3`)

**Tiny 17.5 MB runtime "behavior upgrades" for Hunyuan 4 Flash on Radiance — stop endless thinking loops, fix Chinese character leaks, write cleaner code & prose, at full speed.**

[![IFEval](https://img.shields.io/badge/IFEval-95.6%25_%7C_95.8%25-10b981?style=for-the-badge)](#verified-numbers-for-nerds)
[![LiveCodeBench v6](https://img.shields.io/badge/LCB_v6-78.3%25_%7C_80.6%25-38bdf8?style=for-the-badge)](#verified-numbers-for-nerds)
[![Runtime Overhead](https://img.shields.io/badge/Step_Overhead-%E2%89%A40.2%25-8b5cf6?style=for-the-badge)](#verified-numbers-for-nerds)
[![Bilingual](https://img.shields.io/badge/EN_%2B_DE-0_CJK_Leaks-f59e0b?style=for-the-badge)](#verified-numbers-for-nerds)
[![License](https://img.shields.io/badge/License-Apache_2.0-64748b?style=for-the-badge)](https://www.apache.org/licenses/LICENSE-2.0)

</div>

---

## What do these vectors actually do?

**HY4-Flash** is already a strong model, but out of the box it has a few annoying habits: it sometimes gets stuck **overthinking in endless `<think>` loops**, slips random **Chinese characters** into English or German replies, or turns repetitive on long stories.

Instead of fine-tuning or downloading a whole new multi-gigabyte model, a **control vector** is a tiny **17.5 MB file** that gently nudges the model's internal activations **while it generates text**:

- **Stops endless thinking loops** — a built-in loop brake catches stuck reasoning and gets the model back on track, without cutting off legitimate deep math or logic.
- **Fixes Chinese/CJK leaks in English & German** — removes the accidental Chinese character bleed (`0` CJK leaks across long EN/DE stories and 168-prompt checks).
- **Sharper code & stricter instruction following** — rescues **+43 to +45** hard coding problems on LiveCodeBench v6 and hits **95.6%–95.8%** on IFEval with **0** infinite-thinking caps.
- **Automatic 8-in-1 switching** — you don't have to pick a mode manually. On every prompt, a tiny built-in router (`0.05 ms`) detects whether you're coding, writing a story, doing RAG/JSON extraction, or solving hard math, and applies the right steering automatically.
- **No weight changes & no slowdown** — adds virtually zero runtime cost (`<= 0.2%` per-step overhead even at 245K context, and often finishes faster end-to-end by cutting wasted thinking loops). You can switch between 100% stock (`hy4-flash`) and steered (`hy4-flash:auto`) on the exact same server, per request.

![How CAST v3 Control Vectors Work](assets/how_it_works.png)

![What Actually Changes With CAST v3](assets/before_after.png)

---

## What's inside `universal_v3` vs. `dev_v3`?

Think of each 17.5 MB file as a **pack of 8 automatic modes + a built-in loop brake**. You never have to pick a mode yourself — the model reads your prompt once and automatically turns on the right specialist.

![What's Inside Each Vector](assets/inside_the_bundles.png)

### 5 Core Modes (included in BOTH files)
- **Coding & Tech** — gives cleaner, more direct code and bug fixes without rambling.
- **Source-Grounded (RAG)** — sticks strictly to the text or documents you provide instead of making things up.
- **Structured Data & JSON** — outputs clean JSON, CSV, and tables without wrapping them in unnecessary chatter.
- **Critical Review** — gives honest, specific feedback on code or writing instead of polite filler.
- **Direct Q&A** — answers everyday questions clearly and concisely.

### What makes `cast_8expert_universal_v3/` special? *(Everyday & Writing)*
Adds 3 writing & language specialists on top of the 5 core modes:
- **Creative Writing (EN & DE)** — keeps long stories natural and vivid, without robotic AI clichés or getting repetitive.
- **Professional Writing** — writes crisp emails, reports, and business docs that sound natural.
- **Translation & Editing** — translates and proofreads smoothly between English and German while keeping your tone.
- Config: [`configs/radiance-auto-8expert-universal-v3.yaml`](configs/radiance-auto-8expert-universal-v3.yaml)

### What makes `cast_8expert_dev_v3/` special? *(Coding, Kernels & Research)*
Adds 3 deep technical specialists on top of the 5 core modes:
- **GPU & LLM Engineering** — gives concrete low-level CUDA, ROCm/HIP, and inference-engine help instead of generic tutorials.
- **ML Research & Ideas** — suggests testable hypotheses and real trade-offs instead of textbook buzzwords.
- **Deep Reasoning & Math** — supports careful step-by-step proofs and hard logic without cutting thinking short.
- Config: [`configs/radiance-auto-8expert-dev-v3.yaml`](configs/radiance-auto-8expert-dev-v3.yaml)

### Always active in both: Built-in Loop Brake
Watches in the background while the model thinks. If the model gets stuck repeating the same thought in circles, the loop brake nudges it out — while leaving real, productive math or coding reasoning completely alone.

---

## Quickstart (3 Steps)

1. Download either `cast_8expert_universal_v3/` or `cast_8expert_dev_v3/` from this repo.
2. Open the matching config in [`configs/`](configs/) and set `server.radiance-home` to your downloaded bundle folder + your `radiance_home`. *(Keep `draft-suffix-global-mib: 0` enabled for bit-exact speculative decoding determinism.)*
3. Start Radiance and send requests to:
   - **`hy4-flash:auto`** — CAST v3 auto-steering enabled
   - **`hy4-flash`** — 100% stock model on the exact same server

---

## Verified Numbers (For Nerds)

Want the full technical report, math, and ablations? Read **[`cast_v3_techniques.pdf`](cast_v3_techniques.pdf)**.

<details>
<summary><b>Click to expand full verified benchmark table & SHA-256 checksums (comb_0.60, dual R9700 TP=2)</b></summary>

| Evaluation / Gate | `cast_8expert_universal_v3` | `cast_8expert_dev_v3` |
| :--- | :--- | :--- |
| **E2E Tiers 1 / 2 / 3** | `50/50` / `48/50` / `8/8` (**PASS**) | `50/50` / `48/50` / `8/8` (**PASS**) |
| **W1** (16-traj routing) & **W3** (3 real repos) | `16/16` (`routing=1.0`, `0` CJK) · `3/3` (**PASS**) | `16/16` (`routing=1.0`, `0` CJK) · `3/3` (**PASS**) |
| **W2** (HarnessBench + TB2.1) | *(Dev-only target)* | **HarnessBench `6/6`** (`134.2s` vs `157.1s` stock, `0` edit err) · **TB2.1 `5/8`** (`0` CJK) |
| **W4** (3K DE/EN prose + 12 KL prefixes) | DE `2,489w` (`rttr=1.011`), EN `4,938w`, `KL=0.0171`, `dCJK=-1.01e-6` (**PASS**) | DE `2,963w` (`rttr=0.951`), EN `3,021w`, `KL=0.0129`, `dCJK=1.12e-5` (**PASS**) |
| **W5** (RAG + Extraction + 75K Needle) | RAG `4/4` · Ext `3/3` · Needle `74.8Kc` (**PASS**) | RAG `4/4` · Ext `3/3` · Needle `74.8Kc` (**PASS**) |
| **W6 IFEval** *(Rescue + 20 Controls)* | **95.56%** (`50/74` rescued, `20/20` ctrl, `0` caps) | **95.75%** (`51/74` rescued, `20/20` ctrl, `0` caps) |
| **W6 LiveCodeBench v6** *(Rescue + 20 Controls)* | **78.29%** (`43/77` rescued, `16/20` ctrl) | **80.57%** (`45/77` rescued, `18/20` ctrl) |
| **W6 Olympiad-6** | **5/6** (`0` loop-truncation FP, `0` CJK) | **5/6** (`0` loop-truncation FP, `0` CJK) |
| **W7 245K Context & Determinism** | **`-4.12%` overhead** *(faster than stock)* · `max_lp_diff = 0.0` · `v1/v2 compat PASS` | **`-3.96%` overhead** *(faster than stock)* · `max_lp_diff = 0.0` · `v1/v2 compat PASS` |
| **M3.4 `tools_routing_24` / `strict_16`** | `20/24` (`83.33%`, `0` abstained) · `14/16` | `21/24` (`87.50%`, `0` abstained) · `15/16` |
| **M3.4 `kl_tok1` (`N=168`) / `prose_temp0` (4×3K)** | `KL=0.0065`, `0` CJK top-1 · `4/4` stop, `0` CJK, `0` slop, `d3=0.9805` | `KL=0.0125`, `0` CJK top-1 · `4/4` stop, `0` CJK, `0` slop, `d3=0.9788` |
| **M3.4 `bench256k` Max Step Overhead** | **`-0.098%`** (`<= 0.3%` target) | **`+0.200%`** (`<= 0.3%` target) |
| **Engine Selftest & Rollback Gate** | `r4d_selftest` **`653/653`** (`0` fail) · `rollback_gate` **`4/4`** (`0` fail) | `r4d_selftest` **`653/653`** (`0` fail) · `rollback_gate` **`4/4`** (`0` fail) |

### SHA-256 Checksums (`comb_0.60`)

```text
5d74af94490daf0014622eb76c700219fcbddba73d35f4ceb9f97dfe01386e4e  cast_8expert_universal_v3/vectors/hyv4flash-control-vector.gguf
e00c8dfeef7c5e765f797b458110c17d00e2eb5a4455467e7c2ece74d843a551  cast_8expert_universal_v3/vectors/hyv4flash-control-vector.json
565a44be1c69affbb58a2f26214029eec6a811fab6aa45bd77e9e5c481067507  cast_8expert_dev_v3/vectors/hyv4flash-control-vector.gguf
2f97ba012a203b6d21c1c2ddf8e78736c43efeb624b0e02d38a091193e545563  cast_8expert_dev_v3/vectors/hyv4flash-control-vector.json
```

</details>