Gender prediction
How gender prediction from names works: datasets vs AI
Learn how gender prediction from names works: dataset frequency lookups, AI inference, first-name extraction from full names, confidence scores and unknowns.

Gender prediction from names sounds like magic until you see how it works: for most names, it is a frequency lookup against records of how a name has been used. When the data runs out, a model can make an educated guess, and a good API tells you exactly which of the two answered. This post explains both approaches, how a first name is pulled out of a full name, and how to read confidence and unknown results.
What a gender prediction actually is
Before the mechanics, a definition. A gender prediction is a statistical estimate of how a name is typically used. It is not a statement about how any individual identifies, and it will be wrong for some people.
That framing drives everything else in this post. It explains why the result comes with a confidence value, why "unknown" is a normal answer, and why the output belongs in aggregate analytics and low-stakes personalization rather than in decisions about people. We return to responsible use near the end.
Approach 1: dataset frequency lookups
The classic approach is simple. Collect a large number of records where a first name appears alongside a gender, then count. If a name appears 2,570 times and nearly all of those records are female, the name leans female with high confidence.
What the response looks like
Here is a lookup with Finowl's gender API:
curl -X POST https://api.finowl.co/v1/gender/name \
-H "Authorization: Bearer $FINOWL_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Jane Smith", "country": "US" }'{
"data": {
"result_status": "identified",
"gender": "female",
"confidence": 0.98,
"confidence_kind": "observed_frequency",
"sample_count": 2570,
"name": "jane",
"country": "US",
"source": "dataset",
"reason": null
}
}Three fields tell you this answer came from data rather than a model:
sourceis"dataset".confidence_kindis"observed_frequency", meaning the confidence reflects the share of observed records with that gender.sample_countis the number of records behind the estimate.
Why frequency lookups work well
Frequency data is transparent. A confidence of 0.98 backed by thousands of samples means something concrete: in the data, the name is used overwhelmingly for one gender. You can set thresholds on both numbers, for example "only use the prediction when confidence is at least 0.9 and sample_count is at least 50."
Where they fall short
Datasets have gaps. Rare names, new names, unusual spellings and transliterations may have few or no records. Some names are genuinely mixed and never cross a useful threshold. And usage varies by country, which is why Finowl accepts an optional country hint. Names like Andrea, Jean and Kim lean differently depending on where they are used; we cover that in country hints for gender prediction.
Approach 2: AI inference
The second approach uses a language model to infer a likely gender from a name or handle. A model can reason about things a frequency table cannot: a spelling variant of a known name, a diminutive, or a name embedded in a nickname.
How Finowl combines the two
Finowl does not force you to choose. The options.ai_mode setting controls how AI is used:
ai_mode |
Behavior | Default for |
|---|---|---|
fallback |
Dataset first, AI only if the dataset has no answer | Single lookups |
off |
Dataset only | Batch items |
always |
Always use AI | Never the default |
With fallback, a common name like Jane is answered from the dataset, and AI only steps in when the dataset cannot answer. If you want dataset answers only, for example to keep every result backed by a sample count, set ai_mode to off:
curl -X POST https://api.finowl.co/v1/gender/name \
-H "Authorization: Bearer $FINOWL_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Jane Smith", "options": { "ai_mode": "off" } }'Reading an AI result
When AI provides the answer, the response says so:
sourceis"ai".confidence_kindis"model_reported", meaning the confidence is the model's own estimate rather than an observed frequency.sample_countisnull, because no records were counted.
Treat model-reported confidence as a softer signal than observed frequency. It is useful, but it is not a count of anything, so you may want a stricter threshold or a separate code path for AI answers. The AI mode guide covers the options in more detail.
Cost
A standard lookup costs 1 credit. A lookup that requests AI with ai_mode: "always" or forceToGenderize: true costs 3 credits. With the default fallback mode you request a dataset answer first, so plan your budget around the mode you actually choose.
First-name extraction from full names
Most systems do not store a clean first-name field. You have "Jane Smith", or "jane smith", or a single "Full name" input. Gender prediction works on the given name, so the first step is finding it.
What Finowl does
You can send a full name, and Finowl finds the name candidate to look up. In the example above, "Jane Smith" produced "name": "jane" in the response: the given name, normalized to lowercase. That name field always tells you which part of your input was used, which is useful for debugging surprising results.
When there is no usable candidate
Sometimes the input has nothing that looks like a name. In that case the response is result_status: "unknown" with reason: "no_name_candidate". That is a signal about your input data, not a failure of the lookup.
Tips for cleaner input
- If you already have a separate first-name field, send that instead of the full name.
- Strip obvious non-name content, such as company names placed in a name field.
- Keep values within the 254-character limit.
- Log the returned
namenext to your input during testing so you can see what was matched.
Confidence: what the number means
confidence is a value between 0 and 1. How you read it depends on confidence_kind:
observed_frequency: the share of observed records with the predicted gender, backed bysample_countrecords. A 0.98 with 2,570 samples is strong. A 0.98 with 4 samples is not.model_reported: the model's own estimate. No sample count is available.
A practical policy for personalization might look like this in Python:
import os
import requests
def predict_gender(full_name, country=None):
body = {"name": full_name}
if country:
body["country"] = country
res = requests.post(
"https://api.finowl.co/v1/gender/name",
headers={"Authorization": f"Bearer {os.environ['FINOWL_API_KEY']}"},
json=body,
timeout=10,
)
res.raise_for_status()
data = res.json()["data"]
if data["result_status"] != "identified":
return None
if data["confidence_kind"] == "observed_frequency":
if data["confidence"] >= 0.9 and (data["sample_count"] or 0) >= 50:
return data["gender"]
return None
# model_reported: hold AI answers to a stricter bar
return data["gender"] if data["confidence"] >= 0.95 else None
print(predict_gender("Jane Smith", "US"))The thresholds are examples. Pick values that match how costly a wrong guess is in your use case, and lean toward returning nothing. For a deeper look, see confidence scores and unknown results.
Unknown results are normal
Not every name has an answer, and that is fine. An unknown result has result_status: "unknown", gender: null, and a reason:
reason |
What it means |
|---|---|
not_found |
The name has no usable data |
no_name_candidate |
No name could be found in the input |
ambiguous |
The name is used for more than one gender without a clear lean |
insufficient_evidence |
Some data exists, but not enough to be confident |
An unknown is a successful lookup and is charged like any other. Design for it from the start: your fallback should be a neutral experience, such as a greeting that uses the name with no gendered language, not an error.
Responsible use
Because a prediction estimates how a name is typically used, it will be wrong for some people, including people whose gender differs from the statistical lean of their name. Follow a few rules:
- Use predictions for aggregate analytics and low-stakes personalization only.
- Never use them for eligibility, pricing, access or any decision with significant effects on a person.
- Let people state or correct their own gender, and always prefer what they tell you over a prediction.
- Names are personal data, so mention gender lookups in your privacy notice.
The interpreting predictions guide has more on reading results safely.
Frequently asked questions
Does gender prediction use the last name?
Prediction is based on the given name. When you send a full name, Finowl finds the name candidate and returns it in the name field, so you can see exactly what was used.
How can I tell whether a result came from AI?
Check source. Dataset answers have source: "dataset" and confidence_kind: "observed_frequency" with a sample_count. AI answers have source: "ai", confidence_kind: "model_reported" and sample_count: null.
Am I charged for unknown results?
Yes. An unknown result is a normal, successful lookup, so it costs the same as an identified one. Requests rejected before running, such as a 400 for invalid input, are free.
Should I always turn on AI mode?
Usually not. The default fallback mode answers from the dataset when it can. Use ai_mode: "always" only when you specifically want a model answer, since it costs 3 credits per lookup.


