All projects

AI project · Case study · private code

Course assistant

A local assistant that finds the right page among 12,500 pages of course notes and standards.

corpus
12,500 pages
standards
SIA 260 to 267
runs
locally, on CPU
The assistant in dark theme, source pages blurred

The project

I ask a course question. The assistant finds the right page among 12,500 (bachelor and master course notes, SIA 260 to 267 standards), highlights the passage and writes a cited answer.

The problem

Five years of civil engineering courses and the SIA 260 to 267 standards are scattered across hundreds of PDFs. During an exercise, I lose time looking for a formula or a table value. A keyword search does not understand the question: "what concrete cover for a wall exposed to de-icing salts?" rarely returns the right table of SIA 262.

What it does

An answer I can check at the source

  • 01

    Search by meaning

    The search combines the meaning of the question with keywords. I do not need the exact term my course used.

  • 02

    Sourced answer

    Every answer cites its sources page by page. I can export it as a PDF with its source pages.

  • 03

    Highlighted pages

    I see a capture of the source page with the passage it found highlighted, and I can open the PDF at the right page.

  • 04

    Readable tables

    Tables from the standards are read correctly, even with merged cells.

  • 05

    Calculator

    The model calls a calculator for every calculation.

  • 06

    Attached image

    I paste a photo of an exercise statement or a diagram, and the assistant reads it along with my question.

  • 07

    Offline mode

    Without internet, the assistant still returns the closest pages and passages. A button forces this mode too.

  • 08

    It learns from my feedback

    One click on "relevant" or "off topic" for a page corrects the next searches.

In pictures

From question to cited answer in seconds.
Home screen of the assistant: question field and four suggested questions
Home screen of the assistant: a plain-language question is all it takes.
Assistant answer with formulas, numbered citations and six blurred source page cards
A written answer with formulas, numbered citations and source pages (blurred).
Side panel open on a blurred source page with the passage highlighted, next to the answer
The relevant passage is highlighted in the original page, open beside the answer.
Assistant answer in dark theme
Dark theme.
Start of an assistant answer on a phone screen
The interface adapts to phones.

How it works

From question to cited answer

01 Question "What concrete coverfor a wall exposedto de-icing salts?"Text or photo 02 Rewording A language modeladds the likelytechnical terms 03 4 searches Meaning (e5)Keywords (BM25)Exact reference("table 18")Inside the citedstandard 04 Reranking A second modelrereads the bestpages and reordersthem 05 6 pages The six best pages,with their unfoldedtables and theircaptures 06 Answer A language modelwrites a citedanswer, page bypage 01 Question "What concrete cover for a wallexposed to de-icing salts?"Text or photo of a statement. 02 Rewording A language model adds the likelytechnical terms to the question. 03 4 searches Meaning (e5), keywords (BM25),the exact reference ("table 18")and inside the cited standard. 04 Reranking A second model rereads the bestpages and reorders them. 05 6 pages The six best pages, their unfoldedtables and their captures go to alanguage model that writes. 06 Cited answer Citations page by page, with pagecaptures and the passagehighlighted.

Two things happen only once, before any question: the meaning fingerprints of every page, computed locally on my PC by a small model (multilingual-e5-small, through sentence-transformers), and the transcription of handwritten pages by a vision model.

For each question, a language model rewords it and adds the likely technical terms. Four searches combine, then a cross-encoder rereads the best pages and reorders them, with at most three pages per PDF. The top six go with their tables and captures to the model that writes the answer. A question costs a few cents.

  • 15

    Subjects

    Bachelor, Master and standards are mixed by subject, for 12,500 pages in total.

  • 1,830

    Pages with tables

    Each table is unfolded into readable lines before it is indexed.

  • 1,380

    Handwritten pages

    Transcribed once by a vision model, for about $0.70.

  • cents

    Per question

    A question costs a few cents of language model calls.

What held up

Tables from the standards read badly as plain text

Text extracted from a PDF loses square roots, subscripts, fractions and merged cells. A table in a standard is made of exactly that.

While testing the cover question, the two language models I use, GLM and Claude Haiku, kept copying table 18 of SIA 262 with 55 mm for class XD2a instead of 40 mm. The cause was merged cells that neither the extracted text nor the image rendered without ambiguity.

In structural design, a wrong value like that spreads through the whole calculation. So I added a step that unfolds each table into readable lines before it reaches the model (1,830 pages have tables). The values have been right since.

It is the same reflex as in my master's work: an AI result gets checked against the standard.

CPU

No graphics card

Everything runs on the CPU. A larger reranking model, bge-reranker-v2-m3, took about 16 s, too long for a tool you query in the middle of an exercise. I kept a lighter cross-encoder. Cutting the candidates to 20 and 384 tokens gained nothing and missed pages.

14 s

A shorter startup

It went from about 21 s to 14 s when warm. The encoder and the cross-encoder load in parallel while the app reads a cached lexicon. The rest of the time is importing torch and transformers, which I cannot shrink.

Measurement

A control set of 10 questions

10/10

Pages found

The right page is found for each of the 10 questions.

1.3 to 1.4

Mean rank

Mean rank of the right page. The result shifts a little with the keywords the model generates, so I rerun it when in doubt.

This 10-question set is a regression check: it warns me when a change breaks the search. It is too small to support any statistics.

What's next

Retrain the reranking, keep the tool private

I will retrain the reranking once I have about 200 "relevant" or "off topic" ratings (the interface keeps the count). I will keep the new model only if it does not make the 10-question check worse.

The tool stays private and local, because some of my courses forbid sharing.

Tech stack

  • Python
  • FastAPI
  • PyMuPDF
  • sentence-transformers
  • multilingual-e5-small
  • BM25
  • mMiniLM cross-encoder
  • GLM and Claude Haiku via OpenRouter
  • web interface, no framework
  • dedicated app window

See the other projects

Contact

Let's talk?