--- library_name: transformers tags: - trl - sft - fine-tuned - custom-dataset - navigation-ai - coach-assistant - llama license: apache-2.0 language: - en base_model: meta-llama/Llama-3.2-3B-Instruct --- # Coach Navigation Assistant — Fine-Tuned Model This model is fine-tuned to help coaches navigate a dashboard by generating helpful paragraphs that include correct internal HTML links (e.g., `Click here`). It is designed for use inside LMS/admin dashboards where users need quick instructions and direct links. ## Model Details ### Model Description This model is a fine-tuned version of **meta-llama/Llama-3.2-3B-Instruct**. Its purpose is to understand natural language questions such as: - "Where do I go to create a course?" - "How can I add a new video section?" - "Where do I manage students?" And return a friendly paragraph that explains the location and includes the correct internal endpoint as a clickable HTML link. - **Developed by:** Ziyad T. - **Model type:** Instruction-tuned generative model - **Languages:** English - **Finetuned from:** meta-llama/Llama-3.2-3B-Instruct - **License:** Apache 2.0 (same as base model) ### Model Sources - **Repository:** [This Hugging Face model page] - **Demo:** [Optional - Add your demo link] - **Training Notebook:** [Add your Colab/Kaggle link] ## Uses ### Direct Use The model can be used to: - Generate dashboard navigation guidance - Provide contextual instructions - Embed HTML links inside responses - Power chatbots for course creators, admins, or coaches ### Downstream Use - LMS support assistants - Platform onboarding bots - Context-aware help centers - Interactive documentation systems ### Out-of-Scope Use The model is **NOT** suitable for: - Factual Q&A outside the navigation domain - Sensitive or medical advice - Arbitrary text generation not related to navigation - Producing links outside your controlled system - General-purpose conversation ## Bias, Risks, and Limitations ⚠️ **Important Limitations:** - The model will only work correctly with endpoints it was trained on - If the user asks about a route not in the dataset, the model may guess or hallucinate a link - The model assumes the platform uses HTML `` tags — not markdown or other formats - Responses are optimized for coach/admin users, not students or general users ### Recommendations - ✅ Validate model outputs before exposing them publicly - ✅ Keep endpoints consistent with the dataset - ✅ Add more training examples as your app grows - ✅ Implement fallback responses for unknown queries - ✅ Monitor and log model outputs for quality assurance ## How to Use the Model ### Basic Usage ```python from transformers import AutoModelForCausalLM, AutoTokenizer # Load model and tokenizer tokenizer = AutoTokenizer.from_pretrained("your-username/llama-3.2-3b-coach-assistant") model = AutoModelForCausalLM.from_pretrained("your-username/llama-3.2-3b-coach-assistant") # Prepare input prompt = "Where do I go to create a new course?" # Generate response inputs = tokenizer(prompt, return_tensors="pt") outputs = model.generate(**inputs, max_length=200, temperature=0.7) # Decode output response = tokenizer.decode(outputs[0], skip_special_tokens=True) print(response) ``` ### Using with Hugging Face Inference API ```python import requests API_URL = "https://api-inference.huggingface.co/models/your-username/llama-3.2-3b-coach-assistant" headers = {"Authorization": "Bearer YOUR_HF_TOKEN"} def query(payload): response = requests.post(API_URL, headers=headers, json=payload) return response.json() output = query({ "inputs": "Where do I go to create a new course?", "parameters": { "max_new_tokens": 150, "temperature": 0.7, } }) print(output) ``` ### Using with Inference Endpoints (Recommended for Production) ```python import requests # Your deployed endpoint URL API_URL = "https://your-endpoint.aws.endpoints.huggingface.cloud" headers = {"Authorization": "Bearer YOUR_HF_TOKEN"} payload = { "inputs": "Where do I go to create a new course?", "parameters": { "max_new_tokens": 150, "temperature": 0.7, "top_p": 0.9, } } response = requests.post(API_URL, headers=headers, json=payload) print(response.json()) ``` ## Training Details ### Training Data A custom JSONL dataset consisting of input-output pairs: ```json { "input": "Where do I go to create a new course?", "output": "To create a new course, navigate to the course creation page where you can add all the details about your course. Click here to start creating your course." } ``` **Dataset Statistics:** - Total examples: 50+ - Endpoints covered: 8+ major routes - Variations per endpoint: 3-5 different question phrasings **Covered Endpoints:** - `/courses/add` - Creating new courses - `/courses/index` - Viewing and managing courses - `/inbox` - Checking messages - `/accont` - Managing profile - `/coach/dashboard` - Accessing dashboard - Course editing, sections, students, and more ### Training Procedure **Fine-tuning Method:** QLoRA (4-bit quantization + LoRA) **Training Framework:** - TRL SFTTrainer (Supervised Fine-Tuning) - PEFT (Parameter-Efficient Fine-Tuning) - BitsAndBytes (4-bit quantization) **Training Configuration:** - **Base Model:** meta-llama/Llama-3.2-3B-Instruct - **Quantization:** 4-bit NF4 with double quantization - **LoRA Rank (r):** 16 - **LoRA Alpha:** 32 - **LoRA Dropout:** 0.05 - **Target Modules:** q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj - **Learning Rate:** 2e-4 - **Batch Size:** 4 per device - **Gradient Accumulation Steps:** 4 (effective batch size: 16) - **Epochs:** 3 - **Max Sequence Length:** 512 - **Optimizer:** paged_adamw_8bit - **LR Scheduler:** Cosine - **Warmup Steps:** 50 - **Mixed Precision:** FP16 ### Speeds, Sizes, Times **Model Size:** - Base model parameters: ~3B - Trainable parameters (LoRA): ~0.5% of total - Final model size: ~6GB (merged) **Training Environment:** - GPU: [Add your GPU type, e.g., NVIDIA A100, T4] - Training time: [Add your training time, e.g., ~2 hours] - Cloud platform: [Add if applicable, e.g., Google Colab, Kaggle, AWS] ## Evaluation ### Testing Data A validation set with unseen question variations for each endpoint to test generalization. ### Metrics **Evaluation Criteria:** - ✅ **Link Correctness:** Does the model return the correct endpoint? - ✅ **Response Quality:** Is the paragraph helpful and natural? - ✅ **Format Consistency:** Does it follow the HTML link format? - ✅ **Instruction Clarity:** Are the instructions clear and actionable? ### Results The model reliably returns: - ✅ The correct link for trained endpoints - ✅ Relevant and contextual instructions - ✅ Consistent HTML formatting - ✅ Natural, conversational language **Sample Outputs:** | Input | Output | |-------|--------| | "Where do I create a course?" | "To create a new course, navigate to the course creation page where you can add all the details about your course. Click here to start creating your course." | | "How can I check my messages?" | "You can check all your messages and communicate with students in the inbox. Click here to access your messages." | | "Where is my dashboard?" | "Your coach dashboard provides an overview of your courses, students, and activity. Click here to access your dashboard." | ## Environmental Impact **Carbon Emissions:** [Optional - Add if you tracked this] Fine-tuning was performed using cloud GPU resources. The use of QLoRA (4-bit quantization) significantly reduced computational requirements compared to full fine-tuning. ## Technical Specifications ### Model Architecture - **Architecture:** Llama 3.2 (decoder-only transformer) - **Parameters:** ~3 billion - **Attention:** Multi-head attention with grouped-query attention - **Context Length:** 8192 tokens (base model capability) - **Training Context:** 512 tokens (for efficiency) ### Compute Infrastructure - **Hardware:** [Add your GPU type] - **Software:** - Python 3.10+ - PyTorch 2.0+ - Transformers 4.35+ - PEFT 0.6+ - BitsAndBytes 0.41+ - TRL (Transformer Reinforcement Learning) ## Citation If you use this model in your work, please cite: **BibTeX:** ```bibtex @misc{coach-assistant-2024, author = {Ziyad T.}, title = {Coach Navigation Assistant - Fine-Tuned Llama 3.2 3B}, year = {2024}, publisher = {Hugging Face}, howpublished = {\url{https://huggingface.co/your-username/llama-3.2-3b-coach-assistant}} } ``` **APA:** ``` Ziyad T. (2024). Coach Navigation Assistant - Fine-Tuned Llama 3.2 3B. Hugging Face. https://huggingface.co/your-username/llama-3.2-3b-coach-assistant ``` ## Model Card Authors **Ziyad T.** ## Model Card Contact For questions, issues, or feedback: - **GitHub:** [Add your GitHub profile] - **Email:** [Add your email] - **Hugging Face:** [Add your HF profile] ## Acknowledgments - Base model: Meta AI (Llama 3.2) - Training framework: Hugging Face (Transformers, PEFT, TRL) - Quantization: BitsAndBytes team --- **Last Updated:** November 2024