Tool

Answer course questions using multi-modal retrieval

This UIUC project is a retrieval-augmented QA teaching assistant for electrical engineering, running 11 models in parallel with a 2s median response.

Works with pineconehuggingfacegpt 3chatgptgradio

91
Spark score
out of 100
Updated Apr 2023
Version 1.0.0
Models
gpt 4ogemini 2 0

Add to Favorites

Why it matters

Deploy an AI teaching assistant that answers student questions by retrieving and synthesizing information from textbooks, lecture videos, and forum discussions, using parallel model execution and RLHF-tuned responses to provide accurate, context-aware answers for electrical engineering coursework.

Outcomes

What it gets done

01

Index course materials from PDFs, video transcripts, and lecture slides into a searchable vector database

02

Run 11 parallel models for text/image retrieval, generation, moderation, and ranking to generate answers

03

Evaluate answer quality using GPT-3 comparison against ground-truth responses from expert engineers

04

Collect user feedback through a Gradio web interface to continuously improve response accuracy

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/center-for-ai-innovation-ai-teaching-assistant-uiuc | bash

Overview

Ai Teaching Assistant Uiuc

This UIUC project is a retrieval-augmented AI teaching assistant for Electrical Engineering that runs 11 text/image retrieval, generation, moderation, and ranking models in parallel over a Pinecone document store, with a median 2-second response time and an iterative GPT-3-judged evaluation loop. Use it as a reference for building a domain-specific retrieval-augmented QA system - plug in your own Pinecone document set; it needs your own data pipeline and API keys and is not a drop-in assistant for other courses out of the box.

What it does

This project is a multi-media question-answering and search system built as an AI teaching assistant for Electrical Engineering courses at UIUC, positioned as "better than Google" for that specific domain. It runs 11 separate models in parallel for text/image retrieval, generation, moderation, and ranking, and still achieves a median 2-second response time. Answers are grounded in retrieval-augmented generation over course material: textbooks, lecture videos, and student QA forums, ordered subjectively by importance - though the source notes none of this underlying data is publicly available, since the project was not granted redistribution rights by the original authors.

A specific research contribution documented here is semantic search retrieval during RLHF (reinforcement learning from human feedback), using a dataset iteratively produced by hiring a team of five Electrical Engineering students, covering material for UIUC's ECE 120 (Intro to Electrical Engineering) course; that RLHF comparison dataset is published openly on Hugging Face. To evaluate whether each new feature helps or hurts, the team maintains an in-house evaluation dataset of QA pairs written by expert electrical engineers, generates answers from each model, and asks GPT-3 to judge whether each generated answer is "better" or "worse" than the human-written ground truth - with the documented limitation that GPT-3 evaluating GPT-3's own outputs is likely biased toward rating itself favorably, and the source suggests re-running the same evaluation with Cohere's models as a check.

When to use - and when NOT to

Use this project as a reference implementation or starting point for building a retrieval-augmented QA system over your own domain-specific document set - the source explicitly encourages plugging in your own Pinecone database of documents and reusing the pipeline in your own work, and it is fully open source apart from the commercial textbook content it was originally built against. It's a fit for anyone studying how to combine multiple retrieval, generation, and ranking models in parallel while keeping response latency low, or how to structure an iterative, LLM-judged evaluation loop for a QA system.

It is not a turnkey, drop-in teaching assistant for other courses without setup work: you need to build your own Pinecone document store from your own source material (the project ships data-cleaning utilities for textbook PDFs and Whisper video transcripts as a starting point) and supply your own API keys for the models it calls.

Inputs and outputs

Input is your own document set (textbook PDFs, lecture transcripts, or plaintext) converted into a Pinecone vector database using the project's own data-cleaning notebooks, plus API keys for the models enumerated in run_ta_gradio.sh. Setup:

pip install -r requirements.txt
bash run_ta_gradio.sh

Output is a running Gradio web app that answers user questions by retrieving relevant passages from the Pinecone store and generating a response across the 11 parallel models, plus a feedback.json file collecting real user feedback submitted through the app, and, when the evaluation script is run, a comparison of each model's answers against the expert-written ground truth.

Integrations

The system integrates with Pinecone as its vector database for retrieval-augmented generation, Gradio for the web UI (TA_gradio_ux.py), Whisper for generating lecture-video transcripts to feed into the document store, and GPT-3 (with Cohere suggested as a cross-check) for automated answer-quality evaluation. main.py aggregates the project's multiple LLM implementations, and prompting.py holds the project's prompt-engineering work.

Who it's for

Educators, researchers, and developers building or studying retrieval-augmented teaching-assistant or domain-QA systems - especially anyone who wants a working example of running several retrieval, generation, and ranking models in parallel with low latency, or of structuring an iterative, LLM-judged evaluation loop to track whether new features actually improve answer quality.

Source README

"Better than Google" Multi-Media QA & Search for Electrical Engineering at UIUC

We're live on HuggingFace: ๐Ÿ‘‰ https://huggingface.co/spaces/kastan/ai-teaching-assistant ๐Ÿ‘ˆ

System diagram

Our system runs 11 separate models in parallel for text/image retrieval, generation, moderation and ranking and still achieves a median 2-second response time.

NCSA AI Teaching Assistant -- Detailed diagram (5)

Data

We use data from textbooks, lecture videos, and student QA forums (ordered, subjuctively, by importance). None of this data is currently available publically because this project was not granted those rights by the authors.

RLHF

My favorite contribution is the novel approach of semantic search retrieval during RLHF, using a dataset I iteratively produced by hiring a team of five Electrical Engineering students. That data is freely available on Huggingface here: https://huggingface.co/datasets/kastan/rlhf-qa-comparisons. We specifically cover the material necessary in the UIUC course ECE 120, intro to Electrical Engineering.

Evaluation

We have a lot of models here. To evaluate which ones are helping, and which hurt, every time we push a new feature we re-run this evaluation. Our evaluation dataset of QA pairs is produced in house, written by expert electrical engineers. Using these questions, we generate answers with each of our models. Finally, we ask GPT-3 if the generated are "better" or "worse" than the ground truth answers written by humans. One limitation is that GPT-3 evaluates itself. GPT-3 nearly always thinks that GPT-3 is great, which is probably not true and a limitation of this evaluation method. Maybe we should run this same evaluation with Cohere's models to compare.

Nevertheless, iterative evaluation was crucial to ensure our new features were making our system better.

See the full evalaution results here. See the evaluation code here.

Bar chart showing GPT-3 is the best, with ChatGPT in 2nd place and OpenAssistant in 3rd place.

Usage

This project is fully open source, with the exception of commercial textbooks. I highly encourage you to simply plug in your own Pinecone database of documents and use this in your work!

๐Ÿš€ Install

  1. Python requirements
# Tested on python 3.8
pip install -r requirements.txt
  1. API keys

We rely on these APIs enumerated in run_ta_gradio.sh. Be sure to add your own ๐Ÿ˜„

  1. Document store for retrieval-augmented generation

Simply build your own Pinecone database of your documents. We open source the scripts we use for this, where our source material is in PDF or plaintext and our lecture slides are .jpg images (sneakily exported from .pptx).

Data cleaning utils:

And you're done! You can now run the app ๐ŸŽ‰

# run web app!
bash run_ta_gradio.sh

Files

  • main.py: The main aggregator of our many LLM implementations.
  • TA_gradio_ux.py: Defines the Gradio UX, and calls models defined in main.py.
  • prompting.py: Our home for prompt engineering.
  • evaluation.py: Run GPT-3 powered evaluation of our system. We routinely run this to determine if each additional feature makes responses "better" or "worse".
  • feedback.json: Collection of real user feedback via the Gradio web app.
  • run_ta_gradio.sh: Entrypoint launch script.

FAQ

Common questions

Discussion

Questions & comments ยท 0

Sign In Sign in to leave a comment.