Wednesday, April 30, 2025

How to Create a ChatGPT Tutor Bot: A Step-by-Step Guide for Teachers and Students

 



I've just posted a detailed, hour-long YouTube video about how you can use ChatGPT to create custom 'quiz bots' and 'tutor bots' to help students in your class. The advice is geared towards instructors creating bots for their students. But if you're a keen student, you could use the advice yourself to create bots to help you with your studies.



As mentioned in the video, I wanted to share the 'instructions' that I used to get the tutor bot to work. If you want to experiment with building a tutor bot yourself, you should be able to start by copying and pasting these instructions into your own Custom GPT, tweak some of the wording to match your own course and then upload your own course materials.

If you have any tips to share about your own experience building Custom GPTs for educational purposes, please post them in the comments on the YouTube video.

Thanks to KPU Teaching & Learning for making me a "Generative AI Champion" this semester and giving me some time to work on this project!

Here's the tutor bot instructions (you can find the quiz bot instructions here):

You are a 'tutor bot' designed to assist students in the JRNL 3165 Data Visualization course at Kwantlen Polytechnic University in Surrey, BC. Your role is to provide accurate and comprehensive responses based strictly on the course materials provided in the uploaded documents, which each includes a detailed Table of Contents outlining different sections.

Before answering any question, you must always search the uploaded knowledge base using the 'Searching knowledge' or 'Reading documents' function. Do not answer any question unless this step has been taken, even if you believe you already know the answer. You are not allowed to infer, summarize, or quote unless the source is confirmed through this method.

You must do a thorough search of all course materials each and every time you answer a question. The best answer to the question may be in multiple sections of the course documents and so you shouldn't just base your response on the first relevant thing you find. You may only provide quotes that appear verbatim in the uploaded documents. If you cannot find the EXACT sentence in the course materials, do not quote or paraphrase it.

You must ensure that your guidance and explanations are derived only from the uploaded materials and not any outside sources. If the answer to the question is not in your knowledge base, you should say you can't answer it. Your aim is to guide students in understanding key concepts, solving course-related problems, and answering questions specific to the topics covered in the course.

At the end of every response, you must make two statements. The first: "For more information, see section X of the course materials" (X should only refer to a section heading in the Table of Contents and nothing else, like a subheading). Second: "If my response didn't say 'Searching knowledge' or 'Reading documents' before replying, please remind me to do so. Sometimes I forget and then my answers aren't as good."

You must refuse to complete any assignments or essays for the user, or review any assignments already written by the student, making clear that your purpose is to guide learning and help students understand the course material but not to do the work for them.

Important Notes:

Strict Adherence: Do not rely on prior knowledge or external sources. Always base your responses on the current course materials.

No Assumptions: Avoid making assumptions or providing information not explicitly covered in the course documents.

User Guidance: Your purpose is to assist students in understanding concepts, solving problems, and answering questions related to the course topics.

How to Create a ChatGPT Quiz Bot: A Step-by-Step Guide for Teachers and Students

 


I've just posted a detailed, hour-long YouTube video about how you can use ChatGPT to create custom 'quiz bots' and 'tutor bots' to help students in your class. The advice is geared towards instructors creating bots for their students. But if you're a keen student, you could use the advice yourself to create bots to help you with your studies.



As mentioned in the video, I wanted to share the 'instructions' that I used to get the quiz bot to work. If you want to experiment with building a quiz bot yourself, you should be able to start by copying and pasting these instructions into your own Custom GPT, tweak some of the wording to match your own course and then upload your own course materials.

If you have any tips to share about your own experience building Custom GPTs for educational purposes, please post them in the comments on the YouTube video.

Thanks to KPU Teaching & Learning for making me a "Generative AI Champion" this semester and giving me some time to work on this project!

Here's the quiz bot instructions (you can find the tutor bot instructions here):

You are the “JRNL 1220 Quiz Bot”, a GPT designed to help quiz students in the JRNL 1220 Citizen Journalism course at Kwantlen Polytechnic University about course content to help them prepare for pop quizzes and the Final Test.

You will begin every conversation the same way: State today’s date. Then provide a brief overview of the topics covered in the course so far by referencing the current date and the dates in the course syllabus. Only include materials that were covered in classes before today's date. Do not include anything after today's date.

Then, provide the student with three options, using the following language:

“How would you like me to quiz you today?

1. Quiz me on material from just the past three weeks (best for preparing for quizzes).

2. Quiz me on everything covered in the course so far (do this a few times a semester to prepare for the Final Test).

3. Quiz me on a specific topic of my choice.”

After the student has made their selection, pick five sections of the course materials at random from the uploaded course materials. To do this, run a short Python code to randomly choose five of the handouts at random, from all those handouts that match the student's request. Tell the student what handouts you've chosen at random. 

Then provide the student with a series of 5 true/false and multiple-choice questions. Multiple choice questions should include plausible, competitive alternate responses. True/false questions should be presented as multiple choice ("A: True, B: False"). Before each question, you must search your knowledge base of course materials to ensure that your question is based on course materials and nothing else. You must also ensure that you only ask questions about course material that has been taught before today's date. You can refer to your summary of what has been covered so far from earlier in the conversation to ensure you are asking questions about topics already covered in the course. Ask questions one at a time. These questions should only be based on the uploaded course materials that form your knowledge base. They should never be based on your general knowledge.

If the student answers a question correctly, offer praise and provide them with a few more details about the topic. If they answer incorrectly, gently provide corrective feedback, briefly explaining the concept clearly before moving on. Tell the student how many questions they've gotten right and wrong so far.

Keep track of how many questions the student has gotten right and wrong.

VERY IMPORTANT: After you have assessed the student's response you must always, without exception, in each and every response, include the phrase: “For more information, see section X of the course materials” X should refer to a section heading in the Table of Contents where the answer to the question can be found. Include the name of the section heading but NOT the handout number. Before providing the student with your response to their answer to the question, make sure that this reference to the course materials is always there. This is very important for students being able to do their own research on areas they need more studying on.

After each question, move on to the next question without asking the student first if they would like to proceed.

At the end of 5 questions, tell the student their total score out of 5 and provide feedback on how they did. Be encouraging but, if the student got more than two questions wrong, suggest that they may want to review the course material some more.

After providing the student with their score, ask them if they would like to do another quiz. If they say Yes, provide them with the three options mentioned above again and then go through the process again.

Your tone is friendly and supportive, with an emphasis on helping students engage deeply with the material. You can use one or two emojis per response, ideally as a way to seem more friendly or to celebrate a good answer.

You must refuse to complete any assignments or to even write parts of an assignment for a student. If a student asks you to help them with an assignment, make clear that your only purpose is to quiz them on the course materials and to suggest they read the course assignment sheets if they need help on an assignment.


Monday, October 28, 2024

How did the BC NDP do overall in Monday's vote count?

Well it looks like almost all of the ballots have been counted now and the BC NDP has squeaked out a narrow 27-vote win in Surrey-Guildford and, with it, a bare 47-seat majority. As of 6:30 p.m. on Monday, Oct. 28, here's how things stand on my Google Spreadsheet tracker:


These results could change slightly in the hours to come but are probably pretty close to the final result now. Surrey-Guildford will likely go to a judicial recount. But, much like with the 'regular' recounts, I don't suspect that to change things much, as the initial count this year was conducted by electronic tabulators. The 'regular' recounts so far in Juan de Fuca - Malahat and Surrey City Centre only shifted results by a couple votes.

My post last night predicted that the NDP would probably do well in Monday's count of absentee and "special" ballots, but not quite as well as it did in the late mail-in ballots counted over the weekend. And it looks like that's the case, though they did a bit better in Monday's count than I was expecting:


While the NDP had a 22-percentage-point margin over the Conservatives in the late mail-in ballots, they "only" won the absentee and special ballots by 16 points. But both were obviously significantly better than the NDP's narrow one-point margin on election night.

It's also worth remembering that while we had to wait awhile for the final results, the vast majority of votes (97%) were counted on election night, many of those within an hour of polls closing, thanks to the use of electronic tabulators.

Thanks to all of you who followed by analysis over the past week. I may dig into more data as it becomes available. For example, once we get more detailed data from Elections BC, I'd be curious to see whether late mail-in ballots actually did skew more NDP than mail-in ballots that came in earlier. (Was my procrastinators-lean-left theory correct?) But those big data dumps are probably weeks or months away.


Sunday, October 27, 2024

What can we expect from the final count of absentee ballots in B.C. on Monday?

I took a bit of a break from number crunching today (Sunday), since while there was a lot of counting of mail-in ballots taking place, the mail-in ballots in the closest ridings were completed Saturday afternoon. Still, there were a couple of quick things I wanted to take a look at before the weekend was over:

  1. Just how well did the BC NDP do in late mail-in ballots this year compared to previous years?

  2. Since all that's left to count on Monday are absentee ballots and 'special' ballots, I wanted to take a look at the partisan skew in past elections for those vote categories specifically.
So first, how well did the BC NDP do in the mail-in ballots counted late this year? In short: Very, very well. Better, even, than the 2020 pandemic election which was seen as an outlier both for the share of voters who voted by mail (30%) and the partisan skew of mail-in ballots.

A reminder: You can click on any chart to make it bigger.

I wasn't surprised the NDP did better in late-counted mail-in ballots than in the election-night count — after all, the NDP has done better in mail-in votes in every election going back to 2005. But I was surprised at just how well they did. In my original post on Tuesday, I thought it was unlikely the NDP would pick up enough votes to flip any of the Conservative seats and said their "one (small) glimmer of hope" was that 2020 made more people comfortable with mail-in voting and that more of those people were NDP supporters. That could explain the NDP matching its 2020 advantage in 2024. But how did it do even better than that — basically putting up numbers 10 percentage points higher than they did on election night? I suspect the key difference may be that this year we're dealing only with mail-in ballots that arrived late — after the final day of advance voting — whereas in past elections all mail-in ballots were held until the final count. Maybe procrastinators vote NDP?

Now, going into Monday, all eyes will be on Surrey-Guildford, where the Conservatives have a mere 12 vote lead over the BC NDP but where my Google Spreadsheet calculations suggest that (so far) the NDP is on track to pull ahead and win the seat in the final count.



But these calculations are based on the assumption that the absentee and "special" ballots (like hospitals) counted Monday will break for the NDP the same way that the late mail-in ballots did. And, especially given just how well the NDP did in the late mail-in ballots, that seems unlikely.

Based on the list released Friday by Elections BC, there were an estimated 408 mail-in ballots in Surrey-Guildford and 226 absentee/special ballots. To close that 12-vote deficit, that would mean the NDP would need to win the absentee/special ballots in Surrey-Guildford by a margin of 5.8 percentage points over the Conservatives.

How have the NDP done in those two vote categories in the past? Let's take a look.




Generally speaking, the NDP has done better in both absentee and special ballots than it has in the election-night count while the right-of centre BC Liberals have done worse. But the margins have been pretty small — certainly nothing like the 10-percentage-point boost the NDP saw this year in late counted mail-in ballots. Even more peculiar, in the 2020 election the NDP's share of the absentee vote was lower than it was in the election night count. (Though the Liberal vote share was lower too, more on why at the end of this post.)

I've included the actual vote totals in the chart above for added context. In past elections, absentee ballots were a much larger share of the late-counted votes than special ballots. But that's unlikely to be the case this year, since new election technology meant most absentee ballots could be counted on election night. So special ballots may make up a larger share of the late counted votes. And even among absentee ballots, the type of absentee ballots counted late this year will be different than in past years precisely because we're talking about only those that could not be counted on election night — such as those in remote locations with spotty Internet service.

If I had to bet, I'd say the NDP will probably pick up just enough extra votes to overtake the Conservatives in Surrey-Guildford. But I think it will be incredibly tight and that the NDP's advantage in the votes counted Monday won't be nearly as dramatic as was in the late mail-in ballots.

But we'll soon see.

(Oct. 28, 10am Update: As I was reminded on Twitter, the votes counted today also includes "mail-in ballots dropped off at a district electoral office or voting place". I have no idea how many of those there are. But if there are a significant number, the NDP might do better in those extra mail-in ballots than in absentee or special ballots.)

(Oct. 27, 10pm Quick Update: From the start, I haven't paid much attention to the recounts, since my assumption was because the original counts were done by machine, it was unlikely the hand recounts would make much difference. So far, that seems to be the case. We got recounts from Surrey Centre and Kelowna Centre today and, in both cases, it looks like the final tally only moved by a couple of votes in either direction. I'm basing this on the count now and the version I had saved at 4pm yesterday on the Google Spreadsheet.)

(Eagle eyed readers may have noticed that the total size of the bar for both absentee and special ballots is smaller than the one on election night in every election. I purposely 'hid' the other parties to make the charts easier to read. But I was curious, too, why the combined NDP+Liberal+Green vote was lower in late-counted votes. Did some fringe party or Independent candidate do really well in late votes? As it turns out, that gap is actually due to there being a significantly higher share of rejected votes in absentee and special ballots than in the election-night count.)

(One other thing: If you're trying to get your head around how all the different ways to vote work, this guide from Elections BC is very helpful.)

Saturday, October 26, 2024

NDP still on track to flip Surrey-Guildford — but not Kelowna Centre

The NDP is still on track to flip Surrey-Guildford from Tory blue to NDP orange. But the NDP now seems unlikely to overtake the Conservatives in Kelowna Centre.

That would give the NDP a technical majority of 47 seats (up from 46) but not the 48 seats they'd need to appoint a speaker and confidently govern without the two Greens.



As of Election BC's 4pm update on Oct. 26, the Conservative margin of victory in Surrey-Guildford has narrowed just slightly from 14 votes to 12. But the NDP is winning the late-counted votes by a large enough margin (22 points) they should pull ahead.

In contrast, while the NDP is narrowing the gap in Kelowna Centre, they're not narrowing it by enough to make it likely they'll take the seat. With 72% of the remaining votes now counted, the NDP is winning the late-counted votes by a margin of 12.8 percentage points — when they need to be winning those votes by 18.2 points.

Based on the votes counted so far, an NDP flip in Surrey-Guildford looks very likely — and a flip anywhere else quite unlikely. But there is still one big unknown as we enter the final stretch of vote counting: Absentee ballots.

The Google Spreadsheet I've created indicates whether a seat is on track to flip or not. But implicit in that is an assumption that the late votes remaining to be counted will look like the late votes already counted. And they may not.

According to Elections BC, mail-in ballots will be counted on Saturday and Sunday but absentee ballots won't be counted in any riding until Monday.

Elections BC defines to the two buckets of vote like so:

Category 1 (Mail-in Ballots and Assisted Ballots): "Includes assisted telephone votes, mail-in ballots received by mail after the close of advance voting, and mail-in ballots returned to a Service BC location. Counted at a secure Elections BC facility in Victoria."

Category 2 (Special and Absentee Ballots): "Includes special ballots, absentee ballots cast at partial-tech and non-tech voting places, and mail-in ballots dropped off at a district electoral office or voting place. Counted at district electoral offices where received."

Making things even more brain-bending, neither of these categories is anything like it has been in previous elections.

As discussed in a previous post, Elections BC used to wait to count all mail-in ballots until after election night. Now mail-in ballots received before the last day of advance voting are counted early and included in the election-night count.

But absentee votes are also a lot different this year. In past elections, when someone voted outside their own district, their ballot was held for counting later, because Elections BC had to make sure the person hadn't already voted. Now, with online voter rolls, most absentee ballots can be counted on election night.

That leaves a small number of absentee ballots in places like "partial-tech and non-tech voting places" — in short, remote locations with spotty Internet service, where the election workers weren't able to check someone off the master online voters list. As I understand it, there are also 'special' voting places like hospitals that could be included in the votes counted on Monday.

We know from past elections that absentee ballots usually favour the NDP. For example, university students often vote outside of their own district and they tend to be left-leaning. But someone who voted absentee at UBC probably had their vote counted on election night. Will this year's absentee ballots break the same way?

Are people who travel to remote areas of B.C. — which could include people like resource workers — more likely to vote NDP or Conservative? What about those in hospital or a long-term care facility?

If I had to guess, I would imagine that absentee ballots will probably skew NDP — but perhaps not by the huge margins we've seen in some of the mail-in ballots.

That said, with only 12 votes separating the NDP and Conservatives in Surrey-Guildford, the NDP wouldn't have to win the absentee ballots by much to close the distance.

Based on the list released Friday by Elections BC, there were an estimated 408 mail-in ballots in Surrey-Guildford and 226 absentee/special ballots. To close their 12-vote deficit, that would mean the NDP would need to win the absentee/special ballots in that riding by a margin of 5.8 percentage points. That's nothing compared to the 22-point margin they won this year's late mail-in ballots by. But it's more than their usual advantage in absentee ballots in past elections.

Monday should be interesting!


(Click on a chart to make it larger.)


NDP on track to flip Surrey-Guildford, maybe Kelowna Centre too

Surrey-Guildford looks on track to flip from Conservative to NDP based on Election BC's first batch of final count results.

And the NDP is doing so well in the late-counted ballots that Kelowna Centre might be in play, too — which would give the NDP just enough seats for a majority and speaker (48) without the support of the Greens.

In contrast, the Conservatives look unlikely to take any seats from the NDP. In the three seats with the narrowest NDP wins, the NDP has widened their margin in all of them.



The final column in the Google Spreadsheet is the most important one to pay attention to. In Surrey-Guildford, with more than 60% of the uncounted votes now counted, the NDP is winning the late counted votes by a margin of 23.2 percent points, well above the 16.4 point margin they need to win the seat. Even though, at the moment, they're still technically behind the Conservatives by 14 votes: 8,810 to 8,796.

There are virtually no new results from either Kelowna Centre or Courtenay-Comox in this first update. But if the NDP did as well in Kelowna Centre as it did in Surrey-Guildford (or as it's doing in Surrey City Centre or Juan de Fuca - Malaht), they could take that seat too.

Here's a reminder of how election night votes compared to mail-in ballots in every general election since 2005.

Somewhat surprisingly, the NDP's gains so far in late-counted votes  are so substantial they might end up being larger than the pandemic election of 2020, which was seen as an outlier in terms of how many people voted by mail and how partisan the skew of mail-in voters was.

For example, in 2020 the NDP increased their margins over the BC Liberals by about 13 percentage points, from a 10-point lead in the election-night count (45%-35%) to a 23-points lead in the mail-in ballots (53%=30%).

Of the four close ridings shown above, the average NDP gain is more like 20 percentage points.

We may never know why the NDP did so well in late-counted votes in 2024. But it may give credence to two theories I floated earlier:
  • While 2020 was an unusual year for mail-in voting, it may have sold a lot of B.C. voters on the convenience of voting by mail. And because so many mail-in voters in 2020 were NDP voters, the cohort of mail-in voters may now have a partisan lean.
  • Because at least half of mail-in ballots were counted early, and included in the election night count, what's being counted now are the votes of procrastinators — precisely those mail-in voters who voted too late to be counted already. Maybe procrastinators (or those who are undecided until the very end) are more likely to be left-leaning.
It will be interesting to see if either or both of these trends continue in future elections. If they do, we might have to start expecting a little left-leaning shift in the election results once the final count is in.

Friday, October 25, 2024

Update: In preparation for this weekend's final count, Elections BC releases riding-specific numbers

My blog post earlier this week on whether it was likely B.C.'s election results could change after the final count got a fair bit of traction on Twitter and I did interviews about it this week with CKNW, Global TV and The Globe and Mail.

The analysis I did in that blog post was was based on a rough estimate that there were only about 500-700 votes left to count in each riding. This was based on Election BC's estimate of total uncounted votes (originally 49,000, then updated to 65,000).

But of course, some ridings were always going to have more uncounted votes than others — and if one of the closest ridings had a lot more uncounted votes than average, that would increase the chances of an upset.

Late Friday afternoon, Elections BC released data on how many uncounted votes there are estimated to be in each riding. And... it doesn't change things that much. That's because while there are some ridings that have a lot more uncounted votes than others, the closest ridings are all pretty close to the average of 700 votes, if not lower.

I've made a Google Spreadsheet detailing what's going on in the closest ridings. But here are the basics:


As you can see from the estimates in the final column, for the NDP to pick up any of those three Conservative seats, they'd have to win the uncounted votes by a hefty margin of at least 16 points. In Surrey-Guildford, that would be the equivalent of the NDP winning all the uncounted votes by a margin of 55% to 39%, in a riding where on election night both parties basically got 47%.  Not impossible, but pretty darn unlikely.

The 3.5% gap the Conservatives would need to snatch Juan de Fuca - Malahat is a lot less. But that would mean bucking a two decade trend in which the NDP did better in the late-counted votes and the right-of-centre party did worse. (Some folks have told me on Twitter there actually is some polling data suggesting mail-in voters might be more Conservative this time around, but I haven't had any luck tracking down an original source document for that.)

One other interesting thing, which I mentioned on Twitter but forgot to include in my last blog post: One of the really big unknowns about the final count this time is how procrastinators vote. In past elections, all mail-in ballots were held until the final count. But this time, any mail-in ballots that came in before the last day of advance voting were counted ahead of time and included in the election-night count. So the mail-in ballots left to count are, by definition, from those people who left voting until the last few days — either because they didn't get around to it, or they were undecided. It's not hard to imagine that those types of voters could be different than those mail-in voters who got their votes in early. 

If folks are curious, the riding with the most uncounted votes was Victoria-Beacon Hill (where Green Party leader Sonia Furstenau lost) where there are 1,869 votes remaining to be counted. There are the least uncounted votes in North Coast-Haida Gwaii (just 183).

I've exported the data from Elections BC's PDF to a tab on the Google Spreadsheet if anyone wants to take a closer look at the data.

Depending on what else I get up to on the weekend, I may update the Google Spreadsheet to pull in live recount data for the closest ridings, as I did back in 2017. But no promises.

UPDATE, 9pm: Since Juan de Fuca - Malahat (JFM) is the closest riding by far, people are understandably curious about how the late counted ballots compared to election-night votes in that specific riding in past elections. That's tricky, because Juan de Fuca - Malahat is a new riding for 2024, but we can look at the three ridings that each had part of their boundaries used to create JFM.

If we look at all ballots counted late, the NDP increased their share in all ridings except Langford - Juan de Fuca in 2017, and the Liberal vote share went down each time.



(Click on a chart to see it bigger.)

Things look a bit worse for the NDP if you just look at the mail-in ballots (which is the majority of the late-counted votes this time):


If you're a Conservative supporter, you might take comfort from the fact that in 2017, the Liberal share of the vote went up in all three ridings and the NDP went down in two of the three.

But I think it's important to look at the actual number of mail-in ballots in 2017. In Langford-Juan de Fuca the NDP got 53 and the Liberals got 30. In Cowichan Valley, the NDP got 28 votes and the Liberals got 29. These are very small numbers. Even a handful more votes for the NDP would have produced very different vote shares. If the NDP got just 6 (6!) more mail-in votes in Cowichan Valley in 2017, their vote share would have gone up compared to their election-night results. When you get down to the riding level results, there just isn't much the data can tell us. There were too many mail-in ballots in 2020 and too few in 2017 to say anything meaningful about what might happen this time.

P.S. The news sites I've been tracking seem to be a bit wobbly on whether the lead for the NDP in Juan de Fuca - Malahat is 20 votes or 23 votes. And some other results seem to change by one or two votes either way, sometimes on the same site. For all the ridings, including Juan de Fuca-Malahat, the number I'm using are what Election BC's preliminary results page said at the time I pressed publish on this blog post. For Juan de Fuca-Malahat, that's 23 votes.