Building an AI Tutor with Enhanced LLM Accuracy Through Knowledge Base Integration

clipping · Education · 2023 · source Agentic: no · promotional bias: med · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: High-stakes educational tutoring

Clipping needed an AI tutor for Brazil's diplomatic career exam that reduced hallucinations, outdated knowledge, and language bias enough to be useful in a high-stakes learning context.

Constraints:

Architecture

ClippingGPT augments GPT with an external proprietary knowledge base. The system splits documents into chunks, creates embeddings with OpenAI's API, stores embeddings in Redis as a vector database, embeds the user's question, ranks relevant chunks by semantic distance, and sends those chunks as context to GPT through the Completion API.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  student[Student] --> clippinggpt-tutor[ClippingGPT Tutor]
  knowledge-base[Knowledge Base] --> chunking-pipeline[Chunking Pipeline]
  chunking-pipeline --> embedding-pipeline[Embedding Pipeline]
  embedding-pipeline --> redis-vector-db[Redis Vector DB]
  clippinggpt-tutor --> query-embedder[Query Embedder]
  query-embedder --> redis-vector-db[Redis Vector DB]
  query-embedder --> clippinggpt-tutor[ClippingGPT Tutor]
  clippinggpt-tutor --> gpt-completion-api[GPT Completion API]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Student Learner asking exam-preparation questions. ClippingGPT Tutor
ClippingGPT Tutor Conversational tutor using retrieved exam knowledge. Query Embedder, GPT Completion API
Knowledge Base Trusted proprietary exam-preparation corpus. Chunking Pipeline
Chunking Pipeline Splits source documents into retrievable sections. Embedding Pipeline
Embedding Pipeline Uses OpenAI embeddings for documents and queries. Redis Vector DB, Query Embedder
Redis Vector DB Stores document embeddings and supports semantic retrieval. Query Embedder
Query Embedder Embeds user questions and ranks relevant chunks. ClippingGPT Tutor, Redis Vector DB
GPT Completion API Generates final answers from enriched context. ClippingGPT Tutor

Data flow

Documents are chunked, embedded, and stored in Redis. When a student asks a question, the query is embedded, relevant chunks are ranked by distance, and the selected context is sent to GPT to produce an answer grounded in Clipping's knowledge base.

“* split documents into sections (chunks); * transformed each chunk into an embedding using OpenAI API.”article, stated
“In step 3, the model incorporates these relevant chunks as context into a message sent to GPT. This enriched query is then sent to OpenAI’s Completion API, which generates and returns the answer.”article, stated

Why this architecture

Clipping chose embeddings/RAG because the failure was knowledge accuracy, not style. Grounding answers in a trusted external knowledge base directly targets hallucinations, outdated content, and local-domain blind spots.

“embeddings_ is recommended as a way to teach the model knowledge. In our case of use, we were looking to avoid hallucinations”article, stated
“the responses will be sourced from a trusted origin, thereby mitigating the possibility of inaccuracies.”article, stated

Models used: GPT-4 · OpenAI Embeddings API · OpenAI Completion API

Scale

Alternatives considered (roads not taken)

Use generic ChatGPT/GPT-4 alone.

Rejected because: Generic LLMs hallucinate and lack current specialized exam knowledge.

“When learning a new skill or studying for a high-stake test, being plausible-sounding is counter-productive if not dangerous.”article, stated

Fine-tune for the core knowledge problem.

Rejected because: The team viewed fine-tuning as more suited to style, while embeddings teach knowledge.

“Fine-tuning is better suited to teaching the model a style, while embeddings is recommended as a way to teach the model knowledge.”article, stated

Rely on pretraining currency.

Rejected because: The exam requires up-to-date knowledge, and GPT-4 has cutoff limitations.

“* (3) Being up-to-date is core part of this examination: candidates are expected to keeping up-to-date with developments in the subject areas above, mainly regarding the latest events in international politics.”article, stated

Patterns

rag-retrieval (education)

The tutor retrieves relevant knowledge-base chunks before generating answers.

“It then analyses the distance between the user’s query embedding and the embeddings of various chunks.”article, stated

retrieval-ranking (knowledge)

Chunks are ranked based on relevance to the query embedding.

“it ranks these chunks based on their relevance, signifying where the potential answer may be found.”article, stated

eval-driven-development (benchmarking)

Clipping validated the approach by blind grading exam answers and comparing against GPT-4 and approved candidates.

“we compared the final score achieved by Clipping GPT with 2 parameters”article, stated

Tradeoffs

Adaptation mechanism

Chose Embeddings and retrieval over Fine-tuning as the main technique.

Rationale: The goal was factual knowledge recall, not style imitation.

“Therefore, embeddings felt the natural approach.”article, stated

Benchmark choice

Chose Diplomatic career entrance exam over Generic education QA benchmark.

Rationale: The exam stresses local, current, high-stakes knowledge.

“It is one the most complexes and examinations in LATAM”article, stated

Gotchas (what bit them)

Fluency can be actively harmful in education.

Root cause: Students may trust plausible-sounding but wrong answers while studying.

Resolution: Ground tutoring answers in a trusted external knowledge base.

“the risks of widespread misinformation when learning is far more alarming.”article, stated

External knowledge does not eliminate every hallucination.

Root cause: Some subjects still require local, current, or highly specialized content.

Resolution: Treat RAG as mitigation and continue prompt/retrieval iteration.

“Accuracy substantially improved. However, hallucination were not completely eliminated.”article, stated

Evaluation

Clipping evaluated by generating answers to official 2022 exam questions, blind-grading them with specialized teachers, repeating with ClippingGPT, and comparing against GPT-4 and approved candidates.

Metrics: Exam score · Rank among approved candidates · Performance vs GPT-4 · Subject-level gap · Hallucination reduction

“we asked a group of teachers specialised in preparing candidates for the diplomatic exam to rate the answers without prior knowledge”article, stated

Outcomes

The source reports a 94% approval-rate business context, 26% outperformance over GPT-4, 23rd place among 35 approved candidates, and Redis-backed embedding retrieval.

“model on an external knowledge base can dramatically enhance the accuracy of the AI’s responses.”article, stated