You don’t need to be a pessimist to imagine a world where students let AI tools do their homework and teachers use AI tools to evaluate students’ submissions. Maybe there is still a chance for a better outcome.
For educators, it’s easy to perceive AI tools as a threat or a tool that almost invites students to cheat. Not as easy, but still plausible, is an approach that integrates AI tools into teaching.
For a given task like “write a program that prints the first 100 prime numbers,” it’s easy for students to open ChatGPT, enter the task, and copy/paste/submit the output. Not as easy, but certainly more rewarding, is an approach that allows students to embrace feedback from an AI-tool, before submitting their work.
I created a rather simple web service (dubbed AI-Tutor) that supplements incoming requests, before sending them on to a generative AI service.
To keep the conversation focused and to allow for follow-up questions, AI-Tutor maintains objective and context. It allows students to ask questions about a programming task and maybe more importantly, can evaluate a proposed solution and provide ongoing feedback.
AI-Tutor + Colab
To let students easily interact with AI-Tutor, I integrated the service into Colab. Google Research provides Colaboratory, or Colab for short, for free. Colab allows anybody to write and execute source code through their web browser. I.e., you don’t need to have Python or an IDE installed on your computer.
For instance, in Colab, users can write Python programs in Jupyter Notebooks. The code is placed into Jupyter cells and executed by pushing the execute button. Notebooks can easily be shared, by simply sharing a URL.
A task is a programming exercise that students need to solve. Here are three examples:
- Find the first 100 prime numbers
- Roll a dice until you have rolled six twice in a row
- Ask a user for their name and output the number of vowels you found in the name
Solutions are not provided to students, but a line of actions (strategy) is included. This is necessary because, without it, AI-Tutor might not always provide a consistent and correct approach for every task.
A strategy is a line of actions that students can follow to solve the task.
For the above-mentioned 100 prime numbers task, for instance, the strategy could be:
- Initialize an empty list to store the prime numbers.
- Start with a number, let’s say 2, and check if it is prime.
- If the number is prime, add it to the list of primes.
- Increment the number and repeat steps 3 and 4 until you have found 100 prime numbers.
At this point, students may have questions about the strategy, e.g. “What does it mean that a number is prime?” or “How would I do step 3?”
AI-Tutor will answer questions in the context of the given task and strategy. However, code snippets longer than 10 lines are removed from the answer.
Student question: What does it mean that a number is prime?
Student question: How would I do step 3?
Depending on the task, it might be helpful to include a pseudo-code. For the above-mentioned 100 prime numbers task for instance the pseudo-code could be:
Initialize an empty list to store the prime numbers Set num to 2, the first prime number While the length of the list of prime numbers is less than 100: Set is_prime to True For each integer i from 2 to the square root of num (inclusive): If num is divisible by i: Set is_prime to False Break out of the loop If is_prime is True: Add num to the list of prime numbers Increment num by 1
The Colab notebook contains a rudimentary coding editor that allows students to write and execute code.
Asking for feedback
Taking AI-Tutor for a spin
Colab Notebook Quick Start
The links above will open Colab Notebooks.
Step 1: click Connect, which means that somewhere a real computer will come alive to host this Colab notebook. Interestingly, during my testing, this computer was often located in the Netherlands.
Step 2: click the play button to initialize the tutor.
Step 3: click the next play button. A text input box will appear, allowing you to enter a question, which AI-Tutor will try to answer. If you have follow-up questions, just click the play button again.
Step 4: once you have come up with a solution, or just something intermediate, click the final play button, to receive feedback. Consider the response, improve your code, and iterate. You can do this step until you like the response you are getting.
If things go wrong, the Runtime menu is your friend. The nuclear option would be “Disconnect and delete runtime” and then simply reload the page.
Let’s see a demo …
Adding more Tasks
You can take a look at how AI-Tutor was implemented: https://github.com/wolfpaulus/ai_tutor
Taking a closer look at the three examples (*.ipynb files) should give you an idea of the work that’s involved, creating more AI-Tutor-based assignments.
At this point, I think it should take no more than about 15 minutes, from idea to colab notebook.