<aside> 🎓

PaperTrial — Complete Technical Overview

The definitive technical document detailing every implemented feature, pipeline, and architectural flow in the PaperTrial ecosystem.

</aside>

Live : https://paper-trial.vercel.app/


1. Product Vision

PaperTrial is a fully functional, AI-powered academic thesis defense simulator.

Defending a thesis is a high-anxiety bottleneck for university students. PaperTrial acts as a hyper-realistic, adversarial AI professor that ingests the user's PDF thesis, finds methodological weaknesses, and grills them verbally in real time.

Unlike generic chatbots, PaperTrial forces the user into a high-pressure, voice-only live environment while tracking academic integrity and grading spoken answers against the exact text of the uploaded thesis.


2. Complete Feature Catalog

Every single feature actively implemented and running in the current PaperTrial ecosystem.

🔐 Core System & Authentication

# Feature Description
F1 Next.js Clerk Authentication Secure login and signup portal via Clerk UI.
F2 Backend JWT Validation FastAPI decodes JWTs to enforce strict row-level security for user data.
F3 Drag & Drop Upload UI React dropzone for securely uploading PDF thesis files.

⚙️ Ingestion & Processing Pipeline

# Feature Description
F4 PyMuPDF Text Extraction Uses fitz.open() to extract raw text, identify paragraphs, and preserve page metadata.
F5 Live SSE Progress Tracking Backend streams JSON updates via Server-Sent Events to a live UI progress bar.
F6 Semantic Text Chunking LangChain RecursiveCharacterTextSplitter divides text into ~500-character chunks with overlap.
F7 Google Vertex AI Embedding text-embedding-004 converts chunks into 768-dimensional dense vectors.
F8 PostgreSQL pgvector Storage SQLAlchemy stores vectors in an HNSW-indexed pgvector database for fast retrieval.

🧠 Intelligence & Analysis Layer

# Feature Description
F9 Structural Flaw Detection Gemini 2.5 Flash analyzes chunks to detect sampling bias, logic gaps, and methodology issues.
F10 Attack Question Synthesis Gemini 2.0 Flash condenses weaknesses into exactly 5 targeted attack questions.
F11 Thesis Health Scoring Aggregate pre-defense score across 5 dimensions.
F12 Pre-Defense Radar Chart Recharts radar visualization of the health dimensions.

🎙️ Live Audio Defense Engine

# Feature Description
F13 Session Initialization FastAPI manages session state and loads the first attack question into the defense queue.
F14 Real-time Mic Streaming Frontend uses MediaRecorder to stream audio bytes over secure WebSockets.
F15 Deepgram STT Low-latency speech-to-text transcription of spoken answers.
F16 Voice Metric Tracking Real-time Words Per Minute measurement to estimate confidence and hesitation.
F17 Academic Integrity Tracker visibilitychange listener deducts points if the user switches tabs to reference notes.
F18 RAG Context Retrieval Embeds the spoken transcript and retrieves top-3 relevant thesis segments via cosine similarity.
F19 Real-time Gemini Grading Grades transcript vs retrieved context, scoring accuracy, depth, and coherence.
F20 ElevenLabs Voice Synthesis Generates an authoritative AI professor voice through TTS.