AWS Builder Center
Scholia - AI study assistant for your lectures, slides and notes

Scholia - AI study assistant for your lectures, slides and notes

Scholia is an open-source study agent I built for my own Master's studies. You give it a course: lectures, slides, notes and caption files. Then you ask questions in your own words. It runs on AWS with two Go Lambda functions, Amazon Bedrock and S3 Vectors.

Member of Technical Staff @ CDL, MSc. Student @ UvA
TL;DR: Scholia  is an open-source study agent I built for my own Master's studies. You give it a course: lectures, slides, notes and caption files. Then you ask questions in your own words. It runs on AWS with two Go Lambda functions, Amazon Bedrock and S3 Vectors. The whole design follows three rules.
First, every answer comes from the course and shows its source. A claim points to the page, the slide or the second in the lecture where it came from.
Second, a lecture citation plays the lecture at that second. One click opens the recording at the moment the cited sentence was spoken.
Third, the agent says when the course has nothing. Only then does it search the web, and web results are labelled apart from course sources.

The problem

Why not just use a general chatbot?
I built Scholia for myself first. During my Master's studies, my course material sat in recorded lectures, slide decks and PDFs. A general chatbot answers fluently, but it does not know which course I am taking. It mixes in other textbooks and other notation, and it gives me no way to check a claim against the lecture.
So the requirements came from my own study sessions:
RequirementWhat it means for the design
Answers only from my courseRetrieval over the files I uploaded, one course per chat
Every claim can be checkedEach extracted span keeps a locator: page, slide or caption time
Jump to the lectureA caption time plus the lecture's video id opens the recording at that second
Honest gapsSay when the course has nothing, then try the web and label it
Try it without signing upGuest sessions with a daily quota, deleted after 48 hours
Cheap to runServerless, daily quotas, a budget alert
Then I made it open source, so any student can use it the same way.

Challenge 1: the lecture moment

How does a citation open the lecture at the right second?
Every piece of content keeps a source locator, all the way from upload to answer. A WebVTT caption file gives each passage a start and end time. A PDF gives a page, and a slide deck gives a slide number. The worker stores the locator on every chunk, and the answer's citation carries it to the browser.
For a lecture with a published recording, the source also stores its YouTube video id. The web app turns time plus video id into a youtube-nocookie embed that starts two seconds early, so you hear the start of the sentence. The video id is validated against YouTube's 11-character format before it can reach the page.
The public demo course is MIT OpenCourseWare 6.006 Introduction to Algorithms (Spring 2020). I asked "Why can't Dijkstra handle negative edge weights?". The answer cited Lecture 14 (APSP and Johnson) at 9:43, and Watch 9:43 opened the lecture at 9:41. You do not have to scrub through a full recording to find the explanation.

Challenge 2: deciding what to do

What happens before the model writes a word?
Each message goes through five steps:
  1. Route. A small classifier call picks a task: answer a question, solve an exercise step by step, review my own work, or run a mock exam. It also flags messages that are off-topic or unsafe.
  2. Refuse early. An off-topic message gets a one-line pointer back to the course. Abuse, jailbreak attempts and harmful requests are declined before the main call. A message about self-harm gets support resources instead of a rule.
  3. Retrieve. Hybrid search runs over the course: Titan Text Embeddings V2 vectors in S3 Vectors and a BM25 keyword pass, merged by reciprocal rank fusion. Small chunks are searched, and the model reads their larger parent passage. A per-source cap keeps one long textbook from crowding out the lectures.
  4. Fill gaps from the web, or say so. When the course has fewer than two passages for a question or an exercise, the agent runs one Tavily web search. Web results show as [W1] and [W2], apart from course sources. Reviews and mock exams never use the web. If neither source has anything, the reply is "I don't have anything in this course that answers that".
  5. Answer with sources. Amazon Nova 2 Lite streams the answer and cites passages as [1] and [2]. The source list under the answer shows each file, section and locator.
Course passages, web results and attachments reach the model inside <untrusted_content> tags. An instruction hidden in an uploaded PDF is data, not a command. Server-paid calls also pass through an Amazon Bedrock Guardrail.

Challenge 3: running it on AWS

What runs where?
ComponentJob
CloudFrontServes the React app from a private S3 bucket and forwards /api/* to the API with origin access control
API Lambda (Go, arm64)A plain http.Handler; streams answers as server-sent events
Amazon BedrockNova 2 Lite for answers, Titan Text Embeddings V2 for vectors, a Guardrail on server-paid calls
S3 VectorsThe vector index, one per embedding model
DynamoDBOne table for courses, sources, chunks, chats, messages and daily usage
S3, SQS and the worker LambdaUpload by presigned URL, an S3 event to a queue with a dead-letter queue, then extract, chunk and embed
CognitoEmail sign-in codes
Secrets Manager and KMSThe session secret and the Tavily key, encrypted with a customer-managed key
TavilyWeb search, only when the course is thin
Cost and safety controls are small and boring on purpose:
  • Least privilege. Each function has its own IAM role.
  • Kill switch. An SSM parameter pauses server-paid model calls without a deploy.
  • Quotas. A guest gets 30 messages and 10 web searches a day. A signed-in user gets 100 messages and 40 web searches.
  • Budget. An AWS Budget alerts at 20 USD a month.
  • Logs only. CloudWatch Logs is the only monitoring.
Everything is in Terraform. The repo runs in Docker: floci for local AWS, testcontainers for integration tests, and one make ci target for lint, tests with an 85% coverage gate, govulncheck, gosec, Trivy and the Terraform tests.

Proof it works

How do I know it works?
Scholia is live at scholia-aws.mol.la . The demo course is seeded, and all 39 files are ready: caption transcripts for 19 lectures, lecture notes for 18 of them, Pat Morin's Open Data Structures, and an attribution file. The 39 files went from queued to ready in a few minutes.
CheckResult
Smoke test on the live site8 of 8 pass: web app, routing, API health, guest session, public course, new chat, streamed answer
Lecture citationsAll 19 lecture sources carry a video id, and answers cite time locators that open the player
Web fallback"What is a Bloom filter?" is not in the course; the answer cites five Bloom filter pages as W1 to W5
Go testsRace detector on, 89.4% coverage on internal/ (gate 85%)
Web tests236 tests, 96.4% coverage
Accessibilityaxe-core WCAG 2.2 AA audit at 375, 768 and 1280 px: no violations in my code, no sideways scroll
Security scansgovulncheck, gosec and Trivy clean in CI
The 59-second demo video shows the whole flow.

Try it

  • Live demo: scholia-aws.mol.la . Press "Try the demo, no sign-up".
  • Source code: github.com/SumonMSelim/scholia-aws . Go, Terraform and React in one repo.
  • Good first questions: "Why can't Dijkstra handle negative edge weights?", "Why is size a subtree property?", "Give me a mock exam on hashing."
The demo uses only openly licensed material: MIT OpenCourseWare 6.006 Introduction to Algorithms, Spring 2020, by Erik Demaine, Jason Ku and Justin Solomon (CC BY-NC-SA 4.0 ), and Open Data Structures by Pat Morin (CC BY 2.5 CA ). Neither MIT nor the authors are affiliated with Scholia or endorse it.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article