πŸ¦™ 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
Safetensors
Model size
8B params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Shi-07/Llama3_8b-FineTuned-Gender_Classifier_by_Name

Finetuned
(1045)
this model

Evaluation results