AI / MLCompleted3 min read

MentorAI

RAG Platform

MentorAI

Overview

MentorAI is a full-stack RAG-powered learning platform comprising a Next.js 16 frontend, NestJS backend, and three Python FastAPI microservices (inference, training, processing). Users upload educational documents (PDFs, research papers) which are processed through a custom pipeline: extraction, cleaning, section splitting, chunking, and knowledge-unit creation. Embeddings are generated using BAAI/bge-small-en-v1.5 via sentence-transformers and indexed in FAISS. At query time the system retrieves the top-K most relevant chunks and passes them as context to a fine-tuned Qwen2.5-0.5B/7B LLM (trained via QLoRA using the mentorai-finetuning package), producing answers that cite their sources. The platform includes a standalone fine-tuning CLI (mentorai-cli) supporting SFT, LoRA, and QLoRA with hardware-aware auto-planning.

Problem & Solution

The Problem

Technical learners waste hours searching docs and tutorials when they need a specific, contextual answer grounded in their actual study material.

The Solution

Full-stack RAG platform with custom document processing, dense retrieval via sentence-transformers + FAISS, and a fine-tuned Qwen2.5 LLM for grounded, cited responses.

Architecture & Dataflow

Pipeline Architecture
Documents → Processing Pipeline (extract, clean, section split, chunk) → Knowledge Units → sentence-transformers (bge-small-en-v1.5) → FAISS Index → Retrieval (Top-K) → Qwen2.5 (QLoRA) + Context → Grounded Response with Citations

Technical Stack & Implementation

AI / ML & Models

  • Qwen2.5-0.5B/7B (QLoRA fine-tuned)
  • sentence-transformers (BAAI/bge-small-en-v1.5)
  • FAISS
  • HuggingFace Transformers
  • PEFT
  • TRL

Backend & APIs

  • NestJS
  • TypeScript
  • TypeORM
  • FastAPI (3 microservices)
  • Python

Frontend & UI

  • Next.js 16
  • React 19
  • TypeScript
  • Tailwind CSS

Data & Storage

  • PostgreSQL
  • Redis

DevOps & Infra

  • Docker
  • Swagger/OpenAPI

Technical Challenges & Solutions

01

Choosing optimal chunk size and overlap for technical documentation

02

Fine-tuning a small model (0.5B) to produce quality responses with RAG grounding

03

Coordinating 5 services (NestJS + 3 FastAPI + Next.js) in a coherent architecture

Key Highlights & Results

Full pipeline implemented: document processing → embedding → retrieval → fine-tuned generation

Trained QLoRA adapters with evaluation via ROUGE, BLEU, BERTScore, and LLM-as-Judge

Dataset of curated research papers (Attention Is All You Need, BERT, LLaMA, QLoRA, RAG, MLOps, CV)

Custom document processing pipeline (PDF extraction, section detection, chunking, knowledge-unit creation)
Dense retrieval with BAAI/bge-small-en-v1.5 embeddings + FAISS vector store
Fine-tuned Qwen2.5 LLM (SFT / LoRA / QLoRA) via mentorai-cli
Multi-service architecture: NestJS API + 3 FastAPI AI microservices
Retrieval-augmented generation with source citations
Hardware-aware auto-planning for GPU/CPU training
Standalone fine-tuning package (mentorai-finetuning) with evaluation suite