๐ฎ๐ณ Llama-3 Indian Name Gender Classifier
๐ Model Description
This is a fine-tuned version of the Llama-3-8B model, specifically optimized to classify the gender of Indian Names into three categories: Male, Female, and Neutral.
The model was trained using Unsloth for efficient 4-bit fine-tuning and has been exported in multiple formats to support both production (Python/GPU) and local (CPU/Laptop) environments.
๐ ๏ธ Source Code
The training code and notebooks are available on GitHub:
Key Features
- High Precision for Females: The model achieves 100% precision on female names in validation tests.
- Regional Awareness: Trained specifically on Indian linguistic patterns.
- Multi-Format: Available as LoRA adapters, Merged 16-bit weights, and GGUF.
๐ Repository Structure
This repository is organized into three specific folders to keep files clean. Please select the folder that matches your use case:
| Folder | Format | Use Case |
|---|---|---|
/Merged |
SafeTensors (16-bit) | Best for Python, vLLM, and Production APIs. This is the standalone model with weights baked in. |
/GGUF |
GGUF (q4_k_m) | Best for Ollama, LM Studio, and Local CPU Inference. |
/LoRA |
LoRA Adapters | Best for Research, Unsloth, and PEFT loading. Contains only the fine-tuned difference. |
๐ Evaluation & Performance
The model was evaluated on a held-out test set of 59 diverse Indian names, including difficult unisex/neutral examples.
Summary Metrics
| Metric | Score | Interpretation |
|---|---|---|
| Accuracy | 86.44% | Overall correctness across all categories. |
| F1-Score | 0.8355 | Weighted score balancing precision and recall. |
Detailed Breakdown
| Category | Precision | Recall | F1-Score | Analysis |
|---|---|---|---|---|
| Male | 0.76 | 1.00 | 0.87 | Catches all males, but sometimes over-predicts male for neutral names. |
| Female | 1.00 | 0.96 | 0.98 | Extremely reliable. If it says "Female", it is almost certainly correct. |
| Neutral | 1.00 | 0.22 | 0.36 | Struggles with ambiguity; often defaults to "Male". |
โ ๏ธ Known Limitations & Bias
- Male Defaulting: The model has a strong bias to classify ambiguous or neutral names as Male.
- Failed Examples:
Kiran,Sonu,Suman,Gurpreet(Predicted: Male).
- Failed Examples:
- Specific Mismatches: The name
Simranwas incorrectly predicted asMalein our validation set. - Scope: This model is strictly for Indian names and may not perform accurately on Western or East Asian names.
๐ How to Use
1. Python (Transformers) - Recommended
Use this method if you are running a script or a web server. Note: You must specify subfolder="Merged".
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
# 1. Load from the 'Merged' folder
model_id = "shisha-07/Llama-3-Indian-Gender-Classifier"
tokenizer = AutoTokenizer.from_pretrained(model_id, subfolder="Merged")
model = AutoModelForCausalLM.from_pretrained(
model_id,
subfolder="Merged",
device_map="auto",
torch_dtype=torch.float16
)
# 2. Define the Prompt (Alpaca Format)
prompt_template = """### Instruction:
Identify the gender of the given Indian name.
### Input:
{}
### Response:
"""
# 3. Run Inference
name = "Ananya"
inputs = tokenizer(prompt_template.format(name), return_tensors="pt").to("cuda")
output = model.generate(**inputs, max_new_tokens=10)
print(tokenizer.decode(output[0], skip_special_tokens=True))
# Output: Female
2. GGUF (Ollama / Local) -
Download the .gguf file from the GGUF Folder.
- CLI Command:
./llama-cli -m llama-3-indian-gender.Q4_K_M.gguf -p "### Instruction: Identify the gender. ### Input: Rajesh ### Response:"
- Ollama: Create a Modelfile with the following content:
FROM ./llama-3-indian-gender.Q4_K_M.gguf
TEMPLATE """### Instruction:
Identify the gender of the given Indian name.
### Input:
{{ .Prompt }}
### Response:
"""
3. LoRA Adapters (Unsloth) -
Use this if you want to load the adapters on top of the base Llama-3 model dynamically.
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "shisha-07/Llama-3-Indian-Gender-Classifier",
subfolder = "LoRA", # Specific folder for adapters
load_in_4bit = True,
)
FastLanguageModel.for_inference(model)
# ... Run inference as usual
๐ ๏ธ Training Details
Base Architecture: Llama-3-8B-bnb-4bit
Fine-Tuning Method: QLoRA (via Unsloth)
Dataset: Custom dataset of Indian names labeled by gender.
Infrastructure: Trained on Tesla T4 GPU (Google Colab)
๐ License
Apache-2.0
- Downloads last month
- 166
4-bit
Model tree for shisha-07/Llama-3-Indian-Gender-Classifier
Base model
meta-llama/Meta-Llama-3-8BDataset used to train shisha-07/Llama-3-Indian-Gender-Classifier
Evaluation results
- accuracy on shisha-07/Indian_Names_with_Gender_Datasetself-reported0.864
- f1 on shisha-07/Indian_Names_with_Gender_Datasetself-reported0.836
