Spaces:
Running
Running
added laymans intro
Browse files
README.md
CHANGED
|
@@ -20,18 +20,93 @@ A lightweight pipeline for extraction, chunking, embeddings, and search.
|
|
| 20 |
|
| 21 |
# 📘 **distill_rag — Dataset Extraction + Long-Chunk Indexing + Semantic Search for Distillation RAG Pipelines**
|
| 22 |
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
-
|
| 28 |
-
2. **Clean and convert** into structured {title, turns[]} JSON sessions
|
| 29 |
-
3. **Chunk** content into long semantic blocks
|
| 30 |
-
4. **Embed** using any local embedding model (Ollama-compatible)
|
| 31 |
-
5. **Index** into Elasticsearch with metadata
|
| 32 |
-
6. **Search** using dense vector similarity
|
| 33 |
|
| 34 |
-
All components are independent, tested, and designed for easy integration into larger distillation loops (e.g., finetuning, self-training, iterative Q&A generation).
|
| 35 |
|
| 36 |
---
|
| 37 |
|
|
|
|
| 20 |
|
| 21 |
# 📘 **distill_rag — Dataset Extraction + Long-Chunk Indexing + Semantic Search for Distillation RAG Pipelines**
|
| 22 |
|
| 23 |
+
Here’s an updated **layman-friendly introduction** you can paste right after the metadata block and before the technical sections.
|
| 24 |
+
It answers **Why**, **What**, and **How** in simple but grounded language — making it clear that this is for people who want to build **state-of-the-art domain-specific AI models**.
|
| 25 |
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
# Distill RAG
|
| 29 |
+
|
| 30 |
+
A lightweight pipeline for extraction, chunking, embeddings, and search.
|
| 31 |
+
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## 🧠 **What Is This? (Plain-Language Overview)**
|
| 35 |
+
|
| 36 |
+
**distill_rag** is a small but powerful toolkit that helps you transform messy text sources (HTML pages, transcripts, articles, archives) into **clean, structured data** that AI models can learn from.
|
| 37 |
+
|
| 38 |
+
It’s designed for people who want to build:
|
| 39 |
+
|
| 40 |
+
* **domain-specific AI assistants**,
|
| 41 |
+
* **high-quality expert models**, or
|
| 42 |
+
* **distillation pipelines** where a stronger model teaches a smaller one.
|
| 43 |
+
|
| 44 |
+
If you’ve ever tried to fine-tune a model and realized the hardest part is actually preparing the dataset — this toolkit solves that problem.
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
|
| 48 |
+
## 🌍 **Why This Exists**
|
| 49 |
+
|
| 50 |
+
Training or distilling a specialised AI model requires **clean, coherent, well-structured data**.
|
| 51 |
+
But most text you find online is:
|
| 52 |
+
|
| 53 |
+
* full of ads, scripts, headers
|
| 54 |
+
* chopped into small fragments
|
| 55 |
+
* badly formatted
|
| 56 |
+
* missing metadata
|
| 57 |
+
* hard to retrieve or chunk meaningfully
|
| 58 |
+
|
| 59 |
+
Before you can train a model, you need a **pipeline that turns raw text into polished training-ready data**.
|
| 60 |
+
|
| 61 |
+
distill_rag gives you that pipeline.
|
| 62 |
+
|
| 63 |
+
It helps you:
|
| 64 |
+
|
| 65 |
+
1. pull content from raw HTML
|
| 66 |
+
2. clean and structure it
|
| 67 |
+
3. break it into long coherent chunks
|
| 68 |
+
4. embed it locally
|
| 69 |
+
5. index it with Elasticsearch
|
| 70 |
+
6. perform high-quality semantic search
|
| 71 |
+
|
| 72 |
+
This structure mirrors the exact data format most distillation workflows expect.
|
| 73 |
+
|
| 74 |
+
The goal is simple:
|
| 75 |
+
**Make it much easier for researchers and builders to create high-quality domain-specific AI models.**
|
| 76 |
+
|
| 77 |
+
---
|
| 78 |
+
|
| 79 |
+
## 🔧 **How It Works (At a Glance)**
|
| 80 |
+
|
| 81 |
+
Here’s the full process in three steps:
|
| 82 |
+
|
| 83 |
+
### **1. Extract & Clean**
|
| 84 |
+
|
| 85 |
+
Feed it any folder of HTML (scraped, archived, downloaded).
|
| 86 |
+
It removes noise, extracts meaningful text, and turns it into structured JSON.
|
| 87 |
+
|
| 88 |
+
### **2. Chunk & Embed**
|
| 89 |
+
|
| 90 |
+
The text is broken into long, context-rich chunks (ideal for distillation).
|
| 91 |
+
Each chunk is embedded using a local model like `mxbai-embed-large`.
|
| 92 |
+
|
| 93 |
+
### **3. Index & Search**
|
| 94 |
+
|
| 95 |
+
Chunks are stored in Elasticsearch with vectors, metadata, and text.
|
| 96 |
+
You can then run semantic search to retrieve the most relevant material — exactly how modern RAG and distillation pipelines work.
|
| 97 |
+
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
## 🚀 **Who Should Use This?**
|
| 101 |
+
|
| 102 |
+
* AI researchers building **aligned distilled models**
|
| 103 |
+
* Developers training **expert assistants**
|
| 104 |
+
* Archivists working with large collections of text
|
| 105 |
+
* Anyone building **custom RAG systems**
|
| 106 |
+
* Or anyone who wants a clean, open, hackable indexing pipeline
|
| 107 |
|
| 108 |
+
This project is intentionally simple, transparent, and designed to be extended.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
|
|
|
| 110 |
|
| 111 |
---
|
| 112 |
|