π¦ Llama-3 8B Fine-Tuned Gender Classifier (Indian Names)
This model is a high-performance, fine-tuned version of Meta Llama-3-8B, specifically trained to identify the gender of Indian names based on linguistic patterns and cultural naming conventions. It achieves clean, classification-ready output using Supervised Fine-Tuning (SFT).
π Model Description
Architecture: Llama-3-8B (Fine-tuned with Unsloth & PEFT/LoRA)
Primary Task: Binary Gender Classification
Dataset Source: Kaggle: Indian Names Dataset
Training Labels:
β
0: Maleβ
1: Female
π How to Use
Recommended Prompt Template
To get the most accurate results, you must use this exact template:
### Instruction:
Identify the gender of the given Indian name.
### Input:
{name}
### Response:
π§βπ» Inference Code( Python )
To try the model, feel free to use the below code:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "Shi-07/Llama3_8b-FineTuned-Gender_Classifier_by_Name"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
def predict_gender(name):
prompt = f"### Instruction:\nIdentify the gender of the given Indian name.\n\n### Input:\n{name}\n\n### Response:\n"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=2, do_sample=False)
return tokenizer.decode(outputs[0], skip_special_tokens=True).split("### Response:")[-1].strip()
# Test run
print(predict_gender("Rahul")) # Output: male
print(predict_gender("Priya")) # Output: female
β οΈ Known Limitations & Biases
Binary Training: The model was trained strictly on Male (0) and Female (1) labels.
Neutral Names: If you provide a neutral name (e.g., Satya, Surya, Bala), the model will force a binary decision. Due to the training distribution, it typically defaults to male for neutral inputs.
Out-of-Scope: This model is specialized for Indian names. Its performance on Western or other non-Indian names is not guaranteed.
π Evaluation Results
The model was evaluated on a balanced test set of 50 Indian names (25 Male, 25 Female).
| Metric | Score |
|---|---|
| Accuracy | 94.00% |
| F1-Score (Weighted) | 0.9398 |
π Technical Specs
Fine-tuning Tool: Unsloth (2x speed optimization)
Precision: 4-bit Quantization (bitsandbytes)
LoRA Hyperparameters: Rank r=16, Alpha 16, Dropout 0.05
Learning Rate: 2e-4 with Linear Scheduler
π¦ Think of this model as your very own Indian naming expert β it's fast, it's precise
Happy Classifying! πβ¨
- Downloads last month
- 22
Model tree for Shi-07/Llama3_8b-FineTuned-Gender_Classifier_by_Name
Base model
unsloth/llama-3-8b-Instruct-bnb-4bitEvaluation results
- Accuracy on Indian Names Datasetself-reported0.940
- F1 Score (Weighted) on Indian Names Datasetself-reported0.940