--- license: mit --- Model used- Phi-2 2.7B parameter(https://huggingface.co/microsoft/phi-2) Code- ``` from transformers import AutoTokenizer, AutoModelForCausalLM import torch tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2") model=AutoModelForCausalLM.from_pretrained("microsoft/phi-2",device_map="cuda") #load the model #print(model.device) def ask(question: str, max_new_tokens: int = 256) -> str: prompt = f"Instruct: {question}\nOutput:" inputs = tokenizer(prompt, return_tensors="pt").to(model.device) outputs = model.generate( **inputs, max_new_tokens=max_new_tokens, do_sample=True, temperature=0.7, top_p=0.9, pad_token_id=tokenizer.eos_token_id) response = tokenizer.decode(outputs[0], skip_special_tokens=True) return response[len(prompt):].strip() # Example answer = ask("List five common street foods in south India") print(answer) ``` What kind of dataset do you think the model should be fine-tuned on to fix such errors? The model should be fine-tuned on a diverse reasoning and factual accuracy dataset that includes tasks similar to the errors observed. Based on the failures in this evaluation, the training data should include: * Mathematical reasoning to improve numerical accuracy * Reasoning datasets to improve logical inference. For example, StrategyQA(https://huggingface.co/datasets/ChilleD/StrategyQA) * Factual knowledge to reduce hallucinations * Bias and fairness to prevent discriminatory or stereotypical responses, and many ongoing research problems * Instruction-following datasets that train the model to respect constraints in prompts How would you assemble or find such a dataset? Synthetic generation using LLM: one effective method is synthetic data generation, where more powerful language models are used to create new training examples automatically. For example, a stronger model can generate reasoning questions, mathematical problems, or instruction-following tasks that expose weaknesses in smaller models. Data augmentation: expands existing datasets by modifying or transforming current examples. Instead of collecting entirely new data, existing prompts can be rewritten or expanded to create multiple variations of the same problem. Web Scraping: is done by extracting and collecting information from publicly available data, such as Wikipedia. However, scraped data must be cleaned and carefully filtered before being used for training. Raw web data often contains noise, duplicate information, or incorrect content. Manual or automated filtering processes are therefore required to remove low-quality data and ensure that the final dataset is reliable and accurate. How big of a dataset do you think you’d need? The size of the dataset used to train the model will depend on factors such as size of the model (more the number of parameters, more the data samples needed), Technique used to fine tune the model (For example, LoRA trains fewer parameters, hence need fewer data samples while full-finetuning will require more).