{"id":37846649,"url":"https://github.com/lijoraju/charitra-retrieval-augmented-qa","last_synced_at":"2026-01-16T16:03:54.846Z","repository":{"id":295840457,"uuid":"990684375","full_name":"lijoraju/charitra-retrieval-augmented-qa","owner":"lijoraju","description":"Retrieval-Augmented Q\u0026A system for high school Social Studies, fine-tuned using QLoRA and deployed with FastAPI.","archived":false,"fork":false,"pushed_at":"2025-06-27T06:29:45.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-27T07:37:16.473Z","etag":null,"topics":["edtech","education-ai","faiss-vector-database","fastapi","fine-tuning","gguf","huggingface","langchain","llm","open-source","peft","qlora","question-answering","rag","sentence-transformers","tinyllama"],"latest_commit_sha":null,"homepage":"https://medium.com/@lijoraju/charitra-a-small-conversational-q-a-system-for-class-x-social-science-textbook-1cc613a78ecd","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lijoraju.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-26T13:29:21.000Z","updated_at":"2025-06-27T06:49:22.000Z","dependencies_parsed_at":"2025-05-27T16:48:29.364Z","dependency_job_id":"14986be2-0f09-4b34-b669-fc72baa49a74","html_url":"https://github.com/lijoraju/charitra-retrieval-augmented-qa","commit_stats":null,"previous_names":["lijoraju/rag-qlora-bot","lijoraju/charitra-qa","lijoraju/charitra-retrieval-based-qa"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lijoraju/charitra-retrieval-augmented-qa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lijoraju%2Fcharitra-retrieval-augmented-qa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lijoraju%2Fcharitra-retrieval-augmented-qa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lijoraju%2Fcharitra-retrieval-augmented-qa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lijoraju%2Fcharitra-retrieval-augmented-qa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lijoraju","download_url":"https://codeload.github.com/lijoraju/charitra-retrieval-augmented-qa/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lijoraju%2Fcharitra-retrieval-augmented-qa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479466,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["edtech","education-ai","faiss-vector-database","fastapi","fine-tuning","gguf","huggingface","langchain","llm","open-source","peft","qlora","question-answering","rag","sentence-transformers","tinyllama"],"created_at":"2026-01-16T16:03:54.760Z","updated_at":"2026-01-16T16:03:54.825Z","avatar_url":"https://github.com/lijoraju.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Charitra: Retrieval-Based Q\u0026A for High School Social Science Studies\n\n[![Hugging Face Space](https://img.shields.io/badge/Live%20Demo-HuggingFace-blue?logo=huggingface)](https://lijoraju-charitra-backend.hf.space/docs)\n[![Dockerized](https://img.shields.io/badge/Dockerized-%F0%9F%90%B3-blue)](https://www.docker.com/)\n[![LLM: TinyLlama](https://img.shields.io/badge/Model-TinyLlama--1.1B--Chat-blueviolet)](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)\n[![Built With FastAPI](https://img.shields.io/badge/Built%20With-FastAPI-green)](https://fastapi.tiangolo.com/)\n\n![QLoRA Fine-tuned](https://img.shields.io/badge/QLoRA-Fine--tuned-ff69b4?logo=pytorch)\n![Unit Tested](https://img.shields.io/badge/Tests-Passed-green?logo=pytest)\n[![Medium Article](https://img.shields.io/badge/Read%20More-Medium-000000?logo=medium)](https://medium.com/@lijoraju/charitra-a-small-conversational-q-a-system-for-class-x-social-science-textbook-1cc613a78ecd)\n\nA lightweight, LLM-powered question answering system fine-tuned on NCERT Social Science texbooks using QLoRA and deployed via FastAPI + Docker.\n\n🛰️ Live Demo: [Charitra API on Hugging Face Spaces](https://lijoraju-charitra-backend.hf.space/docs)\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Features](#features)\n- [Architecture](#architecture)\n- [Tech Stack](#tech-stack)\n- [How to Run Locally](#how-to-run-locally)\n- [Training \u0026 Fine-Tuning](#training--fine-tuning)\n- [Project Structure](#project-structure)\n- [Sample Queries](#sample-queries)\n- [Future Work](#future-work)\n- [License](#license)\n\n## Overview\n\n**Charitra** is an open-source Retrieval-Augmented Generation (RAG) system designed to help high school students explore answers from *NCERT Class 10 Social Science* material. It uses a fine-tuned version of TinyLlama with QLoRA for domain adaptation and integrates with a FAISS-based semantic retriever.\n\nThis project demonstrates how to build and deploy a low-latency, memory-efficient RAG system using open tools and modest compute.\n\n## Features\n\n- 🔍 Top-k semantic retrieval using FAISS\n- 📖 Fine-tuned LLM using QLoRA on curated Q\u0026A pairs\n- ⚡ Quantized inference with GGUF and llama.cpp\n- 🚀 FastAPI backend with clean REST interface\n- 🐳 Dockerized for deployment on Hugging Face Spaces\n- 📁 Organized for extensibility and testing\n\n## Architecture\n\n1. PDF NCERT textbook → Chunked \u0026 embedded\n2. FAISS vectorstore → stores semantic chunks\n3. User query → semantic search → top-k chunks\n4. Chunks + query → Prompt to TinyLlama (QLoRA fine-tuned)\n5. Final answer → served via FastAPI\n\n## Tech Stack\n\n- 🧠 LLM: [TinyLlama-1.1B-Chat](https://huggingface.co/TinyLlama/TinyLlama-1.1B-Chat-v1.0)\n- 🔧 Fine-tuning: QLoRA + PEFT + bitsandbytes\n- 📚 Retriever: SentenceTransformers + FAISS\n- 🐍 Backend: Python + FastAPI\n- 🐳 Deployment: Docker + Hugging Face Spaces\n- 📦 Vectorstore: FAISS\n\n## How to Run Locally\n\n```bash\n# Clone the repo\ngit clone https://github.com/lijoraju/charitra.git \u0026\u0026 cd charitra\n\n# Build the docker image\ndocker build -t charitra-app .\n\n# Run the container\ndocker run -p 7860:7860 charitra-app\n```\nOnce running, visit http://localhost:7860/docs or send a POST request to /query\n```\ncurl -X POST http://localhost:7860/query \\\n    -H \"Content-Type: application/json\" \\\n    -d '{\"query\": \"What is the importance of the Indian National Congress in India’s freedom struggle?\"}'\n```\n\n## Training \u0026 Fine-Tuning\n\n- Dataset: 300+ QA pairs auto-generated from NCERT Class X chapters\n- Format: OpenChat-style JSON\n- Fine-tuning: 4-bit QLoRA on TinyLlama using `transformers` + PEFT\n- Output: GGUF quantized model for CPU-based inference\n\n## Project Structure\n\n```\ncharitra/\n├── app/ # FastAPI app\n├── pipeline/ # RAG pipeline (embedding, retrieval, model)\n├── scripts/ # CLI scripts to test and train\n├── data/ # Sample data (docs, QA pairs)\n├── tests/ # Unit tests\n├── Dockerfile\n├── start.sh\n└── requirements.txt\n```\n\n## Sample Queries\n\n```bash\nQ: What were the causes of the Non-Cooperation Movement?\nA: The Non-Cooperation Movement was launched by Gandhi to resist British rule through peaceful means like boycotting schools, goods, and titles...\n\nQ: What is the role of the Constitution in a democracy?\nA: The Constitution lays down the framework of governance, ensures rights and justice, and acts as the guardian of democracy...\n```\n\n## Future Work\n- Add PDF ingestion interface\n- Extend to other subjects\n- Integrate with a frontend\n- Enable multilingual answers\n\n\n## License\n\nMIT License. See [LICENSE](LICENSE) for details.\n\n## 📢 Disclaimer\n\nThis project uses publicly available NCERT Class 10 Social Science textbook content strictly for **educational and non-commercial** purposes. No part of the original textbook is redistributed or hosted in any form. The model has been trained on internally processed data derived from the textbook for the sole purpose of demonstrating a retrieval-augmented question-answering system. All QA pairs are **AI-generated** and **do not contain or replicate original NCERT text**.\n\nThis repository is not affiliated with or endorsed by NCERT. If you are a representative of NCERT and believe there is a compliance issue, please contact me, and will promptly take corrective action.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flijoraju%2Fcharitra-retrieval-augmented-qa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flijoraju%2Fcharitra-retrieval-augmented-qa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flijoraju%2Fcharitra-retrieval-augmented-qa/lists"}