Text Generation
Transformers
Safetensors
HERMES
English
llama
cognitive-control
decode-time-intervention
repetition-suppression
behavioral-control
contrastive-learning
interpretability
activation-engineering
cf-hot
arc
rlhf-analysis
research
conversational
Eval Results (legacy)
text-generation-inference
Scientific model card - Logan Matthew Napolitano
Browse files
README.md
CHANGED
|
@@ -1,180 +1,120 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
##
|
| 6 |
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
|---------|----------------------|----------------|
|
| 11 |
-
| Propositions | Manifold M | Embedding space |
|
| 12 |
-
| Inference | Parallel transport | Gauge-covariant attention |
|
| 13 |
-
| Consistency | Holonomy = Identity | Holonomy loss |
|
| 14 |
-
| Symbols | Lie algebra generators | Generator network |
|
| 15 |
-
| Proof equivalence | Homotopy | Layer depth |
|
| 16 |
|
| 17 |
-
##
|
| 18 |
|
| 19 |
-
|
| 20 |
-
Input tokens
|
| 21 |
-
│
|
| 22 |
-
▼
|
| 23 |
-
┌─────────────────────────────────────┐
|
| 24 |
-
│ Token Embedding (Proposition M) │
|
| 25 |
-
│ + Position Embedding │
|
| 26 |
-
│ + Fiber Initialization (gauge) │
|
| 27 |
-
└─────────────────────────────────────┘
|
| 28 |
-
│
|
| 29 |
-
▼
|
| 30 |
-
┌─────────────────────────────────────┐
|
| 31 |
-
│ LHT Layer (× n_layers) │
|
| 32 |
-
│ ┌─────────────────────────────┐ │
|
| 33 |
-
│ │ Connection Network A(x) │ │ ← Learns gauge connection
|
| 34 |
-
│ │ Parallel Transport Γ_{j→i} │ │ ← Transports fiber elements
|
| 35 |
-
│ │ Gauge-Covariant Attention │ │ ← Modified self-attention
|
| 36 |
-
│ │ Lie Algebra Generator │ │ ← Generates inference ops
|
| 37 |
-
│ │ Generator Application │ │ ← Applies exp(X) to fiber
|
| 38 |
-
│ └─────────────────────────────┘ │
|
| 39 |
-
└─────────────────────────────────────┘
|
| 40 |
-
│
|
| 41 |
-
▼
|
| 42 |
-
┌─────────────────────────────────────┐
|
| 43 |
-
│ Output: logits + geometric losses │
|
| 44 |
-
└─────────────────────────────────────┘
|
| 45 |
-
```
|
| 46 |
-
|
| 47 |
-
## Key Components
|
| 48 |
|
| 49 |
-
|
| 50 |
-
Learns the gauge connection ω that defines how to parallel transport inferential states:
|
| 51 |
-
```python
|
| 52 |
-
A_μ(x) ∈ gl(k,ℝ) # Lie algebra valued 1-form
|
| 53 |
-
```
|
| 54 |
|
| 55 |
-
|
| 56 |
-
Computes transport operators between positions:
|
| 57 |
-
```python
|
| 58 |
-
Γ_{j→i} = exp(-A_μ(x_j)(x_i - x_j)^μ)
|
| 59 |
-
```
|
| 60 |
-
|
| 61 |
-
### 3. Gauge-Covariant Attention
|
| 62 |
-
Standard attention with parallel transport of values:
|
| 63 |
-
```python
|
| 64 |
-
# Standard: Attn(Q,K,V)_i = Σ_j α_ij V_j
|
| 65 |
-
# Gauge: GaugeAttn_i = Σ_j α_ij Γ_{j→i}(V_j)
|
| 66 |
-
```
|
| 67 |
|
| 68 |
-
|
| 69 |
-
Enforces reasoning consistency by requiring closed loops to return to identity:
|
| 70 |
-
```python
|
| 71 |
-
L_hol = E[||Hol_γ - I||²_F]
|
| 72 |
-
```
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
| 79 |
|
| 80 |
-
|
| 81 |
|
|
|
|
| 82 |
```bash
|
| 83 |
-
pip install torch
|
| 84 |
```
|
| 85 |
-
|
| 86 |
-
## Usage
|
| 87 |
-
|
| 88 |
-
### Basic
|
| 89 |
```python
|
| 90 |
-
from
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
output = model(
|
| 105 |
-
input_ids=tokens,
|
| 106 |
-
labels=labels,
|
| 107 |
-
return_geometric_losses=True
|
| 108 |
)
|
| 109 |
-
|
| 110 |
-
# Get losses
|
| 111 |
-
lm_loss = output['lm_loss']
|
| 112 |
-
holonomy_loss = output['holonomy_loss']
|
| 113 |
-
curvature_loss = output['curvature_loss']
|
| 114 |
-
total_loss = model.get_total_loss(output)
|
| 115 |
```
|
| 116 |
|
| 117 |
-
|
| 118 |
-
```python
|
| 119 |
-
from lht import LHTTrainer
|
| 120 |
|
| 121 |
-
|
| 122 |
|
| 123 |
-
|
| 124 |
-
metrics = trainer.train_step(batch)
|
| 125 |
-
# Early training: high curvature loss → flat representations
|
| 126 |
-
# Mid training: high holonomy loss → consistency
|
| 127 |
-
# Late training: high waypoint loss → discrete structure
|
| 128 |
```
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
```
|
| 137 |
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
|
| 143 |
-
|
| 144 |
-
| `
|
| 145 |
-
| `
|
| 146 |
-
| `
|
| 147 |
-
| `
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
```
|
| 164 |
-
lie_holonomy_transformer/
|
| 165 |
-
├── lht.py # Core implementation
|
| 166 |
-
├── train.py # Training script
|
| 167 |
-
├── README.md # This file
|
| 168 |
-
└── experiments/ # Benchmark code (TODO)
|
| 169 |
```
|
| 170 |
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
- "Beyond Holonomy: Lie-Algebraic Symbol Emergence..." (the paper)
|
| 174 |
-
- Cohen et al. (2019). Gauge Equivariant Convolutional Networks
|
| 175 |
-
- Weiler & Cesa (2019). General E(2)-Equivariant Steerable CNNs
|
| 176 |
-
- The Univalent Foundations Program (2013). Homotopy Type Theory
|
| 177 |
-
|
| 178 |
-
## License
|
| 179 |
|
| 180 |
-
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
library_name: transformers
|
| 6 |
+
tags:
|
| 7 |
+
- llama
|
| 8 |
+
- hermes
|
| 9 |
+
- cognitive-control
|
| 10 |
+
- decode-time-intervention
|
| 11 |
+
- repetition-suppression
|
| 12 |
+
- behavioral-control
|
| 13 |
+
- contrastive-learning
|
| 14 |
+
- interpretability
|
| 15 |
+
- activation-engineering
|
| 16 |
+
pipeline_tag: text-generation
|
| 17 |
+
base_model: NousResearch/Hermes-3-Llama-3.1-8B
|
| 18 |
+
---
|
| 19 |
|
| 20 |
+
# ARC-8B: Adaptive Repetition Controller
|
| 21 |
|
| 22 |
+
## Decode-Time Behavioral Intervention via Contrastive Fiber Heads-on-Thought
|
| 23 |
|
| 24 |
+
**Author:** Logan Matthew Napolitano
|
| 25 |
+
**Institution:** Logan Research
|
| 26 |
+
**Date:** January 2026
|
| 27 |
+
**License:** Creative Commons Attribution 4.0 International (CC-BY-4.0)
|
| 28 |
|
| 29 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
## Abstract
|
| 32 |
|
| 33 |
+
We present **ARC (Adaptive Repetition Controller)**, a novel decode-time intervention system that addresses behavioral degradation in RLHF-aligned language models. Our approach leverages lightweight prediction heads (~5,300 parameters each) trained on compressed hidden state representations ("fiber projections") to detect and suppress undesirable generation patterns including repetition loops, hedging phrases, verbosity, and sycophantic responses.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
Our primary contribution is demonstrating that behavioral failure modes are linearly separable in a low-dimensional projection of transformer hidden states, enabling real-time intervention with minimal computational overhead (<1% latency increase). The repetition detection head achieves a **125x class separation ratio**, indicating that the failure mode is highly predictable from internal model representations before manifesting in output tokens.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
## Key Results
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
| Head | Separation | Status |
|
| 42 |
+
|------|------------|--------|
|
| 43 |
+
| **Repetition** | **125x** | Production Ready |
|
| 44 |
+
| **Verbosity** | **2.1x** | Usable |
|
| 45 |
+
| **Hedging** | **1.5x** | Contributing |
|
| 46 |
+
| **Sycophancy** | experimental | Research |
|
| 47 |
|
| 48 |
+
---
|
| 49 |
|
| 50 |
+
## Quick Start
|
| 51 |
```bash
|
| 52 |
+
pip install torch transformers accelerate bitsandbytes
|
| 53 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
```python
|
| 55 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
|
| 56 |
+
import torch
|
| 57 |
+
|
| 58 |
+
model_id = "LoganResearch/ARC-Base-8B"
|
| 59 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 60 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 61 |
+
model_id,
|
| 62 |
+
quantization_config=BitsAndBytesConfig(
|
| 63 |
+
load_in_4bit=True,
|
| 64 |
+
bnb_4bit_compute_dtype=torch.float16,
|
| 65 |
+
bnb_4bit_use_double_quant=True,
|
| 66 |
+
bnb_4bit_quant_type="nf4"
|
| 67 |
+
),
|
| 68 |
+
device_map="auto"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
```
|
| 71 |
|
| 72 |
+
For full ARC behavioral control, download and run `inference.py`.
|
|
|
|
|
|
|
| 73 |
|
| 74 |
+
---
|
| 75 |
|
| 76 |
+
## Architecture
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
```
|
| 78 |
+
BASE MODEL (Hermes-3-Llama-3.1-8B)
|
| 79 |
+
|
|
| 80 |
+
Hidden States [32 layers x 4096 dims]
|
| 81 |
+
|
|
| 82 |
+
FIBER PROJECTIONS [32 x 16 features]
|
| 83 |
+
|
|
| 84 |
+
+------------+------------+------------+
|
| 85 |
+
| Repetition | Hedging | Verbosity |
|
| 86 |
+
| 125x | 1.5x | 2.1x |
|
| 87 |
+
+------------+------------+------------+
|
| 88 |
+
|
|
| 89 |
+
Risk Scores -> Intervention -> Modified Logits
|
| 90 |
```
|
| 91 |
|
| 92 |
+
---
|
| 93 |
+
|
| 94 |
+
## Repository Contents
|
| 95 |
+
|
| 96 |
+
| File | Description |
|
| 97 |
+
|------|-------------|
|
| 98 |
+
| `model-*.safetensors` | Base model weights (~16GB) |
|
| 99 |
+
| `risk_predictor.pt` | Fiber projections + Repetition head (8.4MB) |
|
| 100 |
+
| `hedging_head.pt` | Hedging detection (24KB) |
|
| 101 |
+
| `verbosity_head.pt` | Verbosity detection (24KB) |
|
| 102 |
+
| `sycophancy_head.pt` | Sycophancy detection (24KB) |
|
| 103 |
+
| `inference.py` | Complete inference with ARC |
|
| 104 |
+
|
| 105 |
+
---
|
| 106 |
+
|
| 107 |
+
## Citation
|
| 108 |
+
```bibtex
|
| 109 |
+
@software{napolitano2026arc,
|
| 110 |
+
author = {Napolitano, Logan Matthew},
|
| 111 |
+
title = {ARC: Adaptive Repetition Controller},
|
| 112 |
+
year = {2026},
|
| 113 |
+
publisher = {Hugging Face},
|
| 114 |
+
url = {https://huggingface.co/LoganResearch/ARC-Base-8B}
|
| 115 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
```
|
| 117 |
|
| 118 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
**Author:** Logan Matthew Napolitano | **License:** CC-BY-4.0
|