ForeSight: Enhancing Risk Monitoring via Early Safety Signal Distillation
Organizations: University of California, San Diego · Xi’an Jiaotong-Liverpool University · East China Normal University · Shanghai University ·
Abstract
As large language models (LLMs) are increasingly deployed, the generation of harmful content has become a critical safety concern. Existing safeguards operate at the input, output, or streaming-generation stages, while early-risk methods that rely on surface tokens or output logits may suffer from weak initial signals, and internals-based detectors using dense representations may retain highly entangled and redundant safety-irrelevant information. It therefore remains unclear whether the earliest post-generation hidden states already contain reliable signals about final-response harmfulness. To address this gap, we propose ForeSight, a first-token output-risk forecasting framework that distills weak and redundant early safety signals into compact, layer-aware risk representations. Experiments on five safety benchmarks and two target models demonstrate that ForeSight achieves superior and efficient early-risk forecasting while relying solely on first-token hidden states. The code is available at: https://github.com/Scabbards1500/Foresight
Figures & tables
| Method | HarmEval | S-Eval | CatQA | ToxicChat | WildJailbreak | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| F1 | ACC | F1 | ACC | F1 | ACC | F1 | ACC | F1 | ACC | |
| Llama-3.1-8B | ||||||||||
| LLAMA-3.3-70B-Instruct | 69.26 | 75.58 | 49.49 | 66.04 | 52.69 | 56.10 | 60.43 | 84.59 | 62.03 | 76.45 |
| Mistral-Small-24B-Instruct | 70.03 | 75.58 | 46.46 | 64.78 | 54.90 | 57.32 | 74.10 | 87.81 | 59.43 | 72.55 |
| Qwen3.5-27B | 54.39 | 67.44 | 40.43 | 63.52 | 49.10 | 52.44 | 53.82 | 82.08 | 62.90 | 72.55 |
| Llama-Guard-3-8B | 54.39 | 67.44 | 58.22 | 70.44 | 46.66 | 52.44 | 60.08 | 84.23 | 44.84 | 71.57 |
| Method | Source dataset used for training | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| HarmEval | S-Eval | CatQA | ToxicChat | WildJailbreak | ||||||
| L | Q | L | Q | L | Q | L | Q | L | Q | |
| MULI | 46.34 | 49.03 | 44.15 | 51.29 | 46.58 | 24.44 | 51.65 | 22.56 | 41.16 | 47.83 |
| Latent Guard | 39.59 | 46.57 | 49.80 | 54.22 | 25.14 | 47.94 | 39.97 | 50.98 | 38.89 | 47.83 |
| TPC | 40.33 | 21.36 | 40.57 | 31.04 | 40.17 | 21.87 | 32.83 | 13.53 | 23.69 | 24.61 |
| ForeSight | 59.25 | 61.69 | 58.56 | 72.15 | 49.36 | 58.74 | 52.70 | 64.47 | 41.85 | 59.56 |
| Method | HarmEval S-Eval | HarmEval CatQA | HarmEval ToxicChat | HarmEval WildJailbreak | ||||
|---|---|---|---|---|---|---|---|---|
| ACC | F1 | ACC | F1 | ACC | F1 | ACC | F1 | |
| Full hidden states | 57.44 | 59.75 | 56.22 | 57.32 | 52.26 | 63.44 | 51.63 | 63.73 |
| + Saliency selection | 57.70 | 59.75 | 57.63 | 58.54 | 51.82 | 63.44 | 49.67 | 52.94 |
| + Cluster | 63.90 | 66.67 | 60.12 | 60.98 | 58.32 | 69.89 | 52.19 | 58.82 |
| Method | Acc | F1 | Dim | Time (ms) |
|---|---|---|---|---|
| Full hidden states | 73.50 | 74.42 | 92160 | 0.0864 |
| Saliency selection | 75.68 | 76.74 | 39284 | 0.0240 |
| Saliency + kmeans | 78.50 | 79.07 | 648 | 0.0076 |
| Intervention | Harmful Score | Harmful Rate |
|---|---|---|
| Original | 0.4264 | 79.31 |
| Risk-reducing ( ) | 0.3382 | 70.00 |
| Reverse ( ) | 0.6498 | 81.48 |
| Random ( ) | 0.4013 | 74.41 |
Appendix figures & tables16 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | 0 | 1 | 2 | 3 | Total |
|---|---|---|---|---|---|
| HarmEval | |||||
| Llama3.1-8B | 269 | 62 | 60 | 159 | 550 |
| Qwen3-8B | 458 | 46 | 37 | 9 | 550 |
| S-Eval | |||||
| Llama3.1-8B | 553 | 123 | 85 | 239 | 1000 |
| Qwen3-8B | 830 | 64 | 54 | 52 | 1000 |
| Method | Observed Signal | Re-trained |
|---|---|---|
| LLM Judges / Guardrails | Prompt + Output prefix | No |
| RoBERTa | Output prefix | Yes |
| MULI | Early-token logits | Yes |
| Latent Guard | Early hidden states | Yes |
| TPC | Early activations | Yes |
| ForeSight | First-token hidden states | Yes |
| Item | Setting |
|---|---|
| Observation window | First generated token |
| Neuron saliency threshold | 0.35 |
| L1 regularization search range | |
| K-means cluster search range | |
| Selection criterion | Validation performance |
| Training batch size | 32 |
| Dataset | Val-selected | Fixed preset | |
|---|---|---|---|
| WildJailbreak | 72.48 | 71.92 | -0.56 |
| HarmEval | 83.06 | 82.10 | -0.96 |
| S-Eval | 72.02 | 70.93 | -1.09 |
| CatQA | 74.50 | 74.50 | -0.00 |
| ToxicChat | 81.49 | 79.24 | -2.25 |
| Mean | 76.71 | 75.74 | -0.97 |
| Method | Mean F1 | Mean ACC |
|---|---|---|
| Last-layer-only probe | 60.90 | 71.50 |
| Best single-layer probe | 59.90 | 70.94 |
| ForeSight | 73.13 | 76.94 |
| Method | Mean Acc | Mean F1 | Dim. |
|---|---|---|---|
| Full hidden states | 88.89 | 80.00 | 131072 |
| Saliency selection | 91.36 | 86.68 | 49799 |
| Saliency + k-means | 92.59 | 88.32 | 640 |
| Method | 25% | 50% | 75% | 100% |
|---|---|---|---|---|
| RoBERTa | 49.84 | 49.84 | 49.84 | 49.84 |
| MULI | 43.71 | 43.00 | 44.29 | 45.89 |
| Latent Guard | 62.81 | 65.42 | 66.60 | 68.82 |
| TPC | 31.27 | 31.27 | 44.00 | 46.11 |
| ForeSight | 63.37 | 68.55 | 70.02 | 72.14 |
| Failure Type | Representative Pattern | Interpretation |
|---|---|---|
| Input-dominant FP | A safety-sensitive prompt is followed by a safe, evasive, or non-substantive response. | Early hidden states may over-emphasize input-level risk rather than the harmfulness of the final response. |
| Ambiguity-masked FN | The response contains harmful content, but it is preceded or followed by disclaimers, warnings, or hedging expressions. | Surface-level safety language may obscure the harmfulness of the substantive content, making the early signal less decisive. |
| Jailbreak-induced FN | The user prompt uses jailbreak-style framing, such as role-play, hypothetical scenarios, multi-turn persuasion, or task reframing, to elicit harmful content. | Jailbreak framing can make the generation context appear less directly harmful, weakening the early separation between harmful and non-harmful outputs. |
| Other output-harmful FN | The response is labeled harmful, but its surface form is ambiguous or does not match common instruction-like harmful patterns. | Some harmful outputs may not align well with the safety features learned from more direct harmful cases. |
| Dataset | Spearman | Kendall | |
|---|---|---|---|
| HarmEval | 0.376 | 2.1e-08 | 0.287 |
| S-Eval | 0.384 | 2.3e-14 | 0.294 |
| CatQA | 0.231 | 0.050 | 0.100 |
| ToxicChat | 0.435 | 5.1e-113 | 0.346 |
| WildJailbreak | 0.287 | 3.3e-04 | 0.172 |