Beyond Fixed-Context Likelihood: Zero-Shot AI-Generated Text Detection via Context Perturbation Discrepancy
Organizations: School of Cyberspace Security, Beijing University of Posts and Telecommunications, Beijing, China · Beijing Academy of Artificial Intelligence, Beijing, China · School of Cyberspace Security, Shanghai Jiao Tong University, Shanghai, China
Abstract
The same increase in token log probability from earlier context can be typical at one position and unusually large at another. We introduce Context Perturbation Discrepancy (CPD), a zero-shot detector that measures this gain relative to what a single pretrained language model expects. Keeping the passage fixed, CPD scores each observed token under its full prefix and under a short window of recent tokens. Under the full-prefix distribution, the expected gain equals the KL divergence from that distribution to the restricted-prefix distribution. CPD subtracts this expectation from each observed gain and scales the sum of the signed deviations by its analytical reference standard deviation. On unedited human and AI texts from GEN, DetectRL-X, and HART, subtracting the expected gain raises AUROC by 32.78-35.81 percentage points at the same variance scale. CPD outperforms seven zero-shot baselines, averaging 94.80% AUROC and 79.60% recall at a 5% false-positive rate. On original and edited HART passages, the same scores separate texts more clearly by draft origin than by the benchmark's final-expression labels (89.15% versus 65.50% AUROC). Code is available at https://github.com/BUPT-tyf/CPD.
Figures & tables
| Method | GEN | DetectRL-X | HART | Macro Avg. | ||||
|---|---|---|---|---|---|---|---|---|
| AUROC | TPR@5% | AUROC | TPR@5% | AUROC | TPR@5% | AUROC | TPR@5% | |
| Zero-Shot Detectors | ||||||||
| Loglikelihood ( Gehrmann et al., 2019 ) | 43.04 | 8.65 | 55.52 | 8.72 | 75.77 | 15.20 | 58.11 | 10.86 |
| LRR ( Su et al., 2023 ) | 47.94 | 13.65 | 53.33 | 10.57 | 81.25 | 49.00 | 60.84 | 24.41 |
| TempTest ( Kempton et al., 2025 ) | 43.91 | 19.90 | 72.74 | 21.80 | 87.69 | 74.85 | 68.12 | 38.85 |
| NTS ( Ma et al., 2026 ) | 67.75 | 33.55 | 72.73 | 19.92 | 93.30 | 82.15 | 77.92 | 45.21 |
| Method | Draft-Origin Detection | Expression Diagnostic | |||
|---|---|---|---|---|---|
| H/HA vs. A/AH | HA vs. A | H vs. AH | HA vs. AH | H/AH vs. A/HA | |
| LogLikelihood | 52.12 / 11.48 | 73.44 / 26.50 | 34.58 / 0.55 | 24.67 / 1.00 | 74.19 / 20.13 |
| LRR | 56.51 / 25.56 | 80.35 / 48.00 | 33.59 / 3.00 | 30.81 / 2.85 | 72.68 / 29.58 |
| TempTest | 64.47 / 40.19 | 82.84 / 65.25 | 50.19 / 17.36 | 37.13 / 8.40 | 76.25 / 34.88 |
| NTS | 79.74 / 50.54 | 87.42 / 66.45 | 76.96 / 41.72 | 61.26 / 19.61 | 70.12 / 23.93 |
| Binoculars | 70.62 / 43.81 | 84.32 / 60.65 | 62.25 / 39.02 | 44.79 / 9.05 | 76.84 / 33.73 |
| Method | GEN | DetectRL-X | HART |
|---|---|---|---|
| CPD | 94.18 / 80.25 | 91.90 / 65.60 | 98.31 / 92.95 |
| w/o Exp. | 58.37 / 16.25 | 58.81 / 7.58 | 65.53 / 7.45 |
| w/o Var. | 94.16 / 80.25 | 91.85 / 64.55 | 98.22 / 92.85 |
| w/o Both | 57.97 / 16.25 | 57.86 / 8.83 | 64.67 / 10.05 |
| Dataset | Component | AUROC | |||
|---|---|---|---|---|---|
| GEN | 42.10 | 0.207 | 0.270 | ||
| 92.84 | 0.212 | 2.088 | |||
| 95.24 | 0.168 | 2.312 | |||
| 92.11 | 0.198 | 2.188 | |||
| 93.04 | 0.187 | 2.020 | |||
| 92.91 | 0.210 | 2.186 |
Appendix figures & tables21 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset / condition | Split | H | Other | Other categories |
|---|---|---|---|---|
| GEN direct detection | Dev / Test (each) | 2,000 | 2,000 | A |
| GEN editing | Test | 936 | 3,744 | 936 A + 2,808 HA (three edit ranges) |
| DetectRL-X general | English dev | 6,000 | 6,000 | A |
| DetectRL-X general | Test (each language) | 6,000 | 6,000 | A |
| DetectRL-X rewriting | Test (each operation) | 6,000 | 6,000 | AA |
| DetectRL-X rewriting | Test (pooled) | 6,000 | 18,000 | Condensing, expanding, and polishing variants |
| Statistic | GEN | DetectRL-X | HART |
|---|---|---|---|
| 68.36 / 13.45 | 71.04 / 3.38 | 83.62 / 19.45 | |
| 49.36 / 4.90 | 53.31 / 0.85 | 63.92 / 1.35 | |
| 76.89 / 29.90 | 64.66 / 4.37 | 67.97 / 24.35 |
| Method | HA vs. A | H vs. AH | HA vs. AH |
|---|---|---|---|
| CPD | 90.82 / 65.90 | 90.79 / 73.70 | 76.66 / 45.30 |
| w/o Exp. | 60.50 / 7.65 | 56.92 / 2.90 | 51.18 / 3.10 |
| w/o Var. | 90.08 / 62.90 | 90.90 / 74.50 | 76.87 / 44.60 |
| w/o Both | 59.32 / 7.20 | 58.73 / 6.45 | 53.35 / 4.60 |
| Task | Component | AUROC | |||
|---|---|---|---|---|---|
| HA vs. A | 81.93 | 0.224 | 0.965 | ||
| 58.41 | 0.256 | 0.429 | |||
| 91.05 | 0.169 | 1.927 | |||
| H vs. AH | 55.41 | 0.226 | 0.031 | ||
| 82.76 | 0.271 | 1.313 | |||
| 90.90 | 0.185 | 1.966 |
| Score | GEN | DetectRL-X | HART |
|---|---|---|---|
| Mean | 3.85 / 83.75 | 11.87 / 79.52 | 5.85 / 94.25 |
| Sqrt | 3.70 / 77.95 | 6.53 / 69.15 | 3.25 / 90.40 |
| CPD | 3.75 / 77.70 | 6.95 / 70.35 | 3.50 / 91.65 |
| Score | Threshold | Dev FPR | Dev TPR |
|---|---|---|---|
| Mean | 0.19754306 | 5.00 | 84.60 |
| Sqrt | 4.37745190 | 5.00 | 78.80 |
| CPD | 2.05796176 | 4.95 | 78.85 |
| Method | Dev. | Test. | ||
|---|---|---|---|---|
| GEN | GEN | DetectRL-X | HART | |
| Mean | 67.37 / 12.90 | 68.61 / 13.50 | 70.28 / 3.23 | 83.97 / 19.20 |
| CPD k=1 | 93.84 / 79.00 | 94.34 / 80.55 | 91.41 / 63.78 | 98.25 / 93.15 |
| Mean | 60.41 / 8.65 | 62.05 / 9.00 | 60.41 / 1.15 | 78.76 / 8.60 |
| CPD k=2 | 91.88 / 74.00 | 92.45 / 76.05 | 90.42 / 60.75 | 97.58 / 90.20 |
| Mean | 55.17 / 5.75 | 57.49 / 6.60 | 53.40 / 1.13 | 72.41 / 11.85 |
| Method | GEN | DetectRL-X | HART | |||
|---|---|---|---|---|---|---|
| AUROC | TPR@5% | AUROC | TPR@5% | AUROC | TPR@5% | |
| Loglikelihood | 43.04 [41.24, 44.87] | 8.65 [6.75, 11.30] | 55.52 [54.54, 56.54] | 8.72 [7.47, 9.80] | 75.77 [74.34, 77.34] | 15.20 [8.30, 24.30] |
| LRR | 47.94 [46.09, 49.77] | 13.65 [11.85, 15.95] | 53.33 [52.40, 54.35] | 10.57 [9.60, 11.58] | 81.25 [79.91, 82.61] | 49.00 [44.05, 52.95] |
| TempTest | 43.91 [42.09, 45.81] | 19.90 [18.35, 22.10] | 72.74 [71.88, 73.63] | 21.80 [20.32, 23.42] | 87.69 [86.55, 88.95] | 74.85 [71.95, 77.60] |
| NTS | 67.75 [66.16, 69.37] | 33.55 [31.00, 36.35] | 72.73 [71.85, 73.61] | 19.92 [18.48, 21.75] | 93.30 [92.52, 94.13] | 82.15 [80.25, 84.40] |
| Single-Fast | 42.79 [40.96, 44.68] | 21.30 [19.00, 23.10] | 72.72 [71.85, 73.64] | 25.30 [23.65, 27.12] | 87.71 [86.54, 88.99] | 76.60 [74.55, 78.90] |
| Method | Threshold | GEN | DetectRL-X | HART |
|---|---|---|---|---|
| FPR / TPR / BA | FPR / TPR / BA | FPR / TPR / BA | ||
| Log-Likelihood | 5.40 / 9.85 / 52.23 | 3.87 / 6.88 / 51.51 | 6.00 / 23.25 / 58.63 | |
| LRR | 4.45 / 13.10 / 54.33 | 5.68 / 11.25 / 52.78 | 2.80 / 39.10 / 68.15 | |
| TempTest | 5.05 / 19.95 / 57.45 | 23.25 / 53.83 / 65.29 | 9.85 / 79.55 / 84.85 | |
| NTS | 4.25 / 32.20 / 63.98 | 24.17 / 57.18 / 66.51 | 7.50 / 84.45 / 88.48 | |
| Binoculars | 3.75 / 22.80 / 59.53 | 30.20 / 57.10 / 63.45 | 6.55 / 86.40 / 89.93 |
| Method | GEN | DetectRL-X | HART | Macro Avg. | ||||
|---|---|---|---|---|---|---|---|---|
| AUROC | TPR@5% | AUROC | TPR@5% | AUROC | TPR@5% | AUROC | TPR@5% | |
| Single-Fast | 42.79 | 21.30 | 72.72 | 25.30 | 87.71 | 76.60 | 67.74 | 41.07 |
| Fast † | 47.05 | 26.50 | 69.38 | 15.72 | 90.78 | 84.30 | 69.07 | 42.17 |
| Fast+TCD † | 50.51 | 26.90 | 68.92 | 20.02 | 93.11 | 85.45 | 70.85 | 44.12 |
| Fast+TOCSIN † | 47.77 | 20.40 | 68.35 | 18.02 | 89.68 | 80.30 | 68.60 | 39.57 |
| CPD | 94.18 | 80.25 | 91.90 | 65.60 | 98.31 | 92.95 | 94.80 | 79.60 |
| Method | Essays (441 / 481) | arXiv (353 / 415) | Creative Writing (378 / 369) | News (414 / 443) | Domain Macro Avg. |
|---|---|---|---|---|---|
| Log-Likelihood | 64.87 / 34.72 | 50.54 / 20.72 | 59.14 / 30.62 | 44.53 / 3.16 | 54.77 / 22.31 |
| LRR | 57.53 / 32.02 | 59.98 / 30.84 | 58.90 / 29.81 | 56.23 / 23.93 | 58.16 / 29.15 |
| TempTest | 71.50 / 38.05 | 63.35 / 44.10 | 64.19 / 47.70 | 61.72 / 38.83 | 65.19 / 42.17 |
| NTS | 78.72 / 39.50 | 78.38 / 52.29 | 80.73 / 56.37 | 78.18 / 50.34 | 79.00 / 49.62 |
| Binoculars † | 75.77 / 41.37 | 69.25 / 49.64 | 70.26 / 55.56 | 69.30 / 47.18 | 71.14 / 48.44 |
| Fast-DetectGPT † | 75.46 / 39.29 | 69.33 / 51.08 | 70.28 / 55.28 | 69.14 / 50.79 | 71.05 / 49.11 |
| Method | Model (578 / 614) | Tool (155 / 145) | Human (91 / 101) | Type Macro Avg. |
|---|---|---|---|---|
| Log-Likelihood | 35.23 / 0.98 | 25.11 / 1.38 | 57.37 / 0.99 | 39.24 / 1.12 |
| LRR | 30.19 / 1.79 | 29.37 / 2.76 | 53.23 / 9.90 | 37.60 / 4.82 |
| TempTest | 49.97 / 15.80 | 35.41 / 8.97 | 81.41 / 53.47 | 55.60 / 26.08 |
| NTS | 76.50 / 43.16 | 66.35 / 24.83 | 86.60 / 60.40 | 76.48 / 42.79 |
| Binoculars † | 60.97 / 38.44 | 49.37 / 17.24 | 92.32 / 78.22 | 67.55 / 44.63 |
| Fast-DetectGPT † | 60.96 / 39.41 | 49.73 / 21.38 | 92.02 / 80.20 | 67.57 / 47.00 |
| Method | Original (0%) | 20–40% | 40–60% | 60–80% | ||||
|---|---|---|---|---|---|---|---|---|
| AUROC | TPR@5% | AUROC | TPR@5% | AUROC | TPR@5% | AUROC | TPR@5% | |
| LogLikelihood | 47.09 | 10.04 | 43.04 | 8.97 | 38.76 | 6.41 | 34.66 | 4.27 |
| LRR | 51.61 | 17.84 | 52.78 | 17.84 | 50.58 | 13.68 | 47.72 | 8.97 |
| TempTest | 44.76 | 19.34 | 35.86 | 13.35 | 30.34 | 7.48 | 24.63 | 3.63 |
| NTS | 66.67 | 33.23 | 55.44 | 21.90 | 46.24 | 13.35 | 37.53 | 6.84 |
| Binoculars | 45.94 | 23.29 | 33.20 | 14.74 | 27.52 | 7.91 | 22.03 | 3.10 |
| Method | Original | Condensing | Expanding | Polishing | Overall | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| AUROC | TPR@5% | AUROC | TPR@5% | AUROC | TPR@5% | AUROC | TPR@5% | AUROC | TPR@5% | |
| LogLikelihood | 55.52 | 8.72 | 36.39 | 0.85 | 65.15 | 2.57 | 31.54 | 0.62 | 44.25 | 1.30 |
| LRR | 53.33 | 10.57 | 32.61 | 0.68 | 62.74 | 1.80 | 25.26 | 0.73 | 40.06 | 1.08 |
| TempTest | 72.74 | 21.80 | 45.75 | 1.55 | 86.23 | 23.70 | 40.24 | 2.15 | 57.34 | 9.03 |
| NTS | 72.73 | 19.92 | 48.57 | 1.30 | 84.98 | 16.13 | 44.67 | 2.03 | 59.28 | 6.47 |
| Binoculars | 68.42 | 9.22 | 45.49 | 0.02 | 77.59 | 0.27 | 39.57 | 0.42 | 54.08 | 0.23 |
| Method | 64 tokens | 128 tokens | 256 tokens |
|---|---|---|---|
| Loglikelihood | 61.43 / 4.75 | 63.62 / 6.17 | 63.88 / 9.64 |
| LRR | 58.76 / 8.42 | 64.10 / 14.73 | 66.93 / 22.37 |
| TempTest | 68.01 / 22.48 | 73.47 / 34.48 | 73.53 / 42.92 |
| NTS | 64.05 / 20.36 | 73.97 / 36.11 | 77.86 / 46.46 |
| Binoculars | 70.11 / 30.65 | 74.87 / 44.87 | 73.19 / 44.96 |
| Fast-DetectGPT | 70.05 / 30.64 | 74.93 / 45.10 | 73.40 / 44.53 |
| Length | Method | GEN | DetectRL-X | HART | Macro Avg. |
|---|---|---|---|---|---|
| 64 | LogLikelihood | 57.34 / 7.36 | 61.55 / 5.80 | 65.41 / 1.08 | 61.43 / 4.75 |
| LRR | 58.67 / 9.23 | 54.87 / 5.68 | 62.74 / 10.34 | 58.76 / 8.42 | |
| TempTest | 57.91 / 15.22 | 64.33 / 14.90 | 81.78 / 37.31 | 68.01 / 22.48 | |
| NTS | 58.94 / 15.85 | 56.13 / 10.78 | 77.09 / 34.45 | 64.05 / 20.36 | |
| Binoculars | 61.22 / 25.76 | 60.87 / 12.81 | 88.25 / 53.36 | 70.11 / 30.65 | |
| Fast-DetectGPT | 61.00 / 24.95 | 60.82 / 12.34 | 88.33 / 54.63 | 70.05 / 30.64 |
| Method | Arabic | Chinese | English | French | German | Portuguese | Russian | Spanish | Macro Avg. |
|---|---|---|---|---|---|---|---|---|---|
| LogLikelihood | 52.80 | 74.48 | 55.52 | 74.47 | 79.90 | 78.65 | 64.03 | 79.93 | 69.97 |
| LRR | 49.22 | 67.47 | 53.33 | 65.90 | 65.42 | 65.90 | 56.55 | 64.45 | 61.03 |
| TempTest | 63.05 | 84.11 | 72.74 | 90.39 | 85.16 | 88.03 | 71.09 | 85.24 | 79.98 |
| NTS | 56.61 | 80.41 | 72.73 | 87.86 | 79.99 | 84.94 | 66.60 | 82.12 | 76.41 |
| Binoculars | 35.85 | 61.43 | 68.42 | 84.46 | 68.65 | 73.73 | 44.65 | 74.63 | 63.98 |
| Fast-DetectGPT | 39.67 | 61.73 | 69.39 | 83.97 | 68.19 | 73.48 | 46.71 | 74.33 | 64.68 |
| Method | Backbone Models | ||||
|---|---|---|---|---|---|
| Falcon-7B | Falcon-7B-Instruct | GPT-Neo-2.7B | Llama-2-7B | Llama-3.1-8B | |
| Loglikelihood | 43.04 / 8.65 | 43.04 / 11.50 | 37.35 / 3.60 | 53.17 / 9.85 | 53.94 / 10.40 |
| LRR | 47.94 / 13.65 | 50.41 / 15.25 | 40.08 / 6.80 | 51.68 / 14.45 | 61.38 / 25.55 |
| TempTest | 43.91 / 19.90 | 27.30 / 8.20 | 29.34 / 12.95 | 51.45 / 17.65 | 54.08 / 18.70 |
| NTS | 67.75 / 33.55 | 57.88 / 31.30 | 76.48 / 49.35 | 71.13 / 33.75 | 66.84 / 27.75 |
| Single-Fast | 42.79 / 21.30 | 21.33 / 8.15 | 26.34 / 13.65 | 42.42 / 15.90 | 46.49 / 18.55 |
| Gemma 3 | Qwen2.5 | GPT-OSS | Llama | |||||
| Detector | 12B | 27B | 7B | 72B | 20B | 120B | 3.1-8B | 3.3-70B |
| AUROC (%) | ||||||||
| Loglikelihood | 38.02 | 41.32 | 29.96 | 64.16 | 2.84 | 78.34 | 33.95 | 53.24 |
| LRR | 41.93 | 43.31 | 48.32 | 67.43 | 3.00 | 78.48 | 44.56 | 54.03 |
| TempTest | 32.52 | 37.79 | 28.54 | 65.44 | 6.22 | 89.63 | 35.15 | 51.88 |
| NTS | 50.00 | 53.15 | 64.78 | 74.01 | 85.36 | 89.80 | 53.23 | 71.31 |
AI-Generated Text Detection
AI-generated text detection develops methods to distinguish human-written, machine-generated, and AI-edited text.
See all 188 papers