Skip to content

Commit 5cd38e4

Browse files
committed
Add QUIN 2.5 RAG pipeline with recursive editing and energy tracking
- Set up QUIN 2.5 model and integrated it with Hugging Face embeddings - Built vector index and retriever using Apollo 11 dataset - Implemented structured recursive editing (draft, critic, refiner prompts) - Added QUIN API wrapper function with RAG context injection - Created recursive RAG loop with CodeCarbon for CPU, energy, and CO₂ tracking - Exported organized outputs and emission data to output.md - Added project README summarizing workflow and structure
1 parent 467af4b commit 5cd38e4

3 files changed

Lines changed: 15481 additions & 0 deletions

File tree

qwen_model/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!-- markdownlint-disable MD013 -->
2+
# QwenModel: Qwen 2.5 + RAG + Recursive Editing
3+
4+
This project experiments with the open-sourced model **Qwen 2.5** (2.5B parameters) combined with **Retrieval-Augmented Generation (RAG)** and **recursive editing** to test its performance across different prompt categories from the Apollo 11 dataset.
5+
6+
## Project Structure
7+
8+
* **main.ipynb** – The core notebook where Qwen 2.5 is set up, RAG is integrated, and recursive editing is implemented.
9+
* **output.md** – Contains the final prompts and responses generated through recursive editing, along with tracked energy and CO₂ emission metrics.
10+
11+
## Workflow Overview
12+
13+
### 1. Prompt Setup
14+
15+
The notebook defines three structured prompts for iterative refinement:
16+
17+
* **Draft Prompt** – Produces the initial answer.
18+
* **Critic Prompt** – Analyzes weaknesses in the draft.
19+
* **Refiner Prompt** – Improves the answer based on the critique.
20+
21+
This setup enables controlled recursive editing, especially useful for summarization, creative writing, and paraphrasing.
22+
23+
### 2. RAG Pipeline
24+
25+
* Connected to the Hugging Face API to generate **embeddings**.
26+
* Built a **vector index** from the Apollo 11 dataset.
27+
* Prepared a **retriever** to supply relevant context for Qwen.
28+
29+
### 3. Qwen Integration
30+
31+
A custom function handles:
32+
33+
* Retrieval of context
34+
* Construction of Qwen API calls
35+
* Application of recursive editing logic (3 iterations)
36+
37+
### 4. Energy Tracking
38+
39+
Each query is wrapped with **CodeCarbon** to record:
40+
41+
* CPU usage
42+
* Energy consumption
43+
* CO₂ emissions
44+
45+
All tracked metrics appear in `output.md`.
46+
47+
## Output
48+
49+
The final markdown file contains:
50+
51+
* The prompts used
52+
* Recursive-editing improved final responses
53+
* Per-question energy and emission statistics
54+
55+
## Purpose
56+
57+
This setup provides a compact testing environment to evaluate Qwen 2.5’s performance with RAG and recursive editing, enabling comparison with larger or alternative models.

0 commit comments

Comments
 (0)