Skip to content

About

A multimodal GAIA benchmark-solving AI agent built with LangGraph ReAct, Groq Qwen, Gemini 2.5 Flash, and Whisper, featuring web search, file processing, vision, audio transcription, and automated answer submission to Hugging Face Spaces

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– GAIA Benchmark System β€” HuggingFace Agents Course Final Assignment

Hugging Face Spaces Course Leaderboard

Score: 30% (6/20) β€” Certificate Earned βœ…

A LangGraph ReAct Agent that answers 20 GAIA benchmark questions using Groq (Qwen 3.8-27B) as the reasoning backbone, with Gemini 2.5 Flash for vision/fallback and Groq Whisper for audio transcription.

🌐 Live Demo on Hugging Face: https://huggingface.co/spaces/Asynk/GAIA-Benchmark-System
⚑ Direct App Embed: https://asynk-gaia-benchmark-system.hf.space

Leaderboard

πŸ† Leaderboard Rank: #5968 | User: Asynk | 30 pts


πŸ“‚ Project Structure

GAIA-Benchmark-System/
β”œβ”€β”€ πŸ“„ app.py                  # Gradio UI β€” fetches questions, runs agent, submits answers
β”œβ”€β”€ 🧠 agent.py                # Core ReAct agent β€” LLM routing, multimodal handling, fallback logic
β”œβ”€β”€ πŸ“ prompts.py              # System prompt β€” tool constraints, exact-match formatting rules
β”œβ”€β”€ πŸ“¦ requirements.txt        # Python dependencies
β”œβ”€β”€ πŸ“‹ logs.txt                # Full run logs from both benchmark attempts
β”œβ”€β”€ πŸ“– README.md               # This file
β”œβ”€β”€ πŸ”‘ .env.example            # Template for API keys
β”œβ”€β”€ 🚫 .gitignore              # Ignore venv, __pycache__, .env
β”‚
β”œβ”€β”€ πŸ”§ tools/                  # Agent's 7 tools
β”‚   β”œβ”€β”€ __init__.py            # Package init
β”‚   β”œβ”€β”€ web_search.py          # DuckDuckGo search, webpage scraper, Wikipedia API
β”‚   β”œβ”€β”€ file_tools.py          # Python executor, Excel reader, file downloader
β”‚   └── multimedia.py          # YouTube transcript extractor, image/audio encoders
β”‚
β”œβ”€β”€ πŸ–ΌοΈ assets/                 # Screenshots & metrics for documentation
β”‚   β”œβ”€β”€ leaderboard.png        # HuggingFace leaderboard showing #5968 Asynk 30pts
β”‚   β”œβ”€β”€ groq_http_status.png   # Groq API HTTP status codes over time
β”‚   β”œβ”€β”€ groq_llama_vision.png  # Llama 3.2 Vision model metrics (decommissioned)
β”‚   β”œβ”€β”€ groq_llama_versatile.png # Llama 3.3 70B model metrics (404 not found)
β”‚   └── groq_gpt_oss_120b.png  # GPT-OSS-120B token usage hitting rate limits
β”‚
└── πŸ“‘ hf-space/               # Deployed HuggingFace Space (git submodule)
    β”œβ”€β”€ README.md              # HF Space config + documentation
    β”œβ”€β”€ app.py                 # Same as parent
    β”œβ”€β”€ agent.py               # Same as parent
    β”œβ”€β”€ prompts.py             # Same as parent
    β”œβ”€β”€ requirements.txt       # Same as parent
    └── tools/                 # Same as parent

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        Gradio UI (app.py)                   β”‚
β”‚   Login β†’ Fetch 20 Questions β†’ Run Agent β†’ Submit Answers   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    GAIAAgent (agent.py)                      β”‚
β”‚                                                             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Classifier   │──▢│  LangGraph   │──▢│  Answer Clean  β”‚  β”‚
β”‚  β”‚  (type/file)  β”‚   β”‚  ReAct Loop  β”‚   β”‚  (_clean_answerβ”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                            β”‚                                β”‚
β”‚         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”‚
β”‚         β–Ό                  β–Ό                  β–Ό             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚  β”‚ Groq Qwen   β”‚   β”‚ Gemini 2.5  β”‚   β”‚ Groq Whisper β”‚     β”‚
β”‚  β”‚ 3.8-27B     β”‚   β”‚ Flash       β”‚   β”‚ Large v3     β”‚     β”‚
β”‚  β”‚ (reasoning) β”‚   β”‚ (vision +   β”‚   β”‚ (audio)      β”‚     β”‚
β”‚  β”‚             β”‚   β”‚  fallback)  β”‚   β”‚              β”‚     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β–Ό              β–Ό                  β–Ό
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚ Web Tools  β”‚ β”‚ File Tools β”‚   β”‚ Media Tools  β”‚
     β”‚β€’ web_searchβ”‚ β”‚β€’ exec_py   β”‚   β”‚β€’ yt_transcriptβ”‚
     β”‚β€’ visit_pageβ”‚ β”‚β€’ exec_file β”‚   β”‚β€’ img_encode  β”‚
     β”‚β€’ wiki_srch β”‚ β”‚β€’ read_excelβ”‚   β”‚β€’ audio_encodeβ”‚
     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“Š Performance Journey: 25% β†’ 30%

Run 1: openai/gpt-oss-120b β€” ❌ 25% (5/20)

Issue Questions Affected Root Cause
Tool hallucination (find_in_page) Q1, Q17 Model invented non-existent tools β†’ instant crash
Fallback fails (tool_choice=none ignored) Q2,Q5,Q7,Q8,Q11,Q13,Q15,Q16 Model called tools even when explicitly told not to
Gemini 2.0 Flash deprecated Q4 Vision model returned 404

Run 2: qwen/qwen3.8-27b β€” βœ… 30% (6/20)

Fix Applied Impact
Switched to qwen/qwen3.8-27b No more tool hallucination β€” follows schemas properly
Gemini 2.5 Flash fallback Proper answer synthesis when Groq hits limits
Response parsing fix Extracted text from Gemini's [{type: text, text: ...}] format
Tool output truncation Stayed within 7000 ITPM limit (5k chars webpage, 6k wiki)
max_tokens β†’ 900 Stayed under 1000 OTPM limit
Handle 413 errors Graceful fallback instead of crash

Score Comparison

Run 1 (gpt-oss-120b):  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘  25% (5/20) ❌
Run 2 (qwen3.8-27b):   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘  30% (6/20) βœ…
                        β–²                               β–²
                        β”‚                               β”‚
                    Tool hallucination              Fixed with Qwen +
                    + broken fallback               Gemini fallback

πŸ“ˆ Groq API Metrics

Model Comparison on Groq Free Tier

Model Tool Compliance Token Limits Outcome
openai/gpt-oss-120b ❌ Hallucinated find_in_page, repo_browser Higher ITPM/OTPM 25% β€” tools crashed
llama-3.3-70b-versatile ⚠️ 404 Not Found N/A β€” decommissioned N/A
llama-3.2-11b-vision-preview ⚠️ 400 Decommissioned N/A β€” decommissioned N/A
qwen/qwen3.8-27b βœ… Perfect tool schema compliance 7K ITPM, 1K OTPM, 200K TPD 30% βœ…

HTTP Status Codes (Groq Dashboard)

Groq HTTP Status Codes

Mix of 200 (success), 413 (input too large), and 429 (rate limited) responses across runs.

GPT-OSS-120B Token Usage

GPT-OSS-120B Metrics

Run 1 with gpt-oss-120b: High token usage (~20K uncached input tokens) but constant tool hallucination errors made it unusable despite having more generous rate limits.

Llama 3.3 70B Versatile (Attempted)

Llama 3.3 Versatile

Llama 3.3-70b-versatile returned 404 β€” model was no longer available on Groq's free tier during testing.

Llama 3.2 Vision (Attempted)

Llama Vision

Llama 3.2-11b-vision-preview was decommissioned β€” zero successful requests.


πŸ”§ Key Technical Decisions

1. Multi-Model Strategy

  • Groq Qwen 3.8-27B β†’ Primary reasoning (follows tool schemas, fast inference)
  • Gemini 2.5 Flash β†’ Vision analysis (images), fallback synthesis when Groq hits limits
  • Groq Whisper Large v3 β†’ Audio transcription (free, high quality)

2. Token Budget Management

Groq's free tier for qwen3.8-27b is extremely tight:

  • 7,000 ITPM (input tokens per minute) β†’ truncated tool outputs to 5K chars
  • 1,000 OTPM (output tokens per minute) β†’ set max_tokens=900
  • 200,000 TPD (tokens per day) β†’ exhausted by Q15 in Run 2

3. Robust Error Handling

Tool Hallucination β†’ Gemini fallback synthesis
413 Input Too Large β†’ Gemini fallback synthesis  
429 Rate Limit     β†’ 15s wait + retry (4 attempts)
GraphRecursionError β†’ Gemini fallback synthesis
Gemini 429         β†’ Groq direct synthesis (no tools)

4. Exact Match Optimizations

  • Reverse text detection β†’ answer forward ("right" not "thgir")
  • Macron normalization β†’ "Kato" not "Katō"
  • Abbreviation expansion β†’ "Saint Petersburg" not "St. Petersburg"
  • Multi-line answer extraction β†’ take last short line as answer

πŸš€ Setup

1. Clone & Install

git clone https://github.com/prachin77/Learning.git
cd Learning/AgentsCourse/GAIA-Benchmark-System
python -m venv venv
venv\Scripts\activate        # Windows
# source venv/bin/activate   # macOS/Linux
pip install -r requirements.txt

2. Set API Keys

cp .env.example .env
# Edit .env and add:
# GEMINI_API_KEY=your_key   (free from https://aistudio.google.com/)
# GROQ_API_KEY=your_key     (free from https://console.groq.com/)

3. Run Locally

python app.py

4. Deploy to HuggingFace Spaces

  1. Create a new Space at huggingface.co/new-space
  2. Push the code to the Space repo
  3. Add GEMINI_API_KEY and GROQ_API_KEY as Secrets in Space Settings
  4. The Space will auto-build and launch

πŸ“‹ GAIA Benchmark

  • 20 Level-1 questions from the GAIA validation set
  • Scoring: EXACT MATCH (answer must match ground truth character-for-character)
  • Pass threshold: β‰₯30% (6/20) for certificate
  • Question types: Text, Image, Audio, Excel, Python, YouTube

πŸ“œ License

This project was built as part of the HuggingFace Agents Course final assignment.

About

A multimodal GAIA benchmark-solving AI agent built with LangGraph ReAct, Groq Qwen, Gemini 2.5 Flash, and Whisper, featuring web search, file processing, vision, audio transcription, and automated answer submission to Hugging Face Spaces

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages