shisha-07/Llama-3-Indian-Gender-Classifier
๐ฎ๐ณ 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:
๐ Evaluation & Performance
The model was evaluated on a held-out test set of 59 diverse Indian names, including difficult unisex/neutral examples.
Summary Metrics
Detailed Breakdown
โ ๏ธ 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). - 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: Female2. GGUF (Ollama / Local) -
Download the .gguf file from the [`GGUF`](./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
