伊利诺伊大学厄巴纳-香槟分校人工智能助教
UIUC AI Teaching Assistant

原始链接: https://github.com/Center-for-AI-Innovation/ai-teaching-assistant-uiuc

该项目是一个开源的多模型系统,专为电子工程(ECE 120)课程辅导而设计,通过并行运行 11 个模型,实现了两秒的平均响应时间。该系统利用由 Pinecone 支持的检索增强生成(RAG)技术,整合了教科书、讲座视频和学生论坛的数据。 一项关键的技术贡献是在强化学习(RLHF)过程中实现的一种新型语义搜索检索方法,该方法利用了 Hugging Face 上提供的开源学生生成问答对比数据集。为确保系统质量,团队使用内部专家数据集进行迭代评估,借助 GPT-3 将模型性能与人工编写的标准答案进行比对评分——他们也承认该方法可能存在潜在偏差。 该项目完全开源(商业教科书除外)且具有高度的模块化,鼓励用户接入自己的文档数据库。代码库包含用于提示词工程、评估和基于 Gradio 的用户界面的专用脚本。通过在每次功能发布时自动执行测试流程,开发人员能够保持系统的高性能和可靠性。用户只需提供自己的 API 密钥并按照说明进行设置,即可轻松部署该系统。

抱歉。
相关文章

原文

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)

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.

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.

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.

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!

  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
  • 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.
联系我们 contact @ memedata.com