GithubHelp home page GithubHelp logo

luffycodes / tutorbot-spock Goto Github PK

View Code? Open in Web Editor NEW
31.0 2.0 3.0 6.29 MB

An Education Tutoring Chatbot based on Learning Science Principles powered by Large Language Models

Python 96.74% Shell 3.26%
biology-education gpt intelligent-tutoring-system large-language-models chatbot llama transformers vicuna vicuna-13b

tutorbot-spock's Introduction

CLASS Meet SPOCK: An Education Tutoring Chatbot based on Learning Science Principles (Accepted at EMNLP 2023)

To read about more details, please refer to the arxiv paper: https://arxiv.org/abs/2305.13272
For more related informationn, find the CLASS slides here.
To read about the follow-up work, refer to Pedagogical Alignment of Large Language Models

Overview

We aim to develop more effective educational tutoring chatbots (Spock) that help students deepen their understanding of academic subjects. To train the chatbot, we create a synthetic dataset of mock conversations between a student and a tutor based on learning science principles like scaffolding. We employ a specialized prompt to generate these mock conversations using OpenAI's GPT-4 APIs. Leveraging these conversational datasets, we supervise fine-tune the chatbots from Mistral, Zephyr, and Vicuna using FastChat and then rlhf fine-tune the chatbots using TRL.

Inference

To use the models, first install the fastchat library into the root dir, and then follow the steps here:

  1. Update the conversation.py from our repository in the FastChat folder.
  2. Update the inference.py from our repository in the FastChat folder.
  3. Use the apply_delta.py on Spock-Bio-Llama-Diff to get actual model weights.
    • Example: python3 -m fastchat.model.apply_delta --base decapoda-research/llama-13b-hf --target tutorbot_spock_vicuna_prompt_v3 --delta luffycodes/tutorbot-spock-bio-llama-diff
    • Also, please put vicuna in the target model name since conversation.py and inference.py check if vicuna is a substring in a model name and change conversation starter and inference prompts respectively. Note we modify vicuna prompts so you would not able to able to use original vicuna models unless you revert back changes to conversation.py and inference.py.
  4. Build a biology index with OpenStax Biology 2e textbook. Put the generated os_bio_2e_index.faiss and the openstax_biology_2e.csv in same folder as inference.py i.e. FastChat/fastchat folder.

For easier access of the models, download them directly from Hugging Face.
SFT Models:

SFT + DPO Models:

Creating synthetic conversation and scaffolding datasets to train Spock for subjects other than Biology

Example of generating conversational dataset using GPT

  1. Run the mock_con_GPTx_prompt_v3.py
  2. Remember to put openai.organization and openai.api_key in the file
  3. To create a scaffolding dataset, use prompts in folder

Training and Evaluation

Please refer to a more detailed readme.md inside the rlhf folder for training and evaluating the models.

If you use this work, please cite:

@misc{sonkar2023class,
      title={CLASS Meet SPOCK: An Education Tutoring Chatbot based on Learning Science Principles}, 
      author={Shashank Sonkar and Lucy Liu and Debshila Basu Mallick and Richard G. Baraniuk},
      year={2023},
      eprint={2305.13272},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

@misc{sonkar2024pedagogical,
      title={Pedagogical Alignment of Large Language Models}, 
      author={Shashank Sonkar and Kangqi Ni and Sapana Chaudhary and Richard G. Baraniuk},
      year={2024},
      eprint={2402.05000},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

tutorbot-spock's People

Contributors

kangqi-ni avatar luffycodes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.