Skip to content

Commit ca52eec

Browse files
committed
updates
1 parent 59fee26 commit ca52eec

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

google_gemma/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Project: “Green AI Automated RAG Testing with Gemma”
2+
3+
## Overview
4+
5+
We built an interactive retrieval-augmented generation (RAG) pipeline using the
6+
open-weight model *Gemma 2-2b* by Google and applied it to a standardized text
7+
and prompt set derived from the Apollo 11 lunar landing.
8+
9+
**The goal:**
10+
11+
* evaluate summarisation, reasoning, retrieval, paraphrasing, and creative tasks
12+
in a controlled, reproducible way — logging both answer quality and local
13+
sustainability metrics (energy/carbon emissions) via CodeCarbon.
14+
15+
## Model
16+
17+
**Model ID:** `google/gemma-2-2b-it` (Hugging Face)
18+
19+
**Key attributes:**
20+
21+
* Open-weight decoder-only model trained by Google
22+
* Supports text-generation and conversational usage
23+
* Suitable for research, summarisation, reasoning, and retrieval tasks
24+
* Lightweight enough for deployment on modest compute resources
25+
26+
Model link: [https://huggingface.co/google/gemma-2-2b-it](https://huggingface.co/google/gemma-2-2b-it)
27+
28+
## What We Did
29+
30+
1. Created a source document (`source.txt`) using ~1,400 words of selected
31+
Wikipedia excerpts on Apollo 11.
32+
2. Defined a set of 21 standardised prompts spanning five categories:
33+
summarisation, reasoning, RAG (fact retrieval), paraphrasing, and creative
34+
generation.
35+
3. Built a document retrieval component using sentence-transformers to chunk
36+
the document and select top-k relevant chunks per query.
37+
4. Developed an interactive notebook workflow that:
38+
39+
* Accepts a question at runtime
40+
* Runs RAG → Draft → Critic → Refiner cycles using Gemma
41+
* Tracks local CPU/GPU energy usage and CO₂ emissions with CodeCarbon
42+
* Logs each question, answer, timestamp, and emissions to a single
43+
append-only log file
44+
5. Logged runtime latency and emissions per query for performance and
45+
sustainability insights.
46+
47+
## How to Use
48+
49+
1. Clone the repository:
50+
51+
```bash
52+
git clone <YOUR_REPO_URL>
53+
cd your_repo_folder
54+
```
55+
56+
2. Place your `source.txt` into `./data/`.
57+
58+
3. Add your Hugging Face API key in the config cell.
59+
60+
4. Run the notebook setup cells, then use the interactive prompt cell to ask
61+
questions.
62+
63+
## Why This Matters
64+
65+
* **Reproducibility** — fixed source text and prompt set allow consistent
66+
evaluation across models.
67+
* **Efficiency vs. Accuracy** — emissions are logged alongside outputs to
68+
explore trade-offs between model performance and energy cost.
69+
* **Accessibility** — uses an open model and standard Python tools, making
70+
research on small language models feasible even on laptops.

0 commit comments

Comments
 (0)