Manuscript Offprint
arXiv:2610.23309Inferring L1 Backgrounds from L2 English with LLM Token Probabilities
Abstract
Native language identification (NLI) infers a non-native speaker's first language (L1) from their second language (L2) production. We investigate a token probability approach that scores each text sample as a continuation of a prompt prefix specifying a candidate L1, then predicts the candidate with the highest score. We evaluate our approach using Llama 3.1 8B and 70B on three datasets: TOEFL9, Write & Improve 2024, and BULATS-L1. We compare its performance with previous prompting-based classification approaches. Token-probability scoring substantially improves on direct classification, particularly with the 8B model, while the 70B model achieves state-of-the-art performance across all datasets. Our results indicate that pretrained LLMs' token probabilities contain information useful for distinguishing L1 backgrounds from L2 English production.
1 Introduction
Native Language Identification (NLI) is the task of inferring a non-native speaker's first language (L1) from their production in a second language (L2). NLI is motivated in part by cross-linguistic influence: a learner's L1 can shape their L2 production and may leave patterns associated with that background (Jarvis and Pavlenko, 2008). Strong performance by large language models (LLMs) on related tasks, such as grammatical error detection and multilingual translation, has motivated interest in their use for NLI (Goswami et al., 2024). Recent studies have explored zero-shot, prompting-based classification approaches to NLI (Zhang and Salle, 2023; Ng and Markov, 2025; Goswami et al., 2025), with some reporting state-of-the-art (SoTA) results on NLI benchmarks. More recent work has also shown that editorial corrections to learner text can change the probability an LLM assigns to its predicted L1 label (Uluslu et al., 2026a). This motivates us to examine the token-level probabilities the model assigns to the essay under different contexts, rather than only its generated answer.
We investigate a token-probability approach in which a pretrained LLM scores an essay under prompts specifying different candidate L1 backgrounds. The model predicts the candidate whose prompt gives the essay the highest score. We compare this approach with direct LLM classification and examine how performance changes with the amount of text available. We evaluate our approach using Llama 3.1 8B Instruct and Llama 3.1 70B Instruct (Grattafiori et al., 2024) on three datasets: TOEFL9 (Blanchard et al., 2013), Write & Improve 2024 (Nicholls et al., 2024), and BULATS-L1 (Uluslu et al., 2026b).
Our findings show that token-probability scoring substantially improves on direct classification, particularly with the 8B model. This is notable given prior findings that models of this scale may require task-specific fine-tuning to achieve competitive performance on NLI (Ng and Markov, 2025). The 70B model achieves SoTA performance across all three datasets in the evaluation settings considered. Our results show that token probabilities conditioned on candidate-L1 prefixes provide a useful signal for distinguishing L1 backgrounds from L2 English production.
Language-modeling for learner language. The use of model surprisal and essay-level probabilities for this task has also been explored in earlier work (Lotfi et al., 2020). These approaches train language models such as GPT-2 on learner essays associated with particular L1 backgrounds and compare how well each model predicts a test essay. For a model associated with background , the average token-level negative log-likelihood of an essay is
For NLI, the essay is assigned to the background whose model yields the lowest loss, or equivalently the highest length-normalized log-probability.
Scoring the essay under candidate prefixes. Our approach differs in how the candidate L1 information enters the model. Rather than training a separate language model on essays from each background, we use a shared, general-purpose LLM and condition it on the candidate L1 through the prompt. This lets us investigate whether a model contains useful information for detecting cross-linguistic influence in L2 English writing (Acharya et al., 2025). We provide a candidate L1 in the prompt and score the probability of the observed essay as a continuation. For each , we use the same prompt template, for example:
An English learner whose first language is {L1} wrote the following text:
{learner_text}
Let denote this prompt instantiated with candidate background . Let denote the next-token distribution of the shared model M. We define the candidate-conditioned essay score as
In computing the score, we include the essay tokens but not the prompt tokens. The model-based prediction is the candidate under which the observed essay receives the highest score:
Thus, every L1 candidate is evaluated against the same essay, with the candidate L1 supplied as prefix.
Relation to forensic likelihoods. Our approach connects to forensic text comparison (Ishihara et al., 2024) because both assess evidence relative to competing hypotheses. Let be the hypothesis that the writer's L1 is , and the evidence be the observed essay, . A forensic comparison between two hypotheses is commonly expressed as a log-likelihood ratio:
(4)
In our approach, the candidate-L1 prefix conditions the model on each hypothesis before observing the evidence.
3 Datasets
3.1 TOEFL9
We use the test set of TOEFL11, a standard benchmark for NLI (Blanchard et al., 2013), and retain the following nine L1 backgrounds: Arabic, Chinese, French, German, Hindi, Italian, Japanese, Spanish, and Turkish. We exclude Korean and Telugu because they are not represented in either of the other two datasets used in this study. We refer to this nine-language subset as TOEFL9. It contains 900 essays, with 100 essays per L1. The mean essay length is 348 words.
3.2 Write & Improve 2024
We use a subset of the Write & Improve (W&I) 2024 corpus (Nicholls et al., 2024) selected for NLI evaluation by Uluslu et al. (2026b). It contains 450 essays from nine L1 backgrounds, matching those in TOEFL9: Arabic, Chinese, French, German, Hindi, Italian, Japanese, Spanish, and Turkish, with 50 essays per L1. The subset includes essays of at least 100 words that are annotated at CEFR level A2 or above. The mean essay length is words.

Llama 3.1 8B / L1-Prefix-Prob
Llama 3.1 8B / Classification
Llama 3.1 70B / L1-Prefix-Prob
Llama 3.1 70B / Classification
Figure 1: Accuracy as a function of input length for Llama 3.1 8B and 70B using language-prefix likelihood scoring (solid lines) and direct classification (dashed lines). Panels show results on Write & Improve 2024, TOEFL9, and BULATS-L1.
3.3 BULATS-L1
We evaluate our method on BULATS-L1 (Uluslu et al., 2026b), a dataset derived from the Business Language Testing Service (BULATS), developed by Cambridge English. It contains spoken English submissions from learners with six self-reported L1 backgrounds: Arabic, Chinese, French, Italian, Japanese, and Spanish. We use the balanced test set, which comprises 270 submissions, with nine submissions for each L1–CEFR-level combination across levels A1–C1. The dataset is provided with automatic speech recognition (ASR) transcripts of the spoken responses. The mean transcript length is 472 words per submission.
4 Experiments
4.1 Models and Prediction Approaches
We evaluate two commonly used open-weight language models for NLI: Llama 3.1 8B Instruct and Llama 3.1 70B Instruct (Ng and Markov, 2025; Nicholls and Alperin, 2025). We evaluate each model using two approaches. For direct classification, we prompt the model to select the writer's L1 from the candidate languages. The classification prompt is provided in Appendix A. For token probability scoring, we follow Equation 2: for each candidate L1, we instantiate the corresponding prefix and sum the log probabilities assigned to the input-text tokens. The prefix prompts are provided in Appendix B. For TOEFL9 and Write & Improve, we use the written text prefix template. For BULATS-L1, initial experiments with this template did not produce satisfactory results. We therefore use a speech-aware prefix that identifies the input as a transcript of an English learner's spoken response. We predict the candidate L1 whose prefix yields the highest score. Before inference, we mask named entities, including locations, nationalities, and personal names, as well as non-English words. This approach aims to reduce reliance on explicit identity cues and topic-related shortcuts (Uluslu et al., 2025). We compare our methods with state-of-the-art NLI approaches reported in prior work (Zhang and Salle, 2023; Uluslu et al., 2026a,b). All of these approaches use GPT-4o (Hurst et al., 2024) as their best performing model. We report comparisons for datasets and evaluation settings for which results are available.
4.2 Data Efficiency
To examine how performance changes with the amount of text available, we evaluate each method using the first 50, 100, 150, 200, and 250 words of each text. We also report results using the full, untruncated text (“Full”). We use the resulting text as input to both the direct-classification and token probability methods.
https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct
https://huggingface.co/meta-llama/Llama-3.1-70B-Instruct
5 Results
5.1 Comparison of Prediction Methods Across Input Lengths
Figure 1 shows accuracy as a function of input length. Across all three datasets, both model sizes, and every evaluated length, L1-prefix probability scoring outperforms direct classification. The difference is especially pronounced for Llama 3.1 8B. With unrestricted text, direct classification achieves roughly half the accuracy of prefix scoring across the three datasets.
The 70B model achieves higher accuracy than the 8B model when both use the same prediction method. However, prefix scoring with the 8B model matches or exceeds direct classification with the 70B model in several settings, including full-text Write & Improve and BULATS-L1. This shows that the choice of prediction method has a substantial effect, even when comparing models of different sizes.
Accuracy generally increases as more text is provided, with large gains often occurring between 50 and 150 words. The improvements become smaller at longer input lengths in some settings, and there are occasional small decreases at intermediate lengths. Additional text is particularly beneficial for BULATS-L1 when the unrestricted transcript is used. Overall, more textual evidence tends to help, though the size of the improvement varies across datasets and methods.
5.2 Comparison with Previous Results
| Dataset | Previous SoTA | Our approach |
|---|---|---|
| TOEFL9 | 95.1% (Zhang and Salle, 2023) | 96.0% |
| W&I 2024 | 88.9% (Uluslu et al., 2026a) | 92.0% |
| BULATS-L1 | 83.3% (Uluslu et al., 2026b) | 84.1% |
Table 1: Full-text accuracy compared with previously reported results. Our approach uses L1-prefix probability scoring with Llama 3.1 70B.
Table 1 compares full-text results from Llama 3.1 70B using L1-prefix probability scoring with the best results reported in prior work. Our method outperforms the reported results on all three datasets. These comparisons show that an open-weight 70B model using prefix-conditioned token probabilities can achieve strong performance relative to the GPT-4o-based approaches reported in prior work.
The TOEFL results should be interpreted in light of concerns about possible training-data leakage for this benchmark (Goswami et al., 2025). However, we observe the same broad pattern on Write & Improve 2024 and BULATS-L1, datasets that were not publicly available when the Llama models were released. This indicates that the findings are not specific to TOEFL9 or dependent only on exposure to that benchmark. Accuracy on BULATS-L1 is lower than on the two written datasets for the 70B prefix-scoring approach. BULATS-L1 consists of transcripts of spoken responses, which may contain disfluencies and ASR errors. The datasets also differ in other respects, so their raw accuracies should be compared with caution.
5.3 Score Decomposition
To illustrate how candidate-L1 prefixes affect scores within a text, we analyze a single sentence from a Turkish-labeled essay using Llama 3.1 8B. For each candidate L1, we center the sentence and word-level subtoken log-probabilities relative to the nine-candidate mean. Appendix D details the scoring formulation, and Figure 2 shows the resulting sentence-level ranking and word-level contributions.
6 Conclusion
We investigated whether pretrained LLMs can identify L1 backgrounds by scoring learner texts under prompts that specify candidate L1s. Across three datasets, two model sizes, and all evaluated input lengths, L1-prefix probability scoring consistently outperformed direct classification. The results show that even the 8B model can perform strongly with this approach, while the 70B model achieved full-text accuracies of on TOEFL9, on Write & Improve 2024, and on BULATS-L1. These results exceed the previously reported scores in the evaluation settings considered. Results on the two recently released datasets also suggest that the findings are not limited to TOEFL9. Future work should investigate the linguistic and token-level signals that drive these scores, including how candidate-L1 prefixes change the probabilities assigned to particular parts of an essay. Such analyses could help explain what information the models use to distinguish L1 backgrounds. Overall, prefix-conditioned token probabilities provide a promising approach to NLI and a useful complement to direct LLM-based classification.
Limitations
Dataset representativeness and low-resource scenarios. Our results are limited to English L2 texts and the L1 backgrounds included in the three benchmarks. It remains to be seen whether the gains from L1-prefix-probability scoring hold for other L2 languages and for L1 backgrounds not represented in these benchmarks, especially those that may be underrepresented in the models' pretraining data.
Computational cost. Prefix scoring requires evaluating the essay under each candidate-L1 prefix, whereas direct classification reads the essay once and generates a short label. The essay-token probabilities are scored without autoregressively generating the essay, and candidate scores can be batched. Prefix scoring therefore involves more candidate-conditioned computation, but this does not necessarily translate into proportionally higher inference latency. We did not measure runtime or resource use, so a direct efficiency comparison remains for future work.
Ethical Considerations
Our research uses publicly available L2 English learner corpora, including the pseudonymized Write & Improve corpus (Nicholls et al., 2024) and TOEFL11 (Blanchard et al., 2013). TOEFL11 contains no direct personal identifiers. We also use speech transcripts from BULATS-L1 (Uluslu et al., 2026b), which was anonymized and made available for this study but is not publicly released. We acknowledge the broad societal implications of authorship analysis, including potential risks to the security and privacy of individuals (Saxena et al., 2025). This work is intended to contribute to educational research on L2 learner language and research on the transparency and privacy implications of automated text analysis. As detailed in our Limitations (Section 6), we also recognize that our efforts to mitigate bias are not exhaustive, and further research is needed.
Acknowledgments
This work was supported by Innosuisse innovation project 103.188 IP-ICT (AUCH). The project also received support from Cambridge University Press & Assessment, a department of The Chancellor, Masters, and Scholars of the University of Cambridge.
References
Poorvi Acharya, J Elizabeth Liebl, Dhiman Goswami, Kai North, Marcos Zampieri, and Antonios Anastasopoulos. 2025. Tracing L1 interference in English learner writing: A longitudinal corpus with error annotations. In Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, pages 15157–15178.
Daniel Blanchard, Joel Tetreault, Derrick Higgins, Aoife Cahill, and Martin Chodorow. 2013. TOEFL11: A corpus of non-native English. ETS Research Report Series, 2013(2):i–15.
Dhiman Goswami, Sharanya Thilagan, Kai North, Shervin Malmasi, and Marcos Zampieri. 2024. Native language identification in texts: A survey. In Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers), pages 3149–3160.
Dhiman Goswami, Marcos Zampieri, Kai North, Shervin Malmasi, and Antonios Anastasopoulos. 2025. Multilingual native language identification with large language models. In Proceedings of the 2025 Conference of the Nations of the Americas Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 4: Student Research Workshop), pages 193–199.
Aaron Grattafiori, Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Alex Vaughan, et al. 2024. The Llama 3 Herd of Models. arXiv preprint arXiv:2407.21783.
Aaron Hurst, Adam Lerer, Adam P Goucher, Adam Perelman, Aditya Ramesh, Aidan Clark, AJ Ostrow, Akila Welihinda, Alan Hayes, Alec Radford, et al. 2024. GPT-4o System Card. arXiv preprint arXiv:2410.21276.
Shunichi Ishihara, Sonia Kulkarni, Michael Carne, Sabine Ehrhardt, and Andrea Nini. 2024. Validation in forensic text comparison: Issues and opportunities. Languages, 9(2):47.
Scott Jarvis and Aneta Pavlenko. 2008. Crosslinguistic Influence in Language and Cognition. Routledge.
Ehsan Lotfi, Ilia Markov, and Walter Daelemans. 2020. A deep generative approach to native language identification. In Proceedings of the 28th international conference on computational linguistics, pages 1778–1783.
Yee Man Ng and Ilia Markov. 2025. Leveraging open-source large language models for native language identification. In Proceedings of the 12th Workshop on NLP for Similar Languages, Varieties and Dialects, pages 20–28.
Diane Nicholls, Andrew Caines, and Paula Buttery. 2024. The Write & Improve Corpus 2024: Error-annotated and CEFR-labelled essays by learners of English. Cambridge University Press & Assessment.
Robin Nicholls and Kenneth Alperin. 2025. Cross-genre native language identification with open-source large language models. In Proceedings of the 2nd LUHME Workshop, pages 103–108.
Vageesh Saxena, Aurelia Tamò-Larrieux, Gijs Van Dijck, and Gerasimos Spanakis. 2025. Responsible guidelines for authorship attribution tasks in nlp: V. saxena et al. Ethics and Information Technology, 27(2):16.
Ahmet Yavuz Uluslu, Mark Gales, Kate Knill, and Gerold Schneider. 2026a. The impact of editorial intervention on detecting native language traces. arXiv preprint arXiv:2605.10216.
Ahmet Yavuz Uluslu, Tannon Kew, Tilia Ellendorff, Gerold Schneider, and Rico Sennrich. 2025. Robust native language identification through agentic decomposition. In Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing, pages 8409–8425.
Ahmet Yavuz Uluslu, Mengjie Qian, Kate Knill, and Mark Gales. 2026b. Acoustic and lexical signals for native language identification of language learners. In Proceedings of the 15th Workshop on Natural Language Processing for Computer Assisted Language Learning. To appear.
Wei Zhang and Alexandre Salle. 2023. Native language identification with large language models. arXiv preprint arXiv:2312.07819.
A Direct-Classification Prompt
The following prompt was used for direct classification:
You are a forensic linguistics expert that reads texts written by non-native authors in order to identify their native language. Analyze each text and identify the author's native language. Use clues such as spelling errors, word choice, syntactic patterns, and grammatical errors to decide. You ONLY respond in JSON files. The expected output from you has to be: {"native_lang": "<language>}
B Prefix Prompts
Write & Improve 2024 and TOEFL9
An English learner whose first language is {language} wrote the following text:
{text}
BULATS-L1
The following is a speech transcript produced by an English learner whose first language is {language}:
{text}
C Compute Budget and Model Runs
The experiments were inference-only, no model fine-tuning was performed. Reported accelerator runtimes were:
| Model and accelerator | Runtime and estimated cost |
|---|---|
| Llama 3 80B FP16 on H200 SXM (141 GB VRAM) | 3 h at 15.87 |
| Llama 3.1 8B Instruct on A40 (48 GB VRAM) | 5 h at 2.95 |
| Total | 8 h; $18.82 |
D Exploratory Analysis of L1-Mean-Centered Log-Likelihoods
Figure 2 shows the sentence-level score differences and word-level contributions for the nine L1 prefixes.
D.1 Score decomposition
For the sentence shown, model subtokens are grouped into 19 whitespace-delimited words in the heat map. Using the candidate-conditioned score defined in Equation 4, the upper panel plots each L1's deviation from the arithmetic mean across the nine candidates:
This is the final sentence score shown, in nats per sentence. Centering preserves the ranking of .
For the heat map, each model subtoken is assigned to the whitespace-delimited word with the greatest non-whitespace character overlap, whitespace-only subtokens go to the preceding word, or the first word at sentence start. For the subtokens assigned to word , the plotted value is
Each heat-map value is a sum of subtoken log probabilities centered on the L1 mean. Positive values mean higher likelihood (lower surprisal) than the mean. Summing word deviations gives . For example, Turkish is about +0.33 nats above the L1 mean for the unidiomatic usage of the word mingle.
Each L1 compared with the mean across L1s
Sentence deviation from L1 mean

Word deviations from L1 mean
| Sentence word | Word deviations from L1 mean | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| +0.38 | +0.19 | +0.02 | -0.21 | -0.14 | -0.05 | -0.01 | +0.06 | -0.25 | |
| am | +0.18 | -0.17 | +0.18 | +0.22 | -0.22 | -0.29 | -0.20 | -0.16 | +0.47 |
| concerned | -0.52 | +0.45 | +0.21 | -0.02 | +0.76 | +0.05 | -0.75 | +1.02 | -1.20 |
| that | -0.04 | +0.02 | +0.09 | +0.08 | +0.03 | -0.16 | -0.05 | +0.27 | -0.24 |
| when | -0.07 | +0.11 | +0.38 | +0.06 | -0.06 | +0.20 | -0.15 | -0.33 | -0.15 |
| you | -0.13 | -0.15 | -0.19 | -0.01 | +0.23 | +0.15 | +0.15 | +0.09 | -0.15 |
| mingle | +0.33 | -0.02 | -0.04 | -0.01 | +0.11 | -0.44 | -0.25 | -0.07 | +0.39 |
| other | +0.04 | +0.42 | +0.01 | -0.64 | -0.09 | +0.22 | +0.24 | -0.23 | +0.02 |
| people's | +0.03 | +0.23 | +0.37 | +0.17 | +0.36 | -0.59 | -0.07 | +0.11 | -0.62 |
| situations, | +0.21 | +0.50 | -0.04 | -0.32 | +0.24 | +0.21 | +0.16 | -0.11 | -0.85 |
| they | +0.23 | +0.13 | -0.21 | -0.25 | -0.08 | +0.16 | +0.11 | -0.10 | +0.03 |
| may | -0.07 | +0.19 | +0.54 | +0.16 | -0.16 | -0.29 | -0.44 | -0.06 | +0.13 |
| accuse | +0.43 | -0.46 | +0.08 | +0.67 | +0.03 | +0.00 | -0.16 | -0.40 | -0.20 |
| you | -0.02 | -0.14 | -0.08 | +0.07 | +0.06 | +0.02 | +0.00 | +0.07 | +0.03 |
| after | +0.61 | +0.23 | -0.26 | -0.19 | -0.41 | -0.17 | -0.11 | -0.11 | +0.40 |
| they | +0.09 | +0.04 | +0.57 | +0.24 | -0.20 | -0.01 | -0.32 | +0.18 | -0.59 |
| resolve | +0.60 | +0.12 | -0.61 | -0.03 | -0.60 | +0.47 | +0.79 | -1.29 | +0.55 |
| the | +0.08 | +0.37 | +0.42 | -0.34 | -0.27 | -0.24 | +0.11 | -0.11 | -0.03 |
| situation. | +0.32 | +0.49 | +0.19 | -0.37 | -0.33 | -0.12 | -0.17 | -0.25 | +0.23 |
Word log-likelihood deviation from nine-L1 mean (nats)
Figure 2: Sentence-level ranking and word-level log-probability deviations from the nine-L1 mean (in nats). The upper panel sorts candidate L1s by total sentence deviation (), and the lower panel shows word-level deviations ().