Ajaykumarjha's picture
Update README.md
87043df verified
metadata
library_name: transformers
language:
  - aa
metrics:
  - accuracy
  - bleu
  - code_eval
base_model:
  - meta-llama/Llama-2-7b-hf
---
base_model: meta-llama/Llama-2-7b-hf
library_name: peft
tags:
  - llama2
  - causal-lm
  - instruction-tuning
  - customer-support
  - lora
  - peft
---

# Model Card for `llama2-customer-support-ajay`

This is a fine-tuned version of **LLaMA-2 7B** using **LoRA adapters via PEFT** for customer support and story-style response generation. It has been trained on a small instruction dataset designed to simulate friendly, conversational replies to customer queries, ideal for support chatbots or virtual assistants.

---

## Model Details

### Model Description

This model was fine-tuned on a small instruction dataset with three fields: `instruction`, `input`, and `output`. The model learns to generate human-like, empathetic, and informative responses for common customer interactions such as applying promo codes, understanding shipping timelines, and subscription cancellations.

- **Developed by:** Ajay Kumar Jha  
- **Model type:** Causal Language Model (Instruction-tuned)  
- **Language(s):** English  
- **License:** llama2 license (Meta AI)  
- **Fine-tuned from model:** meta-llama/Llama-2-7b-hf  
- **Library:** `transformers`, `peft`, `trl`  

---

## Model Sources

- **Repository:** [https://huggingface.co/Ajaykumarjha/llama2-customer-support-ajay](https://huggingface.co/Ajaykumarjha/llama2-customer-support-ajay)
- **Demo:** Gradio/Colab Interface Available (see below)


---

## Uses

### Direct Use

- Generate customer support responses for predefined instruction+input pairs
- Can be integrated into chatbots or support ticket systems

### Downstream Use

- Plug into frontend chat interfaces (Gradio, Streamlit)
- Extend to more domains like e-commerce, education, healthcare

### Out-of-Scope Use

- Not suitable for medical, legal, or financial advice  
- Not suitable for zero-shot generation outside the tuned task  
- Not a replacement for professional customer service staff

---

## Bias, Risks, and Limitations

- The model was trained on a **small, synthetic dataset**, so it may generalize poorly to unexpected queries
- Biases from base model (`llama2-7b`) are inherited
- Not designed for adversarial, unethical, or misleading use

### Recommendations

Ensure model output is monitored and evaluated before integration in production. Human-in-the-loop review is encouraged.

---

## How to Get Started with the Model

```python
from transformers import AutoTokenizer, AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained("YOUR_USERNAME/llama2-customer-support-ajay", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("YOUR_USERNAME/llama2-customer-support-ajay")

def generate_response(instruction, input_text):
    prompt = f"### Instruction:\n{instruction}\n\n### Input:\n{input_text}\n\n### Response:"
    inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
    outputs = model.generate(**inputs, max_new_tokens=256)
    return tokenizer.decode(outputs[0], skip_special_tokens=True)

Training Details

Training Data

Custom JSON dataset with instruction-based prompts and conversational, friendly outputs for support cases. Contains fewer than 100 examples.

Training Procedure

  • Format: Alpaca-style (Instruction → Input → Output)
  • Framework: 🤗 transformers, trl, peft
  • Fine-tuning Method: LoRA adapter (8-bit, 4-bit)
  • Mixed Precision: fp16

Training Hyperparameters

  • Epochs: 3
  • Batch size: 1
  • LR: 2e-4
  • Accumulation steps: 4
  • Save strategy: epoch

Evaluation

Testing Data

10% of the training data used for eval split

Metrics

  • No formal metrics due to size; manual evaluation on fluency and helpfulness

Results

  • Outputs are stylistically aligned with helpful, cheerful assistant replies
  • Generalizes decently to new inputs in the same domain

Environmental Impact

  • Hardware Type: Google Colab Pro GPU (T4/A100)
  • Hours used: ~1 hour
  • Cloud Provider: Google
  • Compute Region: Asia-South (India)
  • Carbon Emitted: Low (due to short training duration)

Technical Specifications

Model Architecture

LLaMA 2 7B - decoder-only transformer with instruction-style prompt formatting

Compute Infrastructure

  • Hardware: NVIDIA T4 GPU (Google Colab Pro)
  • Software: Python 3.10, Transformers 4.39, PEFT 0.15.2, Accelerate

Citation

APA:

Ajay Kumar Jha. (2025). Fine-Tuned LLaMA2 for Customer Support Chatbots. HuggingFace. https://huggingface.co/YOUR_Ajaykumarjha/llama2-customer-support-ajay


Model Card Authors

Ajay Kumar Jha

Model Card Contact


Framework versions

  • transformers: 4.39+
  • peft: 0.15.2
  • trl: 0.7+