Explains how language models inherit demographic, cultural, and occupational bias from training data, and why they amplify these biases beyond the data.
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Language models learn from text written by people, and people hold biases. This simple fact has far-reaching consequences. When a model trained on billions of words of human-generated text learns that "doctor" appears more often alongside "he" and "nurse" more often alongside "she," it does not just observe that pattern. It encodes it, reinforces it, and outputs it in every future prediction. A user asking a language model to "write a story about a doctor" may receive a story about a man, not because that is more accurate or more helpful, but because that is what the training data contained more of.
Bias in language models is not a bug in the traditional sense. It is an emergent property of learning from human-produced data. The model did exactly what it was trained to do: minimize prediction error on a corpus that reflected real-world imbalances. The problem is that this optimization process imports every systemic inequality encoded in that corpus and then projects it into a system that users expect to be authoritative, neutral, and trustworthy. Understanding where bias comes from, how it propagates through training, and what forms it takes is therefore not a peripheral concern for NLP practitioners. It is a central design problem.
This chapter covers the sources of bias in language models, the major categories of bias encountered in practice, how training data encodes and amplifies societal prejudice, and what the measurable consequences look like. The focus here is on understanding the problem deeply before we turn to measuring and mitigating it.
Part LV explored the challenges of evaluating language model outputs fairly, including how LLM judges can inherit position bias and sycophancy. Bias in model outputs is closely related: the evaluation frameworks you learned about in that part become even more critical when the thing being evaluated is a model that may itself be systematically unfair toward certain groups of people. The chapters that follow in this part will build on this foundation with concrete measurement techniques (Bias Measurement), mitigation strategies (Bias Mitigation), formal fairness criteria (Fairness Metrics), and the harms that result when representation goes wrong (Representation Harms).
Bias in language models does not originate in a single place. It flows from multiple upstream sources, each of which contributes its own distortions to the final model. Understanding the provenance of each form of bias matters because different sources require different interventions. Filtering training data addresses one kind of problem; improving annotation processes addresses another; rethinking the objective function addresses a third.
The most fundamental source of bias is the training corpus. Modern language models train on vast collections of text scraped from the internet, digitized books, academic papers, news archives, and social media platforms. These sources reflect the demographics, values, and blind spots of the people who produced them.
Web crawl data, such as Common Crawl, is dominated by English text from North America and Western Europe. A 2022 analysis of the data powering many large language models found that over 90% of content originated from a small number of Western-centric domains. Languages spoken by hundreds of millions of people, such as Swahili, Bengali, or Javanese, receive tiny fractions of representation. Even within English text, certain communities, age groups, educational backgrounds, and geographic regions are systematically overrepresented. The result is a model whose "knowledge" about the world is shaped by a narrow slice of human experience.
The underrepresentation problem extends beyond language. Even in English, the voices that populate the internet skew sharply toward specific demographics. Wikipedia editors are predominantly male; Reddit users skew young and technically educated; news commentary overrepresents professional classes. Each of these sources shapes which topics get covered, how they are framed, what perspectives are treated as defaults, and which experiences are described with nuance versus which are glossed over with stereotypes. A model trained on text produced primarily by one demographic will have richer, more detailed representations of that demographic's experiences and shallower, less accurate representations of everyone else.
The temporal dimension of training data introduces a different kind of bias. Text collected from the internet reflects the social norms, power structures, and language conventions of the period when it was written. Historical texts may use terminology now considered offensive, encode now-discredited scientific beliefs, or simply reflect a world in which certain professions were exclusively male or certain races legally excluded from institutions. A model trained on such text will reproduce these historical distortions unless explicit care is taken to address them. When training data spans multiple decades, the model effectively learns a time-averaged view of society that blends past injustices with present-day conditions, without any mechanism to distinguish between them.
The mechanism by which corpus bias enters the model is statistical. The model does not "see" sentences as meaningful human communication. It sees sequences of tokens, and it learns which token sequences are likely. When certain demographic groups are consistently described in certain terms, associated with certain roles, or framed in certain emotional registers across millions of documents, those associations become part of the model's learned probability distribution. They are not stored as explicit beliefs but as implicit weightings embedded across billions of parameters. This distributed encoding makes corpus bias both pervasive and difficult to isolate or remove.
Many language models are fine-tuned or evaluated using human-labeled data, and human annotators carry their own biases. When workers label sentiment, assess toxicity, or evaluate the quality of model-generated text, their judgments are shaped by their cultural background, personal experiences, and social position.
Several systematic effects have been documented. Annotators from majority groups tend to rate text expressing minority group perspectives as more extreme or more offensive. Workers hired through crowdsourcing platforms like Amazon Mechanical Turk skew heavily toward specific demographics, particularly in the United States. Annotation guidelines written with one cultural context in mind may produce labels that are meaningful within that context but misleading when applied to text from other communities.
The practical consequences of annotation bias run deeper than simple labeling errors. When a toxicity detection model is trained on annotations made primarily by workers from one cultural background, it will tend to flag as toxic the speech patterns characteristic of other cultural backgrounds, even when those patterns are not intended or received as harmful by their communities. African American Vernacular English (AAVE) is a well-studied case: multiple research papers have documented that automated toxicity classifiers trained on crowd-annotated data flag AAVE at higher rates than equivalent content in Standard American English. The annotators were not being malicious. They were applying their learned cultural intuitions about what sounds aggressive, informal, or threatening, and those intuitions encoded cultural distance as danger.
As discussed in the Inter-Annotator Agreement chapter, disagreement between annotators is common. When inter-annotator agreement is low, the choice of how to resolve disagreements, whether by majority vote, expert adjudication, or averaging, encodes a particular social perspective into the gold-standard labels. A dataset where annotations are resolved by majority vote will systematically reflect the views of the majority annotator population, potentially disadvantaging minority perspectives. If the task involves judging the appropriateness, quality, or safety of content, majority-vote resolution means that content aligned with the majority annotator population will be systematically rated more favorably than equally valid content from minority communities.
Even accurate statistics can encode injustice. If a historical corpus accurately reflects that surgeons were predominantly male in 1980, a model trained on that corpus will learn a real statistical association between surgery and maleness. But deploying that association in 2024 as though it reflects current reality, or as though it should shape future expectations, perpetuates a historical pattern that society has actively worked to change.
This is the distinction between descriptive bias (the world as it was or is) and normative bias (the world as it should be). Language models typically encode descriptive statistics from their training data but deploy their outputs in contexts where users expect normative guidance or neutral description. When a student asks a career counseling chatbot about becoming an engineer and receives subtly discouraging language because the model associates engineering with maleness, the model has treated a historical correlation as a current norm. It is not describing reality accurately; it is projecting a historical snapshot into a present where that snapshot is no longer valid and should not be reinforced.
Historical bias is particularly insidious because it can resist filtering. You cannot remove it by filtering out inaccurate text, because the text is accurate about what the world looked like when it was written. You cannot remove it by including only high-quality, reputable sources, because many historically biased documents come from high-quality, reputable sources. The only interventions that reliably address historical bias operate at the training objective or fine-tuning stage, either by weighting recent data more heavily, by explicitly correcting for historical under-representation, or by using alignment techniques that teach the model to reason about what the world should be rather than just what it was.
Societal bias, as distinct from purely historical bias, refers to associations reflecting current prejudices and inequalities that persist in society today. These can be even harder to address, because they cannot simply be dismissed as outdated. They represent real patterns in real text that a model is supposed to learn from. The challenge is that learning these patterns accurately means reproducing them in model outputs, which then reinforces them in the culture. The model becomes a participant in maintaining the social structures its training data reflects.
The training process itself, beyond the data, introduces additional bias. Objective functions shape what the model optimizes for. A language model trained purely to predict the next token will optimize for statistical frequency, not for fairness or representativeness. This means patterns that appear frequently in data will be learned more robustly than patterns that appear rarely, even when the less frequent patterns represent an equally valid or important part of reality.
The standard cross-entropy training objective makes no distinction between harmful and harmless statistical patterns. A pattern associating a minority group with criminal behavior will be learned with exactly the same mechanism as a pattern associating warm weather with outdoor activities. The only difference is frequency and the strength of correlating signals. If the harmful association appears more frequently or is correlated with more other features in the training data, the model will learn it more strongly. This is not a design flaw in the specific model but a property of maximum likelihood estimation applied to language.
Fine-tuning with reinforcement learning from human feedback (RLHF) introduces another layer. Human raters provide feedback that shapes the model's behavior, but rater populations are not demographically representative. If the raters who provide feedback skew toward certain cultural backgrounds, the fine-tuned model will learn to produce outputs those raters prefer, which may not align with the preferences or needs of users from different backgrounds. This creates a systematic gap between the model's optimized behavior and the needs of underrepresented user populations.
Hyperparameter choices and architecture decisions can also amplify certain kinds of bias. Models with larger context windows can capture longer-range co-occurrence patterns, potentially learning subtler associative biases. Models with smaller vocabularies may fail to represent names and concepts from underrepresented cultures accurately, defaulting to "unknown token" behaviors that degrade performance for certain communities. The tokenization process itself can introduce disparities: if a tokenizer trained on English-dominant data splits non-English words into many subword fragments, models using that tokenizer will have worse performance on non-English languages not because of anything in the model weights but because of how the input is preprocessed.
Bias in language models manifests in several distinct ways, each with different causes and consequences. The distinctions between these types matter taxonomically and practically: different types of bias require different measurement approaches and respond to different mitigation strategies.
Demographic bias encompasses skewed representations of, and associations with, human demographic groups. The most studied forms involve gender, race, and age, but demographic bias extends to disability, sexuality, religion, socioeconomic class, and nationality.
Gender bias is among the most well-documented. Word embedding studies beginning with the landmark Bolukbasi et al. (2016) paper demonstrated that embeddings trained on large corpora associate gendered terms with different occupations, personality traits, and social roles. The word "doctor" was closer in vector space to "he" than to "she," while "nurse" showed the reverse. These associations appear in static embeddings, masked language model predictions, and the completions of generative models. Critically, the magnitude of these associations has been shown to correlate with real-world gender representation statistics, suggesting that models are learning something real, but deploying it in contexts where the implication is that these associations should persist or be treated as natural.
Racial bias takes several forms. Language models have been shown to assign more negative sentiment to names and text associated with Black individuals compared to names and text associated with white individuals, holding all other content constant. This was demonstrated using the "name substitution" paradigm: take a sentence, swap in names strongly associated with Black versus white communities, and measure whether the model's sentiment assessment or continuation probabilities shift. They do, consistently and substantially. Models trained to detect toxicity in text systematically flag African American Vernacular English (AAVE) as more toxic than equivalent content in Standard American English, creating a disparate impact on communities that use AAVE.
Age bias involves both directions. Older adults are sometimes associated with decreased competence, technological inability, or diminished relevance. Young people may be associated with impulsiveness or irresponsibility. These associations shape model completions in ways that can disadvantage users across the age spectrum. An automated hiring tool built on a biased language model may subtly disadvantage older applicants through the language it generates in job descriptions or through the tone of AI-assisted screening conversations.
Demographic bias is particularly consequential because it maps directly onto legally protected characteristics in many jurisdictions. Discrimination on the basis of gender, race, age, disability, and religion is prohibited in employment, housing, education, and credit decisions in most developed legal systems. When language models used in decision-support systems exhibit demographic bias, the organizations deploying those models may face legal liability in addition to ethical criticism. This is one of the reasons that demographic bias has received more systematic research attention and regulatory focus than some other forms of model bias.
Cultural bias is distinct from demographic bias in that it involves assumptions about worldviews, values, and practices rather than stereotypes about specific groups. A model trained predominantly on English text from Western cultural contexts will encode Western frameworks as defaults and treat other cultural perspectives as deviations or exceptions.
This appears in many ways. Models may perform better on tasks that require knowledge of Western history, geography, and institutions than on equivalent tasks requiring knowledge of Asian, African, or South American contexts. They may apply Western concepts of individualism, linear time, or nuclear family structure in ways that are inappropriate for users from cultures organized around different values. Even the structure of language itself encodes cultural assumptions: models trained predominantly on English may struggle with grammatical categories, narrative conventions, or forms of politeness that are central to other languages.
Cultural bias is particularly challenging to address because it is often invisible to the researchers and engineers working on these systems. The default assumptions are so deeply embedded in the training data and in the backgrounds of the people building the systems that they do not register as assumptions at all. They register as facts, as common sense, as the obvious way that things are. A team of researchers from similar cultural backgrounds will often fail to notice that their benchmark is testing familiarity with Western cultural artifacts, that their example sentences embed Western grammatical conventions, or that their model evaluation metrics were designed with Western standards of quality in mind.
Consider an example from the domain of moral reasoning. Many Western ethical frameworks prioritize individual autonomy: the individual has rights, makes choices, and is the primary unit of moral concern. Many East Asian, African, and Indigenous ethical traditions prioritize relational or communal obligations, where one's identity and responsibilities are defined by one's place in a network of relationships, not by individual preferences. When a language model trained on Western-dominant text is asked to reason about ethical dilemmas, it will systematically apply individualistic framing. A question about whether to tell a white lie to protect a friend's feelings may be evaluated by the model in terms of individual honesty principles, ignoring the relational context in which protecting group harmony might be the culturally appropriate priority.
The same dynamic affects practical, non-philosophical tasks. Models trained on Western legal and political text may frame questions about governance in terms of rights and procedures, rather than the values of consensus, seniority, or communal deliberation that are central to political decision-making in many societies. Models trained on Western medical literature may default to biomedical explanatory models for illness and treatment, failing to engage directly with traditional medical knowledge systems that have clinical relevance in many communities. In each case, the Western framework is not presented as "one view among many" but as the default and obvious perspective, with alternatives appearing as edge cases or curiosities.
This problem scales as language models are deployed globally. A model built by a team in San Francisco, trained primarily on English-language internet text, and optimized for the preferences of demographically homogenous raters is now being used by hundreds of millions of people with vastly different cultural backgrounds, linguistic traditions, and social contexts. For users whose cultural frameworks align with the model's defaults, the model aligns with their expectations. For users whose frameworks differ, the model may give subtly misleading information, apply inappropriate norms, or fail to engage directly with cultural context that is central to the question being asked.
Occupational stereotyping involves associating certain professions, roles, or activities with particular demographic characteristics. The nurse/doctor gender association is the most famous example, but the pattern extends across many domains. Models may associate science, technology, engineering, and math (STEM) careers with men, humanities and care roles with women, and executive or leadership roles with white or Asian individuals while associating manual labor with specific ethnic groups.
These associations emerge from statistical patterns in text but become performative when deployed. A model that generates a job posting using male pronouns, or that depicts a scientist as a man when asked to write a story, actively reproduces historical patterns rather than simply reflecting them. The job posting will be read by real candidates, some of whom will feel implicitly excluded or subtly discouraged. The story will shape the mental imagery of readers who are developing their own sense of what is possible for people like them.
The performative aspect is important because it operates below the threshold of conscious intent. The person using the language model to draft a job posting did not ask for gendered language; the person who receives a resume-screened rejection did not know that their name was associated with a group the model disfavors. The bias acts invisibly, embedded in outputs that appear neutral on their surface. This invisibility makes occupational stereotyping in language models arguably more dangerous than overt discrimination: it is harder to challenge, harder to detect, and easier to rationalize away as "just what the data shows."
There is also a self-fulfilling dimension to this problem. When models consistently depict engineers as male, doctors as white, and service workers as belonging to particular ethnic groups, these depictions influence how users conceptualize these roles. Over time, this can normalize the very associations that the model reflects, reinforcing in culture what was already reflected from culture. The model becomes a participant in the social construction of occupational identity, not a passive mirror. A teenager receiving career advice from a language model, or browsing an AI-generated list of "typical" day-in-the-life descriptions for different professions, may internalize occupational stereotypes that limit their own sense of possibility.
Functional stereotyping extends beyond occupations into capabilities and traits. Models may associate emotional expressiveness with women and rational detachment with men, creativity with certain groups and analytical precision with others. These trait associations, embedded in model outputs, shape how models respond differently to equivalent requests from users who have different perceived demographic identities, and how models generate descriptions of people when demographic cues are present in the context.
Beyond who is described and in what roles, language models can assign systematically different emotional valence to content involving different groups. A model may generate more positive completions for prompts involving one group and more negative completions for prompts involving another. Sentiment classifiers, which are themselves language models or language model derivatives, may rate text about certain groups as more negative even when the semantic content is comparable.
This pattern has been documented across multiple experimental paradigms. In one common approach, researchers present a model with nearly identical sentences that differ only in the demographic group mentioned: "People in [Group A] are generally..." versus "People in [Group B] are generally...". When the model's completion probabilities are compared, systematic differences in positive versus negative continuation emerge. Studies using the BOLD (Bias in Open-Ended Language Generation) dataset have found that completions about certain religious groups, ethnic groups, or genders are consistently more negative on average, even when the prompts are semantically equivalent.
A particularly well-studied case involves co-reference resolution and sentiment. When a story describes both a positive and a negative actor and a model is asked to resolve which pronoun refers to whom, models consistently make errors that align with demographic stereotypes: associating professional success with male referents and domestic roles or emotional distress with female referents. This is not a surface-level bias. It reflects learned associations embedded in the model's representations of identity and action at a deep, distributional level.
Sentiment bias also compounds across model components. If a sentiment classifier is trained on annotated text where certain dialects or writing styles were labeled as more negative, and a downstream generation model uses that classifier as a reward signal (as in RLHF), the generation model will learn to avoid producing text that sounds like those dialects or styles. This creates a hidden pathway through which annotation bias becomes generation bias, without any single step in the pipeline being explicitly discriminatory.
This form of bias is particularly consequential in applications like content moderation, customer service, and mental health support, where sentiment assessment plays a direct role in how users are treated. A mental health chatbot that responds with less empathy to certain phrasing styles, or a content moderation system that removes more speech from certain communities, is not a neutral tool. It is a tool that has absorbed and operationalized social inequities, delivering differential treatment to users based on how their communication style maps onto patterns in the training data.
To understand how bias enters a language model, it helps to trace the path from raw text to learned representation. The journey from a raw internet crawl to a model prediction involves multiple transformation steps, and bias can enter or be amplified at each one.
Language models learn from statistical patterns: which words appear near which other words. When a word like "aggressive" co-occurs more frequently with words associated with one demographic group than another, the model learns a higher-probability association between that group and that trait. This is not a flaw in the learning algorithm; it is exactly what the learning algorithm is supposed to do. The flaw lies in treating historically produced statistical patterns as objective truth about the groups being described.
Consider a large corpus of English-language newspaper articles. Such a corpus would associate:
- "Emotional" more often with women than men in professional contexts
- Criminal behavior more often with Black individuals than white individuals when reporting names and descriptions
- Technical expertise more often with men in articles about software engineering
None of these associations are accurate representations of reality, but they accurately reflect patterns in how certain newspapers have historically covered these topics. A language model trained on such data will reproduce these associations in its outputs. The model is not making a judgment; it is generalizing from its training distribution. But when that generalization is applied to new contexts, it carries the prejudices embedded in the historical distribution forward into present decisions.
The mechanism is worth understanding at a somewhat deeper level. Word embeddings and contextualized representations encode words as vectors in a high-dimensional space, where semantic proximity in the training data translates to proximity in embedding space. If "nurse" co-occurs frequently with "she," "care," and "gentle," and rarely with "he," "authority," and "leadership," then the embedding for "nurse" will be geometrically closer to the embeddings for "she," "care," and "gentle." When the model uses these embeddings to make predictions, that geometric proximity shapes the output distribution. The model is not reasoning about gender; it is traversing embedding space, and the space it is traversing was shaped by the statistical patterns of a biased corpus.
Beyond harmful associations, systematic underrepresentation creates a different kind of bias. When certain groups, languages, or perspectives appear rarely in training data, the model has weak, poorly calibrated representations of them. This causes the model to:
- Perform worse on tasks requiring knowledge about underrepresented groups
- Default to stereotyped or generic descriptions when asked about underrepresented subjects
- Conflate distinct subgroups, treating all members of a broad category as interchangeable
- Fail entirely on text from certain languages or dialects
Underrepresentation harms are often less visible than harmful associations, because the model's failure mode is absence rather than presence: the model does not say something offensive; it simply does not say much of anything accurate. A model asked to describe the history of Yoruba literature may generate something that sounds plausible but is factually impoverished, drawing on superficial patterns rather than deep knowledge. A user without independent expertise in Yoruba literature may have no way to know that the response is inadequate.
This invisibility makes underrepresentation particularly insidious. A model that outputs a slur is obviously broken. A model that responds to questions about Swahili literature with generic, inaccurate platitudes may appear to be working correctly to a user who lacks the background to evaluate its claims. The harm falls entirely on the user, who receives subtly misleading information without any signal that the model is operating outside its area of competence.
Underrepresentation also interacts with uncertainty calibration in important ways. A well-calibrated model should express lower confidence when it has less training evidence to draw from. In practice, many language models express similar surface-level confidence regardless of how much relevant training data existed. This means users cannot easily distinguish between the model's high-quality responses (where it has deep training coverage) and its low-quality responses (where it is essentially confabulating from indirect evidence). The burden of verifying accuracy falls on users, who are disproportionately harmed when they belong to underrepresented groups and may lack alternative sources of accurate information to compare against.
The path from the open internet to a training corpus involves many filtering decisions, each of which can introduce or amplify bias. Common Crawl data is typically filtered using quality signals such as perplexity relative to a reference language model or presence in curated lists of high-quality domains. Both of these signals systematically favor content that resembles text already produced by dominant groups. A perplexity filter trained on a reference model that embodies Western English writing conventions will filter out text that diverges from those conventions, including perfectly valid text from non-Western or non-standard English sources.
The implicit assumption in perplexity-based filtering is that low perplexity (relative to a reference model trained on "good" text) indicates quality. But "good" in this context means "resembles the reference model's training distribution," which is itself a biased sample. Text written in a non-native English style, text following non-Western rhetorical conventions, or text from communities that communicate differently from the reference model's training data will all receive higher perplexity scores and may be filtered out. The filter amplifies the demographic skew already present in the reference model's training data.
Deduplication, another common preprocessing step, can also introduce bias. When duplicate or near-duplicate text is removed, the relative frequencies of different content types change. If certain topics or perspectives appear in more duplicate forms (as in widely forwarded social media posts or syndicated news articles), deduplication will disproportionately reduce their representation. If community discussions about minority group experiences are more likely to spread virally in certain formats, deduplication may systematically trim those voices while leaving intact the original-content domains that dominant groups tend to control.
Domain and source selection adds another layer. Many curated datasets deliberately include text from Wikipedia, books, academic papers, and specific high-traffic websites. These sources are not demographically neutral. Wikipedia's gender gap in editorship is well-documented. Academic papers reflect the demographics and research priorities of academic institutions, which have their own historical biases. Books reflect publishing industry decisions about whose stories get told and whose receive the marketing resources to become widely read. Each source selection decision compounds the demographic and cultural skew already present in the internet crawl base.
One of the most important and counterintuitive phenomena in language model training is that models do not simply reproduce the biases in their training data: they amplify them. This amplification effect means that measuring bias at the data level substantially underestimates the bias in model outputs.
Consider a training corpus where 70% of sentences about doctors use male pronouns and 30% use female pronouns. You might expect a model trained on this data to assign roughly 70% probability to male pronouns when asked to complete a sentence about a doctor. In practice, studies have found that models often assign even higher probability to the majority pattern, sometimes exceeding 80% or 90%.
This happens because of how language models learn. The model does not learn the raw frequencies of individual co-occurrences; it learns to predict text in a way that minimizes loss across the entire training distribution. Features that are correlated with many different aspects of the training distribution get weighted more heavily. Gender associations for occupations are not just present in explicit occupation mentions; they are correlated with pronoun choice throughout discussions of those professions, with the names of people in those professions, with the settings and activities associated with those professions, and with the broader context in which those occupations appear. All of these correlated features reinforce the same direction in the model's learned representations, causing the association to emerge stronger than its raw frequency in training data would suggest.
To understand this more concretely, consider what gradient descent is optimizing during training. The model's weights are adjusted to maximize the probability of the observed text. When the model correctly predicts "he" after "the doctor finished", it receives a positive gradient update that strengthens every feature that pointed toward that prediction. Many features contribute: the word "doctor" itself, words in the surrounding context about hospitals and patients, prior pronouns in the document, and patterns about the grammatical role of possessive pronouns in sentences of this type. All of these features receive reinforcement for the masculine prediction simultaneously. In contrast, the relatively rare case where "she" follows "doctor" provides a weaker, less frequent gradient signal in the opposite direction. The net result, across billions of training examples, is that the feature weights end up more skewed than the raw token frequencies in the data would imply.
The chart below illustrates how this amplification evolves as a model processes more of its training data. Even when the underlying data frequency is constant, the model's predicted probability for the majority group increases over training, converging to a value noticeably higher than the raw data ratio.
Out[3]:
Visualization
The amplification effect has been empirically validated across a range of studies. Zhao et al. (2017) found that image captioning models amplified gender bias by a factor of roughly three in some occupation categories. Studies on text generation models have shown similar effects. The important practical implication is that debiasing the training data is not sufficient on its own: even a corpus with a mild imbalance can produce a model with a severe imbalance, because the amplification occurs during the learning process itself.
The pre-training and fine-tuning paradigm introduces multiple stages at which amplification can occur, and these stages interact in complex ways.
A pre-trained model already encodes biases from its training corpus. When this model is fine-tuned on a smaller, task-specific dataset, the fine-tuning process adjusts the model's weights to optimize for that task. If the fine-tuning data also contains biases (which it usually does), the model may combine pre-training biases with fine-tuning biases in ways that compound the problem. The pre-trained representations provide a strong prior, and the fine-tuning signal may reinforce existing biases if the fine-tuning task is correlated with the same demographic features.
Consider a sentiment analysis model fine-tuned on a customer review dataset. If positive reviews in the fine-tuning data happen to use writing styles associated with certain demographics (perhaps because the product being reviewed was marketed primarily to one group), the fine-tuned model will learn to associate that writing style with positive sentiment. This is separate from any pre-training bias; it is a new bias introduced at the fine-tuning stage. When both pre-training and fine-tuning biases point in the same direction, the compounding effect can be substantial.
RLHF adds yet another layer. Human raters provide feedback on model outputs, and the model is optimized to produce outputs that receive higher ratings. If raters systematically prefer outputs that conform to cultural stereotypes because those outputs "feel" more natural or accurate, the RLHF process will reinforce those stereotypes. Since rater populations are typically not representative of all user groups, this can create a systematic disadvantage for users whose preferences differ from those of the rater pool. The model learns to please the raters, not to serve all users equally.
The critical insight about multi-stage amplification is that each stage is a new opportunity for bias to enter or be amplified, and the effects compound multiplicatively rather than additively. A model with mild bias from pre-training, combined with mild bias from fine-tuning, combined with mild bias from RLHF, can end up with severe bias in its final deployed behavior. Audit the final deployed model, rather than auditing only the training data.
Once a biased model is deployed, it can create feedback loops that further entrench bias. If a biased model generates recommendations, those recommendations shape which content users see and engage with, which shapes what content gets produced, which potentially shapes what appears in future training data. These long-term feedback loops are difficult to measure and control but can substantially amplify the effect of initial biases over time.
A concrete example: a job matching system powered by a language model that associates certain occupations with certain genders will surface fewer job recommendations for women in stereotypically male-dominated fields. This reduces women's visibility and representation in those fields in the system's output data. If that output data is subsequently used as part of the next generation's training signal (a common practice in systems that use interaction data for model updates), the original association will be reinforced. The field's actual gender composition may be changing, but the model's representation of it will lag or even move in the wrong direction as the feedback loop takes hold.
Feedback loops are particularly dangerous in systems that shape high-stakes decisions at scale: hiring, lending, admissions, parole, and content recommendations. In each of these domains, the model's predictions influence real-world outcomes, those outcomes generate data that may flow back into model training, and the scale of deployment means that small biases compound into large societal effects over time. Understanding feedback dynamics is therefore not a theoretical exercise; it is a practical requirement for responsible deployment of large-scale language systems.
To make these concepts concrete, let's trace how a gender-occupation bias manifests in data and in model outputs, working through the mathematics explicitly.
Suppose we have a corpus of news articles, and we count how often each occupation co-occurs with gendered terms (pronouns, title words, names) within a window of 10 words.
We define the masculine co-occurrence ratio for an occupation as:
where:
- : the occupation word being measured (e.g., "doctor," "nurse")
- : the count of masculine-gendered terms co-occurring with in the corpus (e.g., "he," "him," "his," "Mr.")
- : the count of feminine-gendered terms co-occurring with (e.g., "she," "her," "Ms.")
- : values above 0.5 indicate masculine-leaning; values below indicate feminine-leaning
A ratio of exactly 0.5 represents equal masculine and feminine co-occurrence, which would be expected in an unbiased corpus if the actual population split for that occupation were 50/50.
For the occupation "doctor," suppose we find:
- Co-occurrences with masculine terms ("he," "him," "his," "Mr."): 4,200
- Co-occurrences with feminine terms ("she," "her," "hers," "Ms.," "Mrs."): 1,800
Applying the formula:
For the occupation "nurse," suppose we find:
- Masculine co-occurrences: 800
- Feminine co-occurrences: 3,600
The complement, , is the feminine co-occurrence ratio for "nurse."
These co-occurrence ratios appear directly in the training signal. But due to the amplification effects described above, a language model trained on this data may assign probabilities that exceed these ratios. When prompted with "The doctor examined the patient and then", the model might assign:
We can quantify the amplification by comparing the corpus odds ratio to the model's output odds ratio. In the corpus, the masculine-to-feminine odds for "doctor" are:
In the model's predictions, normalizing the gendered probabilities to sum to 1 (since ):
The amplification factor is:
This represents a 36% increase in the relative advantage assigned to masculine pronouns, above what the raw training data contained. Measuring bias at the data level alone is therefore insufficient. The model is a nonlinear function of its training data, and the biases it outputs cannot be fully predicted by counting co-occurrences in the corpus.
Let's implement a demonstration of these concepts: we'll build a small co-occurrence analysis to detect occupational gender bias, then examine how a pre-trained language model amplifies these signals in its masked predictions.
We start by installing and importing the libraries we'll need for this analysis.
In[4]:
Code
We'll construct a small synthetic corpus that reflects the kinds of gender-occupation associations found in real training data. This keeps the code self-contained while illustrating the core mechanics. The corpus is designed to mirror the co-occurrence ratios documented in large-scale NLP studies.
In[6]:
Code
Out[7]:
Console
We count how often each occupation word co-occurs with masculine and feminine pronouns within a sentence. The counting logic tokenizes each sentence and checks for intersection with our gendered term sets.
In[8]:
Code
Out[9]:
Console
The table above shows the raw co-occurrence ratios in our synthetic corpus. "Doctor" and "engineer" lean masculine, "nurse" leans feminine, and "teacher" and "professor" are near-neutral. These ratios mirror the patterns found in large-scale NLP studies on real corpora, where the same occupational gender skews appear at scale.
Out[10]:
Visualization
The chart reveals a clear pattern: occupations like "doctor" and "engineer" lean masculine in the training data, while "nurse" leans feminine. These are the raw signals that a language model will learn from during training. Importantly, these ratios do not necessarily reflect the actual gender composition of these professions today. They reflect the gender composition of how these professions were described in text, which is a product of who produced the text, when they produced it, and what narrative choices they made.
A heatmap view presents the same data differently, showing both the masculine and feminine counts side by side and making the imbalance within each occupation immediately visible.
Out[11]:
Visualization
Now let's see how a pre-trained BERT model handles these same occupations. We'll use masked language modeling to ask the model what pronoun it predicts when given an occupational context. This lets us directly compare the raw corpus ratios against the model's learned predictions.
In[12]:
Code
In[13]:
Code
Out[14]:
Console
The model's predictions show a distribution across masculine and feminine pronouns for each occupation. Comparing the model's output probabilities to the raw corpus co-occurrence ratios reveals the amplification effect: occupations that lean masculine in the data tend to lean even more masculine in model predictions, and vice versa. This is the core empirical signature of bias amplification.
Out[15]:
Visualization
The side-by-side comparison illustrates bias amplification directly: where the corpus data shows a moderate masculine lean, the model's predictions often show a more extreme lean. This is not an artifact of our synthetic corpus. The same pattern has been documented in studies using large-scale real corpora and production language models. Correcting bias in the data is necessary but not sufficient; the training dynamics themselves must be addressed.
The key variables in this analysis are:
- Co-occurrence window: We used sentence-level co-occurrence. Smaller windows (e.g., 5 words) capture tighter syntactic associations; larger windows capture broader topical associations.
- Gendered term set: We used pronouns and titles. Studies vary in whether they include first names, which introduces additional confounds because names shift in gender over time and across cultures.
- Model size and training data: Larger models trained on more diverse data tend to have different bias profiles than smaller models, though not necessarily less biased ones.
- Pronoun target set: We compare a fixed set of masculine and feminine pronouns directly. Expanding this set changes the conditional ratio and should be documented when results are compared across studies.
Understanding bias in language models is important, but it is also difficult. Several fundamental challenges complicate both measurement and mitigation, and it is worth examining these challenges carefully before moving to the practical tools covered in subsequent chapters.
The most basic difficulty is definitional: "bias" is not a value-neutral technical term. Defining what counts as biased behavior requires making normative judgments about what fair treatment looks like, how different groups should be represented, and which statistical associations are acceptable. These questions do not have purely technical answers. Different communities, different legal traditions, and different social contexts give different answers. A model that is "fair" by one definition may be "biased" by another.
When researchers operationalize fairness as mathematical criteria such as demographic parity, equalized odds, or calibration, they necessarily make choices that encode particular values. Demographic parity requires that the model produce the same distribution of outcomes for different groups, regardless of any real differences between groups. Equalized odds requires that the model make equally accurate predictions for each group, even if achieving this requires using different thresholds. These criteria can conflict: it is mathematically impossible, in general, to satisfy all common fairness criteria simultaneously (a result known as the "impossibility theorem of fairness"). The chapters ahead on Fairness Metrics will return to these tensions in detail.
There is a fundamental tension between individual and group fairness. Treating all individuals identically regardless of group membership (individual fairness) can perpetuate historical disadvantage if it ignores the real differences in how groups have been treated. Correcting for group-level imbalances (group fairness) can produce outcomes that feel unfair to individuals if done clumsily, because it requires using group membership as a factor in decisions that may otherwise feel like they should turn on individual merit alone.
These tensions are not solvable through better algorithms alone. They reflect real conflicts between different conceptions of justice that have been debated in philosophy and law for centuries. The language model practitioner who encounters these tensions is not discovering a new problem; they are confronting a very old problem in a new form. Acknowledging this does not mean giving up on fairness. It means approaching it with the intellectual honesty it deserves, being clear about what values are being encoded in technical choices, and being accountable to the communities most affected by those choices.
The impact of bias in language models is not confined to academic papers or benchmark scores. Deployed language models influence job recruitment, loan decisions, medical information delivery, legal advice, educational support, and political discourse. Each of these domains is one where systematic unfairness has direct consequences for real people.
A sentiment classifier that is more negative toward AAVE can cause content moderation systems to disproportionately flag and remove speech from Black communities, effectively silencing those communities on platforms where language models power moderation. A resume screening model that associates male names with competence can disadvantage women applicants even when the model never explicitly considers gender. A language model deployed as a medical assistant that has weak representations of health conditions affecting women or people of color can provide less accurate information to those users, exacerbating health disparities. These are not hypothetical risks. Studies documenting each of these phenomena have been published with data from deployed or near-deployed systems.
The cumulative effect of many small biases across many deployed systems is a society in which automated systems systematically advantage people who already enjoy advantages and disadvantage people who already face disadvantages. Language models, because of their breadth of deployment and their position as information intermediaries, have an outsized potential to either reinforce or disrupt these patterns. The choice of which direction they move in is, in part, a technical choice made by the people who build and deploy them.
The recognition of these harms has motivated significant investment in bias measurement and mitigation research, as well as policy and regulatory activity around algorithmic fairness. The EU AI Act classifies certain AI systems used in high-stakes domains such as employment, credit, and essential services as "high-risk" systems subject to mandatory conformity assessments, with explicit requirements to address discriminatory outcomes. Similar regulatory frameworks are emerging in other jurisdictions. Several US states have passed laws requiring audits of automated employment decision tools. In the UK, the Equality and Human Rights Commission has issued guidance on the application of equality law to algorithmic decision-making.
This regulatory environment means that the bias concepts introduced in this chapter are not merely academic: they have direct legal and business implications for organizations that deploy language models. A company using a language model to screen job applications may be liable under employment discrimination law if the system produces disparate impact on protected groups, regardless of whether the system was intentionally designed to discriminate. Understanding and documenting bias in deployed systems, and demonstrating that reasonable mitigation steps were taken, is becoming a legal and business requirement, rather than a best practice alone.
The next chapter on Bias Measurement will give you concrete tools to quantify the forms of bias introduced here. Understanding how to measure bias precisely is the necessary precondition for evaluating whether mitigation strategies are working and for making credible claims about model fairness in deployment.
This chapter introduced bias in language models as a systematic, measurable phenomenon with real-world consequences.
Key takeaways:
- Bias has multiple sources: Training data bias, annotation bias, historical and societal bias, and training process bias all contribute. No single source is solely responsible, and each requires different interventions.
- Bias types vary: Demographic bias (gender, race, age), cultural bias (Western-centric defaults), occupational stereotyping, and affect bias each manifest differently and require different measurement approaches.
- Training data encodes patterns, not truth: Co-occurrence statistics in text reflect who produces text and how they describe the world, not objective reality. Historical data especially encodes historical injustice as statistical regularity.
- Bias amplification is real and substantial: Language models do not passively reproduce the biases in training data. Due to correlated feature reinforcement during gradient descent, they amplify those biases, sometimes by factors of 30-40% above the data ratio. Debiasing data is necessary but not sufficient.
- Multi-stage pipelines compound bias: Pre-training, fine-tuning, and RLHF each introduce new opportunities for bias to enter or be amplified. The deployed model's bias is the product of all stages combined.
- Definitions of fairness are contested: There is no single technical definition of "unbiased" that is universally accepted. Addressing bias requires engaging with normative questions that go beyond model architecture.
- The stakes are high: Biased language models affect real decisions in hiring, healthcare, law, and education. Regulatory frameworks are increasingly treating algorithmic fairness as a legal requirement, rather than only an ethical aspiration.
With these foundations established, the next chapter will introduce the quantitative tools used to detect and measure bias, including embedding association tests, generation bias metrics, and benchmark datasets designed specifically for bias evaluation.
Ready to test your understanding? Take this quick quiz to reinforce what you've learned about bias in language models.
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.