Predicting Gender from Digital Traces: Methods, Accuracy and Ethics
How models infer gender from names, text and faces, why average accuracy hides group errors and when not to predict
Key takeaways
Which method you can use depends on two questions: do you have data about the person, and do you have labeled training data? The answers give four corners, from an honest "we don't know" to supervised learning.
When you know nothing about an individual, the best guess is the base rate of the population they belong to, and the base rate pulls predictions toward it far more strongly than intuition suggests.
In the Gender Shades study, three commercial face classifiers misclassified lighter-skinned men less than 1% of the time but darker-skinned women between 20.8% and 34.7% of the time. Always report accuracy by group, not only on average.
Most models assume gender is binary, fixed and readable from the body. That erases trans and non-binary people, and gender identity is something a person states, not something a camera reads.
The first step of any such project is "step 0": does the decision really need a predicted gender? Often a direct signal, a neutral form of address or simply asking the user works better and carries less risk.
Every day, billions of people leave traces online without ever stating who they are: a username, a few clicks, a product they looked at, a sentence typed into a forum. Many organizations would like to turn those traces into basic demographic facts about the person behind them, and gender is usually the first on the list. Advertisers want it for targeting, platforms for personalization, researchers for social statistics and investigators for narrowing down suspects. Commercial tools sell gender inference from names, from writing style and from photographs of faces.
Technically, this is one of the most familiar problems in data science: a classification task with a target label and some features. Socially, it is one of the most contested. A model that is accurate on average can be wrong for a third of one group of people. A prediction can be correct and still feel like surveillance to the person it describes. And the very label the model is asked to predict assumes that every person fits into one of two boxes, which is not true for everyone.
That combination makes gender prediction an excellent case study. It is simple enough to show clearly how the choice of method follows from the data you have. It shows how a model that is "accurate on average" can fail a specific group badly. And it forces a question that technical work often skips: should we be doing this at all?
The article has seven sections. Section 1 describes the practical needs that make organizations want to predict gender. Section 2 presents a four-corner matrix for choosing a method based on available data, with a worked example on base rates. Section 3 proposes a workflow that starts with the question "is this needed?". Section 4 discusses evaluating models group by group, using the Gender Shades study. Section 5 sorts applications into three levels of risk, Section 6 examines four ethical problems and Section 7 summarizes the principles that data protection and AI rules apply to this kind of inference.
1. Why do organizations want to "predict" gender?
This section clarifies what prediction means here and lists the needs that drive it, because those needs differ greatly in how much harm a wrong answer can do.
The word "predict" needs a precise meaning first. The goal is to infer gender when this information is not known. It is not a matter of counting data that already exists; it is an attempt to guess from digital traces. The need arises when an organization wants to see past anonymity for a specific purpose. Four fields are typical.
E-commerce. A brand-new visitor lands on an online store for the first time. The system wants to decide immediately which banner to show on the home page: a men's fashion collection or a cosmetics promotion. The hope is that a correct guess raises the click-through rate from the very first seconds.
Security and investigation. Investigators follow a person known only through anonymous forum accounts. Predicting gender from writing style, hours of activity and topics of interest is expected to narrow the pool of suspects.
Health and public health. Researchers analyze millions of anonymous posts on mental health forums. Estimating the gender of the writers lets them ask whether men and women express symptoms of depression or anxiety differently in language, so that community interventions can be designed better.
Social sciences and humanities. A historian analyzes thousands of unsigned letters or anonymous works from a century ago. Estimating the authors' gender helps recover the voices of women in periods when they were rarely recorded officially.
Other needs come up as well: a chatbot that wants to choose a gendered form of address (many languages have no neutral way to say "you" politely, and even English has "Sir" and "Madam"), an audit that checks whether a hiring process is biased by gender, or filling in a missing gender column in a large dataset.
Read the list carefully and it is clear that these needs differ enormously in risk. Estimating the share of women authors in a collection of nineteenth-century letters harms almost no one. Using writing style to "profile" a specific suspect can lead to wrongful accusation. Section 5 returns to classify them by risk. First, it is necessary to understand how the methods work.
2. A method matrix: which tool for which data?
This section shows that the right method is set by the data you have, and that even the simplest corner carries a lesson about bias.
The approach depends on two questions: (1) do we have data about the person whose gender we want to predict? and (2) do we have training data that is already labeled? Two yes/no questions produce a matrix with four corners, each corresponding to its own strategy, as in Figure 1.
2.1. Corners 1 and 2: when you know nothing about the individual
Corner 1 is the situation of starting from zero: nothing is known about the person and there is no historical data. The reasoning rests on an uninformative prior: predict 50% male and 50% female, as an honest admission that you do not know. In practice you could use the population share for a country, but in most countries that is close to half and half, so the result is nearly the same.
Corner 2 is more interesting. We know nothing about the current user, but we do have data about the population the user belongs to. Take a gaming forum where 85% of users are men. When a new user arrives who has not done anything yet, the best default prediction is an 85% chance of being male. That prediction is better grounded than 50/50, because it reflects the specific population.
Corners 1 and 2 illustrate an important idea in statistics: when you know nothing about an individual, the best prediction is the base rate of the population they belong to. But which population's base rate depends on context. A model trained on a gaming forum and then deployed on a parenting forum will carry the wrong base rate with it and will be wrong in a systematic way. This is one of the most common forms of bias when a model is moved from one setting to another.
2.2. Corner 3: expert rules and clustering
In corner 3 we have information about the person (text, a name, behavior) but no large labeled dataset to "teach" a machine. There are two ways to proceed.
A rule-based system relies on hard rules set by an expert. Inferring gender from first names is the most widespread example worldwide: a lookup table says that "John" is male and "Mary" is female. Vietnamese names offer a particularly clear illustration of how such rules age. For generations, the middle name Văn marked a man and Thị marked a woman, so the rule "middle name Văn means male, Thị means female" worked for many people of older generations. But more and more parents now choose middle names without these markers (Minh Anh, Bảo Ngọc, Gia Huy), and many given names are used for both genders (Anh, Linh, Khánh, Hải). The rule therefore applies to fewer people and fails more often for younger ones. The same pattern appears in any language with unisex names such as Alex, Jordan or Andrea, whose gender varies even between countries. A rule that "fails more for one group" is also a form of bias, even though no one intended to create it.
Unsupervised learning asks the machine to cluster users with similar behavior, after which people analyze the clusters to see whether they correlate with gender and then "label" each cluster. This is more flexible than a hard rule, but nothing guarantees that the clusters correspond to gender. The machine may well group users by age, income or the hours they are online, and naming one cluster "women" and another "men" may simply project the analyst's own stereotypes onto the result.
2.3. Corner 4: supervised learning and a worked example
Corner 4 is the ideal scenario of modern machine learning, where supervised learning models show their strength. The model learns the relationship between input features and the gender label directly from a large dataset. Three examples are typical: a convolutional neural network (CNN) trained on millions of labeled face images; a random forest trained on purchase histories that predicts a new user's gender from the products they view; and multimodal models that combine images, voice, text and behavior.
To see how corners 2 and 4 connect, consider a simple worked example with illustrative numbers. Return to the gaming forum with a base rate of 85% men. Suppose the training data show that some signal, for example joining a particular topic group, appears for 30% of women users but only 10% of men users. A new user has just joined that group. What is the probability that this user is a man?
Table 1 applies Bayes' theorem with 1,000 hypothetical users.
Table 1 shows two things. First, a signal that is "three times as common among women" only moves the probability of being a woman from 15% to about 35%. The user is still more likely to be a man. This is what intuition usually misses: the base rate pulls the result strongly toward itself, and a signal that sounds impressive may not be enough to change the conclusion. Second, if the system labeled everyone with this signal as "woman", it would be wrong for almost two thirds of the people it labeled (85 of 130).
Supervised models in effect perform the same calculation with hundreds or thousands of signals at once. Their overall accuracy can be very high. But as Section 4 will show, "accurate on average" can hide very large errors for particular groups.
Table 2 summarizes the four corners with the main strength and the main risk of each.
Choosing a method is only half the job. The other half is the deployment workflow, and that is where the ethical question needs to be asked as early as possible.
3. A deployment workflow that starts with "is this needed?"
This section adds a step before the usual data science pipeline, because the most effective way to avoid harm is often not to build the model.
A professional project would typically follow six steps: define the problem and collect data, explore the data, preprocess and extract features, choose and train a model, evaluate, then deploy and monitor. The version here adds a step 0 in front of everything else, as in Figure 2.
Table 3 lists each step with a checking question.
Step 0 is the step most often skipped, and it is usually the most important. The reason is that in many cases gender is only a crude proxy for what the business actually needs to know. An online store does not really need to know whether a customer is a man or a woman; it needs to know what products the customer is interested in. That information is already in the browsing behavior: someone who has just looked at three lipsticks should be shown lipstick, whatever their gender. Using what you need to know directly is more accurate, less risky and avoids putting users in boxes.
Similarly, a bank's chatbot does not need to guess whether to say "Sir" or "Madam". It can use a neutral form of address, or ask on first contact how the user would like to be addressed and remember the answer. Both approaches respect the user more than a model that guesses wrong for a third of one group of people.
If, after step 0, there is still a legitimate reason to predict, then step 5, evaluation, is where special care is needed. The next section explains why.
4. Evaluating the model: accurate for whom?
This section uses one landmark study to show why a single accuracy number is never enough.
In 2018, Joy Buolamwini and Timnit Gebru published the Gender Shades study. They tested three commercial systems that classify gender from faces, from Microsoft, IBM and Face++, on a new benchmark of 1,270 photographs of members of parliament from three African countries (Rwanda, Senegal and South Africa) and three European countries (Iceland, Finland and Sweden), chosen to balance gender and skin type (Buolamwini & Gebru, 2018). Their results appear in Figure 3.

Figure 3 shows a very large gap. For lighter-skinned men, all three systems almost never erred, with error rates below 1%. For darker-skinned women, the error rate reached 20.8% for Microsoft and 34.5% and 34.7% for Face++ and IBM, so roughly one in three women in that group was misclassified. Yet the overall accuracy of these systems looked good, between 87.9% and 93.7% on the same benchmark. The two face datasets widely used as benchmarks at the time, IJB-A and Adience, were 79.6% and 86.2% lighter-skinned, so testing on them would have hidden the problem.
It is worth noting what the study itself acknowledged. All three products returned only the binary labels female and male, and the authors described this as a reductionist view that does not address transgender identities; they labeled the benchmark faces by whether subjects were perceived as women or men. Even the best-known audit of gender classifiers had to work inside the binary frame that the products imposed.
After the study was published, the companies improved their systems. A follow-up audit found that the error rate for darker-skinned women fell by between 17.7 and 30.4 percentage points across the audited companies, while two companies that had not been named in the first study still showed error rates of 31.37% and 22.50% for that group (Raji & Buolamwini, 2019). The lesson of Gender Shades is therefore not tied to one company or one year. It applies to every classification model and is summarized in Table 4.
The principle that follows: never report a single overall accuracy figure without a table of accuracy by group. Which groups matter depends on the setting. They can be age groups (as in the name example in Section 2.2), regions and accents, ethnic groups, or urban versus rural users. A voice model trained mainly on speakers from a country's largest cities may perform noticeably worse on regional accents, and only a table by group will reveal it.
Which group bears the largest error is a technical question. What harm that error causes is a question about the application, and the answer depends on what the model is used for.
5. Which applications are acceptable and which are not?
This section sorts the uses of gender prediction by risk, because the same error rate means very different things in a statistic and in a decision about one person.
Gender prediction has many applications, spread across commerce and customer service; security, finance and human resources; data science, health and social research; and entertainment and connected devices. A list by sector shows how wide the problem reaches. But through the lens of Section 4, a more useful way to sort them is by level of risk: on whom the model's errors will fall and with what consequences. Table 5 arranges the applications into three levels.
Two examples in Table 5 deserve more explanation.
The fraud alert example. The idea is that if a cardholder is predicted to be an older man while new transactions show "signs" of a young woman, the transaction should be flagged as high-priority fraud. It sounds plausible, but a transaction with "female signs" on a man's card may simply be a spouse, a child or a colleague asked to make the purchase, or the cardholder buying a gift. As Table 1 showed, behavioral signals are usually weaker than our intuition. Using predicted gender as a fraud signal is both inaccurate and unfairly annoying for customers. Good fraud systems rely on much more direct signals: an unknown device, an unusual location, a sequence of small card-testing transactions.
The smart home example. Imagine a smart refrigerator that guesses who is opening it in order to remind "the husband" that the beer is running out and "the wife" that the yogurt is about to expire. It illustrates exactly what Section 6 warns about: the system not only guesses gender but also assigns each gender a stereotyped set of preferences. A household device can recognize each family member through an account they register themselves, with no need to guess anyone's gender.
The general principle from Table 5: the closer the prediction comes to a decision about a specific individual, the greater the risk. At group level, a 10% error rate makes a statistic slightly less precise. At individual level, the same 10% means that one person in ten is treated wrongly.
6. Four ethical problems
This section sets out four problems that anyone working on this task cannot avoid, with the evidence and academic debate behind them.
First, reinforcing gender stereotypes. A model learns from past data, so it also learns the stereotypes already present in society: "men like sports and technology; women like shopping and cosmetics". When the results are used for personalization, the system automatically puts users into those boxes. A woman who loves technology sees fewer laptop ads; a man who loves cooking is shown fewer kitchen tools. Future behavioral data, already steered by the system, then confirm the stereotype, creating a self-reinforcing loop.
Second, invading privacy. Quietly analyzing behavior to infer a personal characteristic is a form of processing personal data, even if the user never disclosed that characteristic. The problem is more serious when the user does not know or has not agreed. A prediction can be accurate and still be an intrusion: precisely because it is accurate, the user feels watched.
Third, erasing gender diversity. This may be the most serious problem. Most models are built on a male/female binary and infer gender from appearance or voice. This approach erases the existence and experience of transgender people, non-binary people and other gender-diverse communities. Keyes (2018), in an analysis of research on "automatic gender recognition", showed that almost all of this research treats gender as binary, immutable and physiologically readable. For trans people, the consequence is being systematically misgendered by machines, an experience that hurts and that makes them feel invisible to the technology around them. Gender identity is something a person states about themselves, not something that can be read from a face.
Fourth, misuse and discrimination. Predicted information can be used to discriminate in hiring, in job and housing advertising and in financial services, or even to harass people online. Once a predicted gender label has been created and stored, it can be used for purposes far from the original one.
These four problems are not only matters of professional ethics. In many jurisdictions they have already been written into law.
7. What data protection and AI rules expect
This section summarizes the principles that modern data protection and AI rules apply to inferring personal characteristics, so that data teams know which questions to ask at step 1.
Data scientists do not need to be lawyers, but they need to know enough to ask the right questions at the start of a project. Two pieces of European law have become reference points far beyond Europe: the General Data Protection Regulation (GDPR) and the EU Artificial Intelligence Act. Many national data protection laws follow similar principles.
Under GDPR-style data protection rules, an inferred characteristic is generally treated as personal data in its own right, so deriving gender from behavior counts as processing personal data even when no one typed it in (European Parliament & Council of the European Union, 2016). Processing needs a lawful basis, often the consent of the person concerned, and must serve a specified purpose that people are told about. Only data necessary for that purpose should be collected (data minimization), and data collected for one purpose should not quietly be reused for another (purpose limitation). People have the right to object to profiling for direct marketing and the right not to be subject to decisions based solely on automated processing that significantly affect them, such as credit or hiring decisions. Biometric data used to identify a person, such as a face template, belongs to the special categories of data that receive the strongest protection.
Under the EU AI Act, biometric categorization systems that infer certain sensitive attributes, such as race, political opinions, trade union membership, religious or philosophical beliefs, sex life or sexual orientation, are prohibited. Biometric categorization according to other sensitive or protected attributes is classified as high-risk and must meet strict requirements on data quality, transparency and human oversight (European Parliament & Council of the European Union, 2024). In practice, a system that infers gender from faces or voices falls squarely within the scope of these rules, and any organization offering services to people in the European Union needs to take them into account.
What these frameworks have in common is that they require data teams to answer three questions before building a model: what is the purpose, do the people concerned know about it and is there a less intrusive way to achieve the goal? That is exactly step 0 in Figure 2.
Conclusion
Predicting gender is a small problem that shows both the power and the traps of data science. On the side of power, it shows how patterns can be found in scattered digital traces, and the four-corner matrix is a good tool for choosing a method based on the data at hand. On the side of traps, it shows that a model can be accurate on average and still wrong a third of the time for one group of people, that a signal that sounds strong can be weaker than we think and that a correct prediction can still cause harm.
So this is not only a technical problem of maximizing accuracy. It is an economic, social and technical problem at once. The responsibility of developers, businesses and managers does not end with building a model that works; it starts with the question "should we do this, and if so, how do we minimize the harm?"
That question applies to every attempt to infer personal characteristics, from age, income and marital status to health. The final goal is not for a machine to attach a label to each of us, but to build a digital space that is fair and transparent, where every identity is recognized, respected and protected.
References
Buolamwini, J., & Gebru, T. (2018). Gender shades: Intersectional accuracy disparities in commercial gender classification. Proceedings of Machine Learning Research, 81, 77–91. https://proceedings.mlr.press/v81/buolamwini18a.html
European Parliament & Council of the European Union. (2016). Regulation (EU) 2016/679 on the protection of natural persons with regard to the processing of personal data and on the free movement of such data (General Data Protection Regulation). https://eur-lex.europa.eu/eli/reg/2016/679/oj
European Parliament & Council of the European Union. (2024). Regulation (EU) 2024/1689 laying down harmonised rules on artificial intelligence (Artificial Intelligence Act). https://eur-lex.europa.eu/eli/reg/2024/1689/oj
Keyes, O. (2018). The misgendering machines: Trans/HCI implications of automatic gender recognition. Proceedings of the ACM on Human-Computer Interaction, 2(CSCW), Article 88. https://doi.org/10.1145/3274357
Raji, I. D., & Buolamwini, J. (2019). Actionable auditing: Investigating the impact of publicly naming biased performance results of commercial AI products. In Proceedings of the 2019 AAAI/ACM Conference on AI, Ethics, and Society (pp. 429–435). Association for Computing Machinery. https://doi.org/10.1145/3306618.3314244




Discussion about this post