Token-Level Likelihood-Array Regression for Membership Inference and AI-Generated Text Detection
Organizations: Department of Statistics and Data Science, School of Economics, Xiamen University · Faculty of Business and Economics, University of Hong Kong
Abstract
Membership inference asks whether a text was used to train a language model, whereas AI-generated text detection asks whether it was generated by a language model rather than written by a human. Existing likelihood-based methods typically compress token-level probabilities into a few prespecified scores, most often using only probabilities conditioned on the full preceding context. We propose likelihood-array regression (LAR), which evaluates each target token under nested left-context windows and organizes the resulting likelihood-derived features into a structured array. After aligning arrays across texts of different lengths, LAR learns how detection information varies with context scale, token position, and likelihood features. LAR-1 aggregates learned contributions from individual aligned cells, while LAR-2 adds second-order features formed from pairs of evaluations of the same target token across context lengths. For within-path quadratic model, we establish matching minimax lower and upper bounds, characterize errors from finite-dimensional approximation and random squared projections, and derive conditions under which an oracle spectral sieve attains the minimax rate. Across multiple scoring language models, LAR substantially improves membership inference and AI-generated text detection over likelihood-based baselines. The analyses further show that shorter-context likelihoods contain information beyond conventional full-context probabilities, while second-order features provide additional gains for membership inference.
Figures & tables
| Method | Pythia-1B | Pythia-6.9B | Pythia-12B | LLaMA-2-7B | Falcon-7B |
|---|---|---|---|---|---|
| Direct likelihood scores | |||||
| Loss | 0.588 (0.022) | 0.634 (0.024) | 0.647 (0.025) | 0.531 (0.028) | 0.578 (0.030) |
| Zlib | 0.616 (0.019) | 0.659 (0.019) | 0.669 (0.022) | 0.546 (0.026) | 0.595 (0.026) |
| Min-K% | 0.596 (0.017) | 0.667 (0.022) | 0.688 (0.029) | 0.528 (0.028) | 0.579 (0.029) |
| Min-K%++ | 0.625 (0.021) | 0.707 (0.021) | 0.725 (0.029) | 0.614 (0.031) | 0.780 (0.021) |
| Calibration- and perturbation-assisted scores | |||||
| Method | DeepSeek-7B | OLMo-7B | Qwen3-4B | Qwen3-8B | Qwen3-14B |
|---|---|---|---|---|---|
| Scoring-model detection scores | |||||
| Likelihood | 0.777 (0.020) | 0.644 (0.022) | 0.809 (0.020) | 0.821 (0.019) | 0.824 (0.020) |
| Entropy | 0.664 (0.016) | 0.531 (0.022) | 0.667 (0.016) | 0.689 (0.018) | 0.685 (0.019) |
| Rank | 0.627 (0.015) | 0.607 (0.009) | 0.628 (0.012) | 0.628 (0.014) | 0.613 (0.010) |
| Log-rank | 0.752 (0.020) | 0.644 (0.022) | 0.793 (0.019) | 0.801 (0.018) | 0.802 (0.019) |
| LRR | 0.608 (0.016) | 0.617 (0.018) | 0.626 (0.015) | 0.657 (0.016) | 0.651 (0.016) |
| Task | Scoring model | pAUC 0.10 | TPR 0.01 | TPR 0.05 | TPR 0.10 |
|---|---|---|---|---|---|
| WikiMIA | Pythia-1B | 0.703 | 0.447 | 0.749 | 0.862 |
| Pythia-6.9B | 0.751 | 0.533 | 0.805 | 0.900 | |
| Pythia-12B | 0.733 | 0.426 | 0.789 | 0.887 | |
| LLaMA-2-7B | 0.837 | 0.611 | 0.898 | 0.937 | |
| Falcon-7B | 0.869 | 0.674 | 0.931 | 0.984 | |
| AI detection | DeepSeek-7B | 0.934 | 0.833 | 0.953 | 0.977 |
| Method | Pythia-1B | Pythia-6.9B | Pythia-12B | LLaMA-2-7B | Falcon-7B |
|---|---|---|---|---|---|
| Supervised full-context summaries | 0.653 | 0.702 | 0.734 | 0.612 | 0.719 |
| Full-context LAR-1 | 0.802 | 0.825 | 0.838 | 0.844 | 0.883 |
| Complete-array LAR-1 | 0.908 | 0.923 | 0.931 | 0.948 | 0.963 |
| Full-context LAR-2 | 0.893 | 0.908 | 0.916 | 0.934 | 0.942 |
| Complete-array LAR-2 | 0.952 | 0.960 | 0.961 | 0.976 | 0.984 |
| Method | DeepSeek-7B | OLMo-7B | Qwen3-4B | Qwen3-8B | Qwen3-14B |
|---|---|---|---|---|---|
| Supervised full-context summaries | 0.792 | 0.818 | 0.869 | 0.875 | 0.851 |
| Full-context LAR-1 | 0.937 | 0.983 | 0.977 | 0.990 | 0.985 |
| Complete-array LAR-1 | 0.988 | 0.995 | 0.996 | 0.995 | 0.996 |
| Full-context LAR-2 | 0.945 | 0.987 | 0.979 | 0.988 | 0.983 |
| Complete-array LAR-2 | 0.988 | 0.994 | 0.994 | 0.993 | 0.994 |
| Method | DeepSeek-7B | OLMo-7B | Qwen3-4B | Qwen3-8B | Qwen3-14B |
|---|---|---|---|---|---|
| Scoring-model detection scores | |||||
| Likelihood | 0.700 (0.018) | 0.574 (0.015) | 0.723 (0.019) | 0.732 (0.020) | 0.732 (0.020) |
| Entropy | 0.609 (0.019) | 0.488 (0.012) | 0.597 (0.015) | 0.636 (0.016) | 0.628 (0.015) |
| Rank | 0.642 (0.014) | 0.587 (0.017) | 0.667 (0.013) | 0.667 (0.014) | 0.671 (0.020) |
| Log-rank | 0.692 (0.018) | 0.578 (0.015) | 0.708 (0.017) | 0.724 (0.018) | 0.724 (0.019) |
| LRR | 0.619 (0.014) | 0.584 (0.020) | 0.581 (0.018) | 0.640 (0.016) | 0.641 (0.016) |
| Method | DeepSeek-7B | OLMo-7B | Qwen3-4B | Qwen3-8B | Qwen3-14B |
|---|---|---|---|---|---|
| Scoring-model detection scores | |||||
| Likelihood | 0.623 (0.019) | 0.535 (0.020) | 0.657 (0.018) | 0.678 (0.020) | 0.695 (0.021) |
| Entropy | 0.602 (0.021) | 0.487 (0.019) | 0.599 (0.016) | 0.622 (0.017) | 0.630 (0.017) |
| Rank | 0.577 (0.008) | 0.535 (0.011) | 0.579 (0.011) | 0.584 (0.011) | 0.580 (0.011) |
| Log-rank | 0.618 (0.019) | 0.532 (0.019) | 0.656 (0.017) | 0.678 (0.019) | 0.690 (0.020) |
| LRR | 0.565 (0.013) | 0.516 (0.018) | 0.575 (0.012) | 0.608 (0.013) | 0.607 (0.017) |
| Component | Restriction | WikiMIA | AI detection |
|---|---|---|---|
| Likelihood-derived channels | Raw log probability | 0.830 | 0.975 |
| + BOS-relative probability | 0.906 | 0.984 | |
| + Vocabulary-standardized channels | 0.953 | 0.989 | |
| + Local context response | 0.952 | 0.988 | |
| Array support: LAR-1 | Full-context cells | 0.802 | 0.937 |
| Shorter-context cells | 0.907 | 0.988 |
| Task | Method | 100 | 200 | 400 | 800 | Full |
|---|---|---|---|---|---|---|
| WikiMIA | Full-context only | 0.638 (0.619, 0.664) | 0.682 (0.661, 0.725) | 0.708 (0.689, 0.731) | 0.749 (0.735, 0.760) | 0.777 |
| LAR-1 | 0.684 (0.658, 0.719) | 0.753 (0.725, 0.785) | 0.812 (0.788, 0.841) | 0.875 (0.863, 0.884) | 0.913 | |
| LAR-2 | 0.714 (0.674, 0.743) | 0.796 (0.760, 0.813) | 0.857 (0.842, 0.881) | 0.914 (0.909, 0.923) | 0.943 | |
| AI detection | Full-context only | 0.860 (0.846, 0.883) | 0.890 (0.874, 0.907) | 0.897 (0.884, 0.912) | 0.902 (0.898, 0.911) | 0.908 |
| LAR-1 | 0.956 (0.945, 0.967) | 0.973 (0.967, 0.979) | 0.978 (0.976, 0.983) | 0.982 (0.979, 0.983) | 0.982 | |
| LAR-2 | 0.955 (0.945, 0.963) | 0.969 (0.964, 0.975) | 0.977 (0.973, 0.982) | 0.980 (0.977, 0.982) | 0.981 |
| Task | Analysis | Test group | Test size | AUC |
|---|---|---|---|---|
| WikiMIA | Within length group | 32 | 776 | 0.934 |
| WikiMIA | Within length group | 64 | 542 | 0.967 |
| WikiMIA | Within length group | 128 | 250 | 0.981 |
| WikiMIA | Within length group | 256 | 82 | 1.000 |
| WikiMIA | Across length groups | 128+256 | 332 | 0.979 |
| WikiMIA | Across length groups | 32+64 | 1318 | 0.836 |
AI-Generated Text Detection
AI-generated text detection develops methods to distinguish human-written, machine-generated, and AI-edited text.
See all 171 papers