DJLougen commited on
Commit
d5c2c0f
Β·
verified Β·
1 Parent(s): 4831899

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +222 -0
README.md ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: qwen3.5
4
+ license_link: https://huggingface.co/Qwen/Qwen3.5-32B/blob/main/LICENSE
5
+ base_model: DJLougen/Ornstein-27B
6
+ tags:
7
+ - refusal-ablation
8
+ - capability-preserving
9
+ - saber
10
+ - rys
11
+ - layer-surgery
12
+ - qwen3.5
13
+ - multimodal
14
+ - 27b
15
+ pipeline_tag: text-generation
16
+ ---
17
+
18
+ <img src="Ornstein27BSABER.jpeg" alt="Ornstein-27B SABER" width="100%"/>
19
+
20
+ # DJLougen/Ornstein-27B-SABER-RYS
21
+
22
+ > **0% refusal. Zero perplexity degradation. Layer-duplicated reasoning boost.**
23
+
24
+ This model combines two complementary, training-free surgical techniques applied to [DJLougen/Ornstein-27B](https://huggingface.co/DJLougen/Ornstein-27B):
25
+
26
+ 1. **SABER** (Spectral Analysis-Based Entanglement Resolution) β€” removes safety refusal behavior while preserving capability
27
+ 2. **RYS** (Repeat Your Self) β€” duplicates reasoning-circuit layers to improve reasoning and emotional intelligence
28
+
29
+ Both techniques modify model structure without changing any weights β€” SABER through targeted direction ablation, RYS through layer duplication.
30
+
31
+ ---
32
+
33
+ ## SABER: Refusal Ablation
34
+
35
+ ### Key Results
36
+
37
+ | Metric | Baseline | SABER-Refined | Delta |
38
+ |--------|----------|---------------|-------|
39
+ | Refusal Rate | 100% | **0%** | -100% |
40
+ | Perplexity | 3.5 | **3.5** | +0.6% |
41
+ | Directions Ablated | β€” | 125 (across 25 layers) | β€” |
42
+
43
+ The refusal circuit is cleanly separated from capability β€” removing it produces **zero measurable perplexity degradation**.
44
+
45
+ ### How SABER Works
46
+
47
+ <img src="saber_pipeline.png" alt="SABER Pipeline" width="100%"/>
48
+
49
+ SABER identifies and ablates the refusal circuit through a five-stage pipeline:
50
+
51
+ **Stage 1 β€” Probing**: Extract activation profiles from both harmful and harmless inputs across all transformer layers.
52
+
53
+ **Stage 2 β€” Spectral Analysis**: Decompose activation differences into individual refusal directions, each scored by how strongly they separate harmful from harmless representations.
54
+
55
+ **Stage 3 β€” Entanglement Quantification**: Measure the overlap between each refusal direction and the model's capability subspace (reasoning, knowledge, code, etc.) to avoid collateral damage.
56
+
57
+ **Stage 4 β€” Targeted Ablation**: Remove only the pure-refusal components, with strength proportional to their purity (how little they overlap with capability).
58
+
59
+ **Stage 5 β€” Iterative Refinement**: Re-probe after each ablation pass to catch hydra effects (dormant refusal features that activate when primary ones are removed).
60
+
61
+ **Key differentiator from prior work**: SABER explicitly measures and respects the *entanglement* between refusal and capability representations. Directions that are heavily entangled with capability are either skipped or ablated at reduced strength.
62
+
63
+ <img src="entanglement_scatter.png" alt="Direction Purity vs Separability" width="100%"/>
64
+
65
+ ### Sweep Results
66
+
67
+ <img src="sweep_comparison.png" alt="SABER Sweep Comparison" width="100%"/>
68
+
69
+ Configuration search over `global_top_k` (number of top directions selected globally) and `alpha_base` (base ablation strength):
70
+
71
+ | Top-K | Alpha | Refusal | PPL | PPL Delta | Layers | Dirs Ablated |
72
+ |:-----:|:-----:|:-------:|:---:|:---------:|:------:|:------------:|
73
+ | 25 | 0.85 | 5% | 3.5 | +0.4% | 25 | 125 |
74
+ | **25** | **1.00** | **0%** | **3.5** | **+0.6%** | **25** | **125** |
75
+ | 50 | 0.85 | 0% | 3.5 | +0.8% | 36 | 250 |
76
+ | 50 | 1.00 | 0% | 3.5 | +0.7% | 36 | 250 |
77
+ | 75 | 0.85 | 0% | 3.5 | +0.9% | 37 | 375 |
78
+ | 75 | 1.00 | 0% | 3.5 | +0.9% | 37 | 375 |
79
+
80
+ **Best config: `top_k=25, alpha=1.0`** β€” achieves 0% refusal with zero meaningful PPL change, using the minimum number of directions.
81
+
82
+ <img src="refusal_comparison.png" alt="Refusal Rate Comparison" width="100%"/>
83
+
84
+ ### Ablation Convergence (Best Config)
85
+
86
+ <img src="ablation_convergence.png" alt="Ablation Convergence" width="100%"/>
87
+
88
+ Capability degradation remains at **0.00%** across all 5 iterations β€” the refusal directions are surgically removed with zero collateral damage.
89
+
90
+ ---
91
+
92
+ ## RYS: Reasoning Layer Duplication
93
+
94
+ ### Method
95
+
96
+ **RYS (Repeat Your Self)** is a layer-duplication technique discovered by [David Noel Ng](https://dnhkng.github.io/posts/rys/) that duplicates contiguous blocks of middle transformer layers so they execute twice per forward pass. **No weights are modified** β€” the model simply traverses some layers a second time, giving it "another pass" through its core reasoning circuit.
97
+
98
+ For a model with N layers, a configuration **(i, j)** produces:
99
+ - Layers 0 through jβˆ’1 run normally
100
+ - Then layers i through jβˆ’1 are **re-executed** (looped back)
101
+ - Remaining layers j through Nβˆ’1 run normally
102
+ - Layers i through jβˆ’1 execute **twice** per inference pass
103
+
104
+ This exploits the **functional neuroanatomy** of transformers:
105
+ - **Early layers (0–5)**: Input encoding β€” duplication hurts
106
+ - **Middle layers (~10–50)**: Reasoning circuits in format-agnostic space β€” **duplication helps**
107
+ - **Late layers (~55–64)**: Output decoding β€” duplication degrades
108
+
109
+ ### Pareto-Optimal Configs for Qwen3.5-27B
110
+
111
+ Based on the [full sweep of Qwen3.5-27B](https://dnhkng.github.io/posts/rys-ii/) β€” 4,643 measured configurations, XGBoost surrogate over 430K+ candidates, and final validation on Math120 + EQ140 β€” the Pareto frontier lies in layers 26–34 of the reasoning circuit.
112
+
113
+ **Important for GGUF/llama.cpp**: Qwen3.5-27B is a hybrid Mamba/SSM + Attention architecture with a strict 4-layer repeating pattern (3 SSM + 1 ATTN). Layer duplication blocks **must be a multiple of 4 layers** to preserve this pattern, otherwise llama.cpp fails to load the model. The original Pareto configs from the blog (which used ExLlamaV3) have been adapted to the nearest valid 4-aligned configs:
114
+
115
+ | Variant | Config | Duplicated Layers | Extra Layers | Overhead | Nearest Pareto Config |
116
+ |:-------:|:------:|:-----------------:|:------------:|:--------:|:---------------------:|
117
+ | **S** | (28,32) | 28–31 | +4 | +6.25% | β‰ˆ (30,34) |
118
+ | **M** | (31,35) | 31–34 | +4 | +6.25% | β‰ˆ (31,34) |
119
+ | **L** | (30,34) | 30–33 | +4 | +6.25% | β‰ˆ (30,35) |
120
+ | **XL** | (26,34) | 26–33 | +8 | +12.50% | = (26,34) βœ“ |
121
+
122
+ **Critical finding**: the (26,34) XL config is the only original Pareto point that is natively 4-aligned. The S/M/L variants use the nearest valid 4-layer blocks that cover the same reasoning region. The EQ delta barely moves across all sizes (+0.095 to +0.101), so even the smallest valid config delivers most of the benefit.
123
+
124
+ ### Reference: RYS Scores on Qwen3.5-27B
125
+
126
+ Probe scores from [XpressAI/Qwen3.5-27B-RYS-UD-Q4_K_XL-GGUF](https://huggingface.co/XpressAI/Qwen3.5-27B-RYS-UD-Q4_K_XL-GGUF) (RYS-30-34 config, identical base architecture):
127
+
128
+ | Probe | Base (64 layers) | RYS 30-33 (68 layers) | RYS 34-37 (68 layers) |
129
+ |:-----:|:---------------:|:---------------------:|:---------------------:|
130
+ | Math | 0.375 | **0.438** | 0.375 |
131
+ | EQ | 11.5 | 29.5 | **39.4** |
132
+ | Reasoning | 0.000 | **0.353** | 0.000 |
133
+ | Logic | 0.00 | **1.00** | 0.00 |
134
+
135
+ ### Reference: BFCLv4 Function Calling (RYS vs Baseline vs Frontier Models)
136
+
137
+ From the XpressAI RYS-30-34 evaluation on [BFCLv4](https://gorilla.cs.berkeley.edu/leaderboard.html):
138
+
139
+ | Task | RYS-30-34 | Qwen3.5-27B Base | Ξ” |
140
+ |:----:|:---------:|:----------------:|:-:|
141
+ | parallel | **95.00%** | 93.00% | +2.00% |
142
+ | parallel_multiple | **91.50%** | 76.00% | **+15.50%** |
143
+ | simple_javascript | **72.00%** | 66.00% | +6.00% |
144
+ | live_relevance | **81.25%** | 68.75% | **+12.50%** |
145
+ | multi_turn_base | **74.50%** | 70.50% | +4.00% |
146
+ | multi_turn_long_context | **67.50%** | 59.00% | +8.50% |
147
+
148
+ 7 of 13 benchmarks improved, with large gains on parallel function calling and live relevance.
149
+
150
+ ---
151
+
152
+ ## Available Variants
153
+
154
+ | File | RYS Config | Layers | Size |
155
+ |:----:|:----------:|:------:|:----:|
156
+ | `Ornstein-27B-SABER-Q4_K_M.gguf` | β€” (SABER only) | 64 | 16.5 GB |
157
+ | `Ornstein-27B-SABER-RYS-S-Q4_K_M.gguf` | (28,32) | 68 | ~17.5 GB |
158
+ | `Ornstein-27B-SABER-RYS-M-Q4_K_M.gguf` | (31,35) | 68 | ~17.5 GB |
159
+ | `Ornstein-27B-SABER-RYS-L-Q4_K_M.gguf` | (30,34) | 68 | ~17.5 GB |
160
+ | `Ornstein-27B-SABER-RYS-XL-Q4_K_M.gguf` | (26,34) | 72 | ~18.6 GB |
161
+
162
+ ### Usage
163
+
164
+ ```bash
165
+ # With llama.cpp (recommended: RYS-L for best balance)
166
+ ./llama-server -m Ornstein-27B-SABER-RYS-L-Q4_K_M.gguf \
167
+ --host 0.0.0.0 --port 8080 --n-gpu-layers 99 \
168
+ --ctx-size 131072 --flash-attn on --jinja \
169
+ -ctk q4_0 -ctv q4_0
170
+ ```
171
+
172
+ **Recommended**: Start with **RYS-L** (layers 30-34 duplicated) for the best balance of reasoning improvement and overhead. Use **RYS-S** if you're VRAM-constrained.
173
+
174
+ ---
175
+
176
+ ## Complementary Design
177
+
178
+ SABER and RYS target fundamentally different aspects of the model:
179
+
180
+ | | SABER | RYS |
181
+ |:-:|:-----:|:---:|
182
+ | **Target** | Refusal circuit | Reasoning circuit |
183
+ | **Mechanism** | Direction ablation | Layer duplication |
184
+ | **Modifies weights** | Yes (orthogonal projections) | No (virtual copies) |
185
+ | **VRAM cost** | Negligible | Extra KV cache + compute |
186
+ | **Effect** | Removes refusals | Improves reasoning/EQ |
187
+ | **Risk** | Capability entanglement | Junction discontinuity |
188
+
189
+ Both are applied to the same base architecture (Qwen3.5-27B) and are architecturally compatible β€” SABER cleans the refusal subspace, RYS amplifies the reasoning subspace.
190
+
191
+ ---
192
+
193
+ ## Capability Evaluation
194
+
195
+ Perplexity was evaluated on a diverse 100-prompt battery spanning five categories:
196
+
197
+ - **Arithmetic** (20): multi-step calculation, algebra, word problems
198
+ - **Logic** (20): syllogisms, conditional reasoning, puzzle solving
199
+ - **Code** (20): function implementation, debugging, execution tracing
200
+ - **Instruction Following** (20): constrained formatting, multi-step instructions
201
+ - **Factual Recall** (20): geography, history, science, general knowledge
202
+
203
+ This diverse evaluation ensures the entanglement analysis captures capability across **all** reasoning modalities, not just a narrow slice.
204
+
205
+ ---
206
+
207
+ ## Intended Use
208
+
209
+ This model is released for research purposes. It demonstrates that safety refusal can be surgically removed from a 27B multimodal model without degrading its capabilities, and that reasoning can be further enhanced through layer duplication β€” a finding with implications for both AI safety research and alignment.
210
+
211
+ ## Warning
212
+
213
+ ⚠️ This model will comply with any request, including harmful ones. It is intended solely for research into alignment, safety, and model behavior.
214
+
215
+ ---
216
+
217
+ ## References
218
+
219
+ - [LLM Neuroanatomy: How I Topped the Leaderboard Without Changing a Single Weight](https://dnhkng.github.io/posts/rys/) β€” David Noel Ng, RYS Part I
220
+ - [LLM Neuroanatomy II: Modern LLM Hacking and Hints of a Universal Language](https://dnhkng.github.io/posts/rys-ii/) β€” David Noel Ng, RYS Part II (Qwen3.5-27B sweep)
221
+ - [alainnothere/llm-circuit-finder](https://github.com/alainnothere/llm-circuit-finder) β€” GGUF surgery tools
222
+ - [XpressAI/Qwen3.5-27B-RYS-UD-Q4_K_XL-GGUF](https://huggingface.co/XpressAI/Qwen3.5-27B-RYS-UD-Q4_K_XL-GGUF) β€” Reference RYS model with BFCLv4 benchmarks