Skip to main content
PNAS Nexus logoLink to PNAS Nexus
. 2026 Nov 12;5(11):pgag391. doi: 10.1093/pnasnexus/pgag391

Measuring immigration rhetoric in the UK parliament

Gloria Gennaro 1,✉, Anna Vissens 2, Alice Thornewill von Essen 3, Tom Ravalde 4, Joseph Egan 5, Simran Dave 6, Eliot Dable 7, Gabriel Facini 8
Editor: Sara Goodman
PMCID: PMC13784367  PMID: 43061100

Abstract

Migration is a defining phenomenon of our time, around which heightened political rhetoric creates the impression of unprecedented political conflict. In the United Kingdom, this perception coincides with major political developments, such as the Brexit referendum and the rise of anti-immigration politics. However, systematic understanding of elite discourse on this subject remains limited. We introduce a novel machine learning pipeline that combines LLMs and human inputs to analyze sentiment toward immigration in political speech. Applying our model to spoken contributions in the UK House of Commons from 1923 to 2025, we report high classifier performance and stability across modeling choices. Our descriptive findings validate and extend existing qualitative research: Labour Members of Parliament (MPs) have expressed more positive sentiment than Conservatives since the early 1960s, with party divergence widening in the early 1980s. Furthermore, cross-party rhetoric has grown increasingly negative over the past 15 years, with Conservative and Reform UK MPs now using a more negative tone than any party has in the period studied. We discuss how this pipeline and dataset can support future research, highlighting use cases on the linkages between elite discourse and public opinion, discourse moralization, and positive and negative frames.

Keywords: immigration, UK parliamentary speeches, natural language processing, large language models, machine learning

Introduction

It is a common perception that the political debate over immigration has reached unprecedented levels of negativity in Western democracies. Aligned with this intuition, scholars have noted that voters pay more attention to immigration than in the past (1), and that political candidates prioritize this issue in their campaigns (2). We complement this picture by examining how elected officials have discussed immigration over the last century in parliament. To do that, we turn to the United Kingdom, which has seen a steady increase in immigration since the 1960s (3);1 significant shifts in public opinion and salience of immigration (4); and intense debates about its immigration policy, originating from the colonial system of laws and beliefs (5, 6), that has varied in restrictiveness and selectivity over time (7).

We use the full corpus of spoken contributions in the House of Commons from 1919 to 2025 and a curated dictionary of immigration-related keywords to identify potentially relevant snippets. Random samples of these snippets were annotated for their relevance to immigration and immigrants and for their sentiment toward immigration. Positive sentiment emphasizes immigrants’ contributions, supports integration and inclusivity, promotes welfare access, or counters negative immigration narratives. Negative sentiment portrays immigration as a cultural, social, or economic threat and supports restrictive policies. Neutral snippets present facts or issues without clear sentiment. We combine human and large language model (LLM) annotations, to train two transformer-based models (“classifiers”) for relevance and sentiment detection. We use these models to identify immigration-related snippets and their sentiment.

This work contributes to the literature in two ways. First, it introduces a novel pipeline to evaluate elite discourse at scale, using machine learning and LLMs. This approach is applicable to similar datasets, for example, political speeches on a different subject in other countries. Second, applying this method to the House of Commons yields a new dataset on immigration sentiment, that we use to provide a unified account of the evolution of immigration rhetoric in the UK parliament. Our main descriptive results closely align with qualitative accounts of specific time periods (e.g. 1, 4, 5, 8), increasing confidence in the underlying dataset. We conclude by discussing how the data’s granularity and coverage create opportunities for future substantive, theory-driven work.

Results

We present results on model performance, prediction stability, and descriptive trends. We start by reporting on the models’ ability to accurately predict immigration sentiment in individual snippets. To evaluate model performance, we trained both classifiers on 90% of the annotated snippets and reserved the remainder as a hold-out test set. The relevance and sentiment models achieved macro F1 scores of 0.91 and 0.66, respectively (comparable to 9). These metrics are stable across random data splits: we retrained both models on five alternative random train–test splits and used a simple Bayesian model to estimate posterior distributions over performance. Credible intervals for macro F1 are ±0.006 and ±0.008, respectively.

Next, we show that the models’ aggregate predictions are not sensitive to the initial choice of immigration-related keywords. Specifically, we plot sentiment trends over time, a common exercise among social scientists (10). To do that, we classify snippets from 1923 to 2025 and averaged predicted sentiment at the year level, coding positive, negative, and neutral snippets as 1, −1, and 0. This produces a time-specific net sentiment measure interpretable as the percentage of positive minus the percentage of negative immigration-related snippets. To mitigate bias from imperfect individual predictions, we apply a classification–error correction to the aggregate proportions (10). Figure 1 shows the yearly net sentiment toward immigration in speeches from all politicians speaking in parliament at least once (gray solid line) and for selected parties. For each line, we compute an empirical sensitivity range that accounts for shifts in aggregate sentiment due to our initial keyword selection: in an iterative process, we discard each keyword along with related snippets and recompute sentiment from the remaining snippets. The shaded bands in Figure 1 report the minimum to maximum values of sentiment across iterations. The stability of the qualitative trend confirms that our models deliver aggregate findings that are resilient to keyword selection.

Figure 1.

For image description, please refer to the figure legend and surrounding text.

Net sentiment toward immigration over time. Each line shows immigration sentiment by party—TextHighlightLabour (red), Conservatives (blue), Reform UK (light blue)—and across all parties (gray). Sentiment is the share of positive minus negative snippets among immigration-related snippets. The plot marks key events: (1) HMT Empire Windrush (1948), (2) Commonwealth Immigration Act (1962), (3) British Nationality Act (1981), (4) Maastricht Treaty (1992), and (5) First Eastern EU enlargement (2004). Shaded ribbons show the range between the minimum and maximum values from reaggregating sentiment while dropping one immigration-related keyword at a time.

Finally, we compare trends in elite discourse with insights from qualitative scholarship, providing an additional validity test. For illustration purposes, we plot sentiment expressed by Labour (including Labour Co-operative and the Scottish Labour Party) and Conservative (including the Unionist Party) politicians as the largest parties in the postwar period, and by Reform UK politicians for their radical stance on immigration and influence on the immigration debate (1).2 We report trends since 1923 (the first year of the UK’s modern borders) for transparency, but discuss the post-1948 period, when immigration became a major (5) and frequently discussed policy issue (see Ref. 11). Our results are consistent with qualitative accounts of immigration discourse, which identify three main phases since 1948.

From 1948 to the early 1960s, Labour and Conservative sentiment aligned under a postwar consensus across a range of issues (8). Immigration policy was largely laissez-faire, preserving free movement from the old Commonwealth while concealing growing unease about immigration from the new Commonwealth (5). This convergence began to erode in the early 1960s as discourse moved from closed cabinet meetings to Parliament, driven by the signing of landmark legislation like the 1962 Commonwealth Immigration Act. Our results indicate that the Conservatives became notably more negative as they established issue ownership on immigration from the 1960s onward, amid rising public hostility (8). Sentiment diverged sharply post-1979 around the 1981 British Nationality Act, marked by wider net sentiment ranges and more frequent parliamentary debates (in Ref. 11) as public salience grew (1). Key turning points in the politicization of immigration were the Maastricht Treaty (1992) and the 2004/2007 Eastern enlargements (1). Our results show that net sentiment fell steadily after 1992, reaching very low levels in the 2000s. After a post-2015 recovery, sentiment dropped sharply under Sunak, Starmer, and Reform’s entry into parliament, with Conservative and Reform UK MPs in 2025 using a more negative tone than any party has in the period studied.

Discussion

This study developed a new approach to evaluate elite discourse, demonstrating the ability of LLMs to assist this work at scale without compromising accuracy. While our models are tailored to the UK House of Commons, the pipeline can be applied to other domains. Our use case revealed a growing gap in net immigration sentiment between Labour and Conservative politicians and record levels of positive and negative sentiment in the last 15 years. These results highlight at least three research directions that go beyond the scope of this report, which our new dataset would facilitate.

First, this dataset supports the quantitative study of the links between political rhetoric, public opinion, and immigration levels, illuminating when immigration becomes politicized (1, 12, 13). Previous quantitative research on the United Kingdom has focused on specific episodes with limited variation in elite rhetoric (13). Our dataset enables this effort to be extended over time and across cases, following the lead of qualitative researchers in this field (4).

Second, our dataset may be used to explore to what extent different immigration sentiment within and across parties is driven by policy or moral disagreements. Research shows that moralization is higher when issue salience and polarization increase (14). Those factors vary over time and exploratory analysis suggests that immigration is increasingly portrayed through victim and crime archetypes (11).3 For instance, exploratory analyses of distinctive words indicate that positive snippets have increasingly focused on victims of specific crises over time (e.g. “jewish,” “palestinian,” “serbian,” and “yazidi”), whereas negative rhetoric has shifted toward illegality (“illegal,” “overstayers,” and “clandestine”) and, more recently, forceful government actions (“smash,” “toughen,” and “clamp”) (11). A natural extension of this study is to quantify the variation in sentiment that is explained by moral or policy language, and examine how their explanatory power changes across contextual conditions.

Third, the last 15 years have seen sharp rhetorical shifts between extreme positive and negative levels. Multiple factors may have contributed to these trends, from high immigration levels to geo-political crises or discourse contagion from radical right parties (15) (as Fig. 1 might suggest). This dataset can be used to better quality the discourse that underpins these shifts in sentiment. For example, exploratory analyses (11) show that these shifts are particularly strong in asylum-related speeches (consistent with 12). More can be done to connect sentiment variation to theory-grounded categories of immigrant threat or contribution.

Materials and methods

We used records of spoken contributions in the UK House of Commons (Hansard) from 1919 to 2025. MPs were linked to party affiliations via Wikidata, and speeches without identifiable speakers were removed. The final dataset includes over 5 million speeches by 5,479 MPs from 63 parties.

Using a dictionary of immigration-related keywords, we extracted all sentences containing these terms and the two adjacent sentences on each side as context. These speech snippets capture variation in topics and sentiment within speeches. We then randomly sampled 1,330 snippets, stratified by year and oversampling speakers with known negative immigration stances to address class imbalance. Twelve human annotators labeled each snippet as expressing positive, negative, or neutral sentiment toward immigration, or as unrelated (relevance). Annotators developed guidelines and jointly resolved ambiguities to ensure consistent labeling. Inter-annotator reliability on 472 randomly sampled snippets was Krippendorff’s α=0.56, consistent with prior work (9). We then used LLMs as auxiliary annotators to label another random sample of 22,600 snippets. The most effective method used a two-step prompt: we first asked how a reader might feel about immigration when reading the snippet, then assigned a value to the probability that it belonged to each sentiment and relevance category. To avoid prompting the LLM with emotionally charged labels, categories were indicated by abstract labels. This setup yielded human–LLM agreement of α=0.63 and LLM–LLM agreement of α=0.69 on a random subsample of 800 snippets.

Using these annotations, we trained two RoBERTa-based classifiers: one to detect snippet relevance to immigration and another to infer sentiment toward immigration in relevant snippets. Classifier performance is reported in the Results section. The final models classified 237,890 unique snippets from 1923 to 2025. To avoid procedural interruptions, we included only snippets of at least ten words. The 1923 start date corresponds to the first full year of the UK’s modern borders after Irish secession in 1922. Of these snippets, 119,652 were identified as immigration-related and assigned a predicted sentiment label. We then aggregated sentiment at the party-year level by averaging their numerical values—positive (1), negative (−1), and neutral (0). We corrected these aggregates for prediction error using misclassification probabilities between predicted and true labels, estimated from our annotated hold-out sample (10). SI provides further details on annotation, training, classification, and aggregation, as well as keyword lists, the human annotation guidelines, and LLM prompts. The Supplementary Appendix (11) reports additional results and validity checks.

Supplementary Material

pgag391_Supplementary_Data

Acknowledgments

A.V., A.T., and T.R. gratefully acknowledge institutional support from The Guardian, which enabled this research through the allocation of dedicated creative time for exploratory and collaborative projects. We would like to thank Carmen Aguilar Garcia and Pamela Duncan for their invaluable research support, and Tom Fleming, Eleanor Woodhouse, Michael Jacobs, and participants in the UCL CPEB and Migration Clusters and at PolMeth Europe for support and feedback.

Footnotes

1

Immigration numbers spiked in 2023, due to resumed traveling after the Covid-19 pandemic, and returned to pre-Covid levels in 2025. The Office for National Statistics estimated that around 19% of UK residents were born abroad in 2024 (3).

2

Note, however, that the dataset includes information on all parties with speaking MPs.

3

These archetypes strongly correlate with sentiment, while economic frames correlate more weakly with sentiment and remain largely stable over time.

Contributor Information

Gloria Gennaro, Department of Political Science, University College London, London WC1H 9QU, United Kingdom.

Anna Vissens, The Guardian, London N1 9GU, United Kingdom.

Alice Thornewill von Essen, The Guardian, London N1 9GU, United Kingdom.

Tom Ravalde, The Guardian, London N1 9GU, United Kingdom.

Joseph Egan, Centre for Data Intensive Science and Industry, University College London, London WC1E 6BT, United Kingdom.

Simran Dave, Centre for Data Intensive Science and Industry, University College London, London WC1E 6BT, United Kingdom.

Eliot Dable, Centre for Data Intensive Science and Industry, University College London, London WC1E 6BT, United Kingdom.

Gabriel Facini, Centre for Data Intensive Science and Industry, University College London, London WC1E 6BT, United Kingdom.

Supplementary Material

Supplementary material is available at PNAS Nexus online.

Competing Interest

The authors declare no competing interests.

Funding

J.E., S.D., and E.D. gratefully acknowledge support by the UK’s Science and Technology Facilities Council (STFC) UCL Centre for Doctoral Training in Data Intensive Science (ST/W00674X/1) and by departmental and industry contributions. G.F receives support from the STFC (ST/W00058X/1).

Author Contributions

A.T., A.V., G.F., G.G., and T.R. designed research; A.T., A.V., E.D., G.G., J.E., S.D., and T.R. performed research; A.V., A.T., G.F., G.G., and T.R. wrote the article.

Preprints

This manuscript was posted on a preprint: https://doi.org/10.31235/osf.io/6xgja_v2.

Data Availability

All analysis code used in this study is publicly accessible under an MIT license at GitHub and archived on Zenodo. The annotated parliamentary datasets, training data, and models are archived on Zenodo under a CC-BY 4.0 license. Github link: https://github.com/guardian/immigration-rhetoric. Zenodo DOI: https://doi.org/10.5281/zenodo.23982090.

References

  • 1. Dennison  J, Geddes  A. 2019. A rising tide? The salience of immigration and the rise of anti-immigration political parties in Western Europe. Polit Quart. 90:107–116. [Google Scholar]
  • 2. Dancygier  R, Margalit  Y. 2020. The evolution of the immigration debate: evidence from a new dataset of party positions over the last half-century. Comp Political Stud. 53:734–774. [Google Scholar]
  • 3. Kirk-Wade  E Migration statistics. Research Briefing CBP06077, House of Commons Library, London, 5 2026. https://researchbriefings.files.parliament.uk/documents/SN06077/SN06077.pdf. Accessed: 2026-08-30.
  • 4. Ford  R, Jennings  W, Somerville  W. 2015. Public opinion, responsiveness and constraint: Britain’s three immigration policy regimes. J Ethn Migr Stud. 41:1391–1411. [Google Scholar]
  • 5. Hansen  R. Citizenship and immigration in postwar Britain. Oxford University Press, 2000. [Google Scholar]
  • 6. Paul  K. Whitewashing Britain: race and citizenship in the postwar era. Cornell University Press, 1997. [Google Scholar]
  • 7. De Haas  H, Natter  K, Vezzoli  S. 2016. Growing restrictiveness or changing selection? The nature and evolution of migration policies. Int Migr Rev. 52:324–367. [Google Scholar]
  • 8. Bale  T. 2022. Policy, office, votes—and integrity. the British Conservative Party, Brexit, and immigration. J Ethn Migr Stud. 48:482–501. [Google Scholar]
  • 9. Card  D, et al.  2022. Computational analysis of 140 years of US political speeches reveals more positive but increasingly polarized framing of immigration. Proc Natl Acad Sci U S A. 119:e2120510119. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 10. Hopkins  DJ, King  G. 2010. A method of automated nonparametric content analysis for social science. Am J Pol Sci. 54:229–247. [Google Scholar]
  • 11. Gennaro  G, et al.  A century of immigration rhetoric in the UK parliament - Online Appendix. 2026.
  • 12. Carvalho  J, Eatwell  R, Wunderlich  D. The politicisation of immigration in Britain. In: The politicisation of migration. Routledge; 2015. p. 159–178. [Google Scholar]
  • 13. Hopkins  DJ. 2011. National debates, local responses: the origins of local concern about immigration in Britain and the United States. Br J Political Sci. 41:499–524. [Google Scholar]
  • 14. Simonsen  KB, Widmann  T. 2025. When do political parties moralize?: a cross-national study of the use of moral language in political communication on immigration. Br J Political Sci. 55:e33. [Google Scholar]
  • 15. Van Spanje  J. 2010. Contagious parties: anti-immigration parties and their impact on other parties’ immigration stances in contemporary Western Europe. Party Politics. 16:563–586. [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

pgag391_Supplementary_Data

Data Availability Statement

All analysis code used in this study is publicly accessible under an MIT license at GitHub and archived on Zenodo. The annotated parliamentary datasets, training data, and models are archived on Zenodo under a CC-BY 4.0 license. Github link: https://github.com/guardian/immigration-rhetoric. Zenodo DOI: https://doi.org/10.5281/zenodo.23982090.


Articles from PNAS Nexus are provided here courtesy of Oxford University Press

RESOURCES