How xuchenhao001/drag works
Project type and purpose
• Type: Python-based simulation framework for distributed Retrieval-Augmented Generation (RAG)
• Purpose: Orchestrate a network of “peer” agents, each with its own knowledge base, that retrieve documents, call a local LLM service (Ollama), evaluate results, log metrics, and produce figures.
File structure
• Top-level entry point:
• simulator.py
• auto_scripts/ (default.sh, demo.sh)
• Configuration:
• config/data/*.yaml (datasets: medical, MMLU, news)
• config/llm/*.yaml (model settings: llama32, gemma2, qwen25)
• config/rag.yaml (RAG network parameters)
• Core logic modules (modules/*.py):
• data_types.py (data models)
• knowledge_base.py (builds/shards docs)
• rag_network.py (distributed retrieval)
• peer.py (peer node abstraction)
• llm.py (Ollama API wrapper + templates)
• evaluator.py (metrics)
• exp_logger.py (logging)
• options.py (CLI flags)
• Templates: templates/*.tmpl (prompt formats)
• Visualization: figures/*.py (plot generation)
README for additional insights
• Requires Python 3.10, Ollama LLM service, NLTK data
• Uses Hugging Face datasets and Ollama LLM models
• Run via python simulator.py