Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,128 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
datasets:
|
| 4 |
+
- sentence-transformers/eli5
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
base_model: microsoft/phi-2
|
| 8 |
+
pipeline_tag: text-generation
|
| 9 |
+
tags:
|
| 10 |
+
- gguf
|
| 11 |
+
- phi-2
|
| 12 |
+
- eli5
|
| 13 |
+
- fine-tune
|
| 14 |
+
- text-generation
|
| 15 |
+
- llama.cpp
|
| 16 |
+
- explain-like-im-5
|
| 17 |
+
- qlora
|
| 18 |
+
library_name: peft
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# Model Card for ExplainIt-Phi-GGUF
|
| 22 |
+
|
| 23 |
+
This repository contains GGUF versions of a `microsoft/phi-2` model that was fine-tuned to explain complex topics in simple terms, in the style of the "Explain Like I'm 5" subreddit.
|
| 24 |
+
|
| 25 |
+
## Model Details
|
| 26 |
+
|
| 27 |
+
### Model Description
|
| 28 |
+
|
| 29 |
+
ExplainIt-Phi is a fine-tuned version of Microsoft's Phi-2 (2.7B parameter) model. It has been trained on the ELI5 dataset to excel at providing clear, concise, and easy-to-understand explanations for a wide range of questions. The model is intended for direct use and is particularly well-suited for educational applications, content creation, or as a helpful bot.
|
| 30 |
+
|
| 31 |
+
- **Model type:** Causal Language Model
|
| 32 |
+
- **Language(s) (NLP):** English
|
| 33 |
+
- **License:** Apache 2.0
|
| 34 |
+
- **Finetuned from model:** `microsoft/phi-2`
|
| 35 |
+
|
| 36 |
+
### Model Sources
|
| 37 |
+
|
| 38 |
+
- **Repository:** [https://github.com/Simran32909/ExplainIt-Phi/]
|
| 39 |
+
- **Original Model:** [microsoft/phi-2](https://huggingface.co/microsoft/phi-2)
|
| 40 |
+
|
| 41 |
+
## Uses
|
| 42 |
+
|
| 43 |
+
### Direct Use
|
| 44 |
+
|
| 45 |
+
This model is designed to be used directly for question-answering and explanation generation. It should be prompted using the format it was trained on for best results.
|
| 46 |
+
|
| 47 |
+
**Intended use:**
|
| 48 |
+
- Answering factual questions with simple explanations.
|
| 49 |
+
- Use as a chatbot or assistant for educational purposes.
|
| 50 |
+
- Content generation for blogs, articles, or social media.
|
| 51 |
+
|
| 52 |
+
**Prompt Format:**
|
| 53 |
+
The model expects prompts to follow this structure:
|
| 54 |
+
- Instruct: Explain the concept of transformer architecture in deep learning in simple terms.
|
| 55 |
+
- Output: Transformer architecture is a way of designing neural networks that can learn to process sequences of data, such as text or speech. Instead of using layers of neurons to transform the input data, transformer architecture uses self-attention mechanisms, which allow the network to focus on the most relevant parts of the input data and learn to encode and decode it. This makes transformer networks more efficient and powerful than traditional neural networks for tasks such as natural language processing and machine translation.
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
### Out-of-Scope Use
|
| 59 |
+
|
| 60 |
+
This model is not designed for creative writing, poetry, or complex multi-turn conversations. Its knowledge is limited to the data it was trained on and may not be up-to-date with events after late 2022. It should not be used for high-stakes applications requiring factual accuracy without human oversight.
|
| 61 |
+
|
| 62 |
+
## Bias, Risks, and Limitations
|
| 63 |
+
|
| 64 |
+
The model was trained on data from the ELI5 subreddit, which is primarily from a Western, English-speaking perspective. It may reflect the biases and common knowledge present in that community. As with any language model, it can produce plausible-sounding but incorrect information ("hallucinate"). All outputs should be fact-checked before use in a critical context.
|
| 65 |
+
|
| 66 |
+
## Get Started with the Model
|
| 67 |
+
|
| 68 |
+
These GGUF models are designed to be used with `llama.cpp` and other compatible clients.
|
| 69 |
+
|
| 70 |
+
1. **Download a model file:** Choose your preferred quantized version from the "Files and versions" tab. `Q4_K_M` is recommended for general use.
|
| 71 |
+
2. **Run with `llama.cpp`:**
|
| 72 |
+
```bash
|
| 73 |
+
# Example using the recommended Q4_K_M model
|
| 74 |
+
./llama-cli -m ./ExplainIt-Phi-Q4_K_M.gguf -p "Instruct: Why is the sky blue?\nOutput:" -n 256
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
## Model Files
|
| 78 |
+
|
| 79 |
+
This repository contains the following GGUF files, quantized from the same fine-tuned source:
|
| 80 |
+
|
| 81 |
+
| File Name | Quantization | Recommended Use |
|
| 82 |
+
|----------------------------|-------------------|-------------------------------------------------------|
|
| 83 |
+
| `ExplainIt-Phi-Q4_K_M.gguf`| **Q4_K_M** (4-bit) | **Default.** Best balance of quality, speed, and size. |
|
| 84 |
+
| `ExplainIt-Phi-Q5_K_M.gguf`| **Q5_K_M** (5-bit) | Higher quality, for systems with more RAM/VRAM. |
|
| 85 |
+
| `ExplainIt-Phi-Q8_0.gguf` | **Q8_0** (8-bit) | Near-lossless quality, best for GPU execution. |
|
| 86 |
+
|
| 87 |
+
---
|
| 88 |
+
|
| 89 |
+
## Training Details
|
| 90 |
+
|
| 91 |
+
### Training Data
|
| 92 |
+
|
| 93 |
+
The model was fine-tuned on the [`sentence-transformers/eli5`](https://huggingface.co/datasets/sentence-transformers/eli5) dataset. The data was filtered and formatted to create pairs of questions and high-quality answers, structured in the `Instruct/Output` format shown above.
|
| 94 |
+
|
| 95 |
+
### Training Procedure
|
| 96 |
+
|
| 97 |
+
The model was fine-tuned using QLoRA (Quantized Low-Rank Adaptation) with the PEFT library from Hugging Face.
|
| 98 |
+
|
| 99 |
+
#### Training Hyperparameters
|
| 100 |
+
- **LoRA Rank (r):** 16
|
| 101 |
+
- **LoRA Alpha:** 32
|
| 102 |
+
- **Learning Rate:** 5e-5
|
| 103 |
+
- **Optimizer:** PagedAdamW8bit
|
| 104 |
+
- **LR Scheduler:** Cosine with 10% warmup
|
| 105 |
+
- **Epochs:** 3
|
| 106 |
+
- **Batch Size (effective):** 64 (8 base * 8 accumulation)
|
| 107 |
+
|
| 108 |
+
#### Compute Infrastructure
|
| 109 |
+
- **Hardware:** 2x NVIDIA RTX A6000 GPUs
|
| 110 |
+
- **Strategy:** DeepSpeed ZeRO Stage 2
|
| 111 |
+
- **Software:** PyTorch Lightning, Hugging Face Transformers, PEFT, bitsandbytes, Hydra, DeepSpeed
|
| 112 |
+
|
| 113 |
+
## Evaluation
|
| 114 |
+
|
| 115 |
+
Evaluation was performed qualitatively by comparing the outputs of this fine-tuned model against the base `microsoft/phi-2` model on a diverse set of prompts.
|
| 116 |
+
|
| 117 |
+
### Results
|
| 118 |
+
|
| 119 |
+
The fine-tuned model consistently provides more direct, concise, and helpful explanations than the base model. It more reliably follows the `Instruct/Output` format and is less prone to generating conversational filler or refusing to answer the prompt.
|
| 120 |
+
|
| 121 |
+
**Example Prompt:** `Instruct: Explain how a CPU works in a computer.`
|
| 122 |
+
|
| 123 |
+
* **Base Model Output:** Often provided a very long, technical, multi-paragraph response that was not in the style of ELI5.
|
| 124 |
+
* **Fine-Tuned Model Output:** Typically provided a clear analogy (e.g., "A CPU is like the brain of the computer...") and explained the fetch-decode-execute cycle in simple terms, adhering to the expected format.
|
| 125 |
+
|
| 126 |
+
## Citation
|
| 127 |
+
|
| 128 |
+
If you use this model, please consider citing the original Phi-2 paper and linking to this repository.
|