I teach courses in which, as homework, students implement data analysis algorithms from scratch, apply them to real and simulated data, and then reflect on the results.

As a student in such courses, I felt that implementing analyses from scratch and conducting in silico experiments provided me with deep insight. However, this year it has become quite easy to solve such tasks using large language models (LLMs). GPT-4 codes quite well. Even its smaller sibling, ChatGPT, can answer correctly if asked undergraduate-level statistics and computer science questions. Copilot also solves many undergraduate-level programming tasks and can be integrated into several IDEs.

I'm wondering what the best way forward is to ensure learning happens. I cannot effectively stop the students from using this technology, and perhaps I shouldn't. This technology will be available to them in their future academic or industry workplaces. However, I'm concerned that if they just use LLMs to solve the homework, they will not gain any real understanding and will not be able to handle novel problems, for which the chatbots would fail.

I'm wondering what the best way forward should be. Currently, I'm deliberating between the following options:

  • Forbid using LLMs, but do not enforce it. The students' learning is their responsibility.
  • Modify the homework so that LLMs cannot solve it, moving away from textbook problems.
  • Complement the homework with written and/or oral exams that should be straightforward to pass if the students understand the work they submitted, regardless of how it was generated.


  • 8
    I think an answer to this question depends heavily on the answer to another question: Are most of your students capable of learning within a reasonable amount of time to do these tasks with minimal help, then building upon what they have learned to handle novel problems in the future? In other words, is there a reasonable chance that they will be people whose productivity is enhanced by LLMs rather than people who are made obsolete by LLMs? Commented Apr 13, 2023 at 18:00
  • 5
    Reminds me of the need to be able to do math in your head vs. use a calculator. Need for both exists...
    – Dawn
    Commented Apr 13, 2023 at 20:06
  • 7
    Run the problems through GPT-4. If it can solve them on the first try, change them until it can't. At that point, if the students want to use the tool, they'll still have to use their brain alongside it, which is the best you can hope for. Commented Apr 14, 2023 at 17:51
  • 3
    Does it code well? Or is it good at reproducing snippets of code that are common in Stack Exchange questions? How well does it work with novel code? I remember someone posting a response to a prompt to write a program that determined whether someone was a good scientist where it wrote something like "if white and male return good else return bad."
    – Obie 2.0
    Commented Apr 16, 2023 at 2:53
  • 3
    @Obie2.0 It codes better than someone who doesn’t code well. It’s not a game changer for testing/rating/finding the really really good students, but can blend in well with okay students. (Your mileage may vary depending on the specific domain.) Commented Apr 16, 2023 at 5:59

8 Answers 8


I taught undergrad and graduate classes on statistics and had my students learn R and Python (for many of them from scratch). I think learning to use tools like GPT-4/ChatGPT is a valuable skill. It does not do well enough for them to just use it without debugging, at least beyond very simple things, so I guess it's a nice way of learning how to use a tool like this effectively. I teach Stats for Cognitive Scientists and Linguists, so it's not super high-level stuff. Simple data mining and data wrangling and regression in frequentist and Bayesian frameworks. And I don't know about the data you use but when I was confronted with some of the linguists' data and questions, I've had to think a bit on how to address them. The way one would ask GPT to formulate a solution would fail to provide a good outcome in many cases given the underlying questions.

I'm sure there are many questions that can be asked where ChatGPT can be a start but cannot provide the ultimate solution. Same goes for term papers and homework essays. I've yet to see a research overview produced by GPT that is good (or even one that provides actually existing references). So yes, I guess it's most likely to be "moving away from textbook problems". In many disciplines the textbook examples are lacking anyway and often might not prepare the students for the "real world" enough. Finding trickier examples but allowing for increased use of these tools might be a service to them.

  • 2
    ChatGPT seems to have become better at basic arithmetic (like multiplication), but it still fails a relative simple task such as "What are the prime factors of 30387?" (tried 2023-04-15T124015Z+0). Response: "The prime factors of 30387 are: 3 x 29 x 349". That is completely wrong. It doesn't even introspect its own answer (3 x 29 x 349 = 30363). It is "only" off by about 0.08%, but that doesn't cut it for prime numbers. The correct answer is 3, 7, and 1447. Commented Apr 15, 2023 at 12:51
  • 6
    Or in other words, it shouldn't be difficult to find problems where ChatGPT is not just a little bit wrong, but utterly and completely wrong. Commented Apr 15, 2023 at 13:23
  • 1
    @PeterMortensen, how about with the Wolfram plugin? It will help with many currently incorrect/unreliable calculations, I would imagine.
    – J W
    Commented Apr 15, 2023 at 18:39
  • 1
    @PeterMortensen It's funny. I did high school AP calculus in a time when the big, graphic calculators were used but they still wanted us to be able to do stuff by hand. So the fact that we could teach classes on "how to solve equations in solver() without making it look like you used solver()" was a common inside joke among us students. We all still enjoyed math and still went on to do well. The kids might just be alright if they care about the subject. Those that don't were going to forget the stuff soon anyway. Commented Apr 15, 2023 at 21:47
  • 2
    Incidentally, it seems that GPT-4 is very, very close to being able to factor 30387 on its own. It initially gives the factorization 3 * 10129, claiming that 10129 is prime. I then told it that using Python, I found that pow(2,10128,10129) is 64. It deduced correctly from this that 10129 is not prime, and went on to produce correct factors for 10129 and a complete solution to the original question.
    – Polytropos
    Commented Apr 17, 2023 at 1:38

Homework, or work under non-controlled conditions in general, is okay for informal, formative assessment, but poor for high stakes summative assessment.

So you should start with "Why am I testing this person". If you are doing so to help your students identify their strengths and weakness and target areas for work, or to help you plan your teaching then this is formative assessment. If you are testing them to assign a "score", "grade" or similar that describes their success or failure in a course or section of a course then it is summative assessment. If the consequences of success or failure could have significant impact on the students' future career prospects and earnings, it is "high stakes".

With high stakes assessment, the temptation to cheat has always been high, whether this is copying a friend's work, or finding essays in an essay bank, or asking an LLM. The advances in AIs only increases the range of options; it doesn't fundamentally change the nature of high stakes assessment.

The solution is, and always has been to have controlled assessment. First: communicate to the students. "This task will help you think about loops and working efficiently. An AI can solve this task, but I'm interested in what you can do with it. I'll be feeding back, but this won't be part of your final grade."

Or "This task will for 20% of the grade for this course. You will have 3 hours of lab time, and the work must be completed individually. Use of AI is not permitted, to ensure that the assessment is fair."

Or even "this task is more complex than others you have met so far. You are expected to use the full range of resources, including internet Q&A sites and GPT-4 to achieve this task. You won't be graded on the details of the code, but on the professionalism with which the product is produced and presented."

Using homework as a means of giving a grade for a course has always been problematic. If the grade is worth anything then students will cheat. The art of assessment is creating a task in a controlled environment that correlates well to the actual skills that the course is teaching. That has never been easy, but AI doesn't make it any harder.


Coming back to LLM (or conversational AI generally), I believe they have a place, a role in learning and teaching.
What can't (or rather shouldn't) happen though is for them to replace the learning/teaching. Their role is learning scaffolding.

By learning scaffolding, whether constructivism or connectivism, I mean they should be engaged as part of the learning or teaching process. When calculators came along, they were integrated; we used to use those Four Figure Table. When computers (PC as they were) came, they facilitated educational technology. With internet, boom, technology enhanced learning.
PS: when I was teaching subnetting in networking, I discouraged students from relying on calculators. They get to convert any class A or C address and large 'numbers' in short space of time, typical in less than a min (2min at most). And they did it. It was more of improving their thought process and reasoning capability.

Complement the homework with written and/or oral exams that should be straightforward to pass if the students understand the work they submitted, regardless of how it was generated.

LLM have their role if focus is on the cognitive reasoning.

Earlier in the year, I drafted a policy thought on conversational AI (ChatGPT.
I refer to this, as in my view, your use of LLM/conversational AI should facilitate rather than a replacement tool.

My view about conversation AI like ChatGPT is that it should not be banned outrightly. It should be encouraged as part of learning processes: as learning scaffolding.

[Extract from my policy thought on ChatGPT]

  1. Students must disclose their ChatGPT search terms (keywords)
  2. Students must include their ChatGPT result verbatim as an appendix
  3. Students must write their own assignment/assessment submission
  4. Students must show their creativity, their critical thinking and cognitive skills in their writing
  5. It is a crime or punishable offence to use tools to paraphrase ChatGPT results.
  6. Students must show their own originality.
  7. For computing-based assignments/assessments, students must fully comment on their work: introduction/summary, each line of code, and each function/class

Edit: by the way, the ability to ask LLM/conversational AI, domain knowledge guided queries, might become sought after skills in coming years.

  • 6
    To add to the internet example: that is very true. that's like saying that students cannot do research anymore because they can look at online databases instead of filing cabinets at libraries. The technology has moved on and we need to adapt our skillset to still get to the same way of using critical thinking and ability to synthesize and create original work based on previous work. Commented Apr 14, 2023 at 10:40
  • Re: your policy, in your experience so far, is it the case that students feel that ChatGPT has "powercrept" non-ChatGPT students? As in, if you don't use ChatGPT, you will most probably do worse compared to those using ChatGPT. Was wondering about this.
    – justhalf
    Commented Apr 15, 2023 at 13:57

In the long run, presumably the object should be to teach students the skills they'll need in a world where GPT exists - which would include include the ability to use GPT for the things it's good at, while still maintaining enough skepticism about the technology and enough understanding of the code to avoid embracing its mistakes uncritically.

One interesting strategy I've seen, via Reddit: https://old.reddit.com/r/ChatGPT/comments/117gtom/my_friend_is_in_university_and_taking_a_history/

My friend is in university and taking a history class. The professor is using ChatGPT to write essays on the history topics and as the assignments, the students have to mark up its essays and point out where ChatGPT is wrong and correct it.

As a programming-oriented example, I just asked ChatGPT the question that plagues me any time I order at a café:

write a Perl regular expression that matches all common variations of spelling for "Geoffrey", e.g. "Jeffry", "Jeffery" etc.


To match all common variations of the name "Geoffrey" using Perl regular expression, you can use the following pattern:


This pattern will match the following variations:


It then provided a nice explanation of how this pattern is supposed to work. But just a few seconds' scrutiny will show that several of those variations (7/12 by my count) are actually not matched by its pattern. It doesn't even pick up "Jeffery", which was one of the cases in the prompt.

If you play around with GPT, you start to get a sense for the things that can trip it up. For instance, I find that it's often vulnerable to context reversals, where most of its training material deals with a question asked in one direction but the prompt runs in the opposite direction. Like so:

Please convert the following old Python 3 code to run in Python 2:

print("hello world")


In Python 2, the print statement requires parentheses around the arguments. Here is the Python 2 version of the code:

print("hello world")

This code will output "hello world" to the console when executed in Python 2.

This is of course incorrect - in Python 2 print was a statement not a function, so the correct change would have been to remove the parentheses. But GPT has seen thousands upon thousands of examples of updating Python 2 to Python 3, and very few in the other direction, so it patterns its answer accordingly. The "old code" is thrown in to mislead it further.

(Disclaimer: GPT has a random element and this trick doesn't always work. On a few trials with similar prompts, I found it got the conversion right about 60% of the time. But even if it's right 90% of the time, I'd still need to vet its output 100% of the time.)

(As suggested by wizzwizz4 in comments, something with file= or end= might be a better example in Python.)

A problem format similar to the history-essay approach might be:

  • Part A: Write a program to do [thing]
  • Part B: Prompt GPT to write a program to do [thing], then compare with your own code from Part A. Discuss the major differences between the two versions and comment on which version is better.

Once you have a feel for GPT's weaknesses, you'll be in a better position to set questions for which it will occasionally stumble, or to provide examples where it has stumbled and ask students to explain what it did wrong. Once they understand that it's fallible, and have developed the habit of assessing its output with due suspicion, you've done your job.

The meta-problem here is that recycling old assessment material with minor variations is much, much less effort than coming up with new question styles appropriate to the new world, and lecturers who are suddenly required to update vast swathes of assessment material should be appropriately compensated and supported in that. But that'd be a separate question, perhaps best directed towards one's union.

  • 2
    To be fair, that Python 3 code would work flawlessly in Python 2. I'd use something with file= or end= in practice. (But this is a great demonstration anyway.)
    – wizzwizz4
    Commented Apr 15, 2023 at 14:25

What about effectively haven’t in-class coding exams on university-controlled computers? You could even allow such computers to connect to a range of Internet resources, just not LLMs.

You could then tell students that they are free to do their homework however they wish, but if they use LLMs for all of it they are likely to be very poorly prepared for the exam.

I guess this is variation on your third option.

  • +1 I used to do exactly that for reassessment exams on a programming course about 20 years ago (they were just for credit, so they didn't have to be commensurate with the main coursework). They worked really well, and also have the advantage of limiting the time students spend on the task (which can be a problem for students with poor time management skills that don't spread their time well across multiple assessments). I am considering going back to that, but the size of the class makes the logistics tricky. Commented Aug 29, 2023 at 7:52

As a teacher as well as a student, I think the abilities of large language models (LLM) such as GPT-4, should shift the focus of what we are teaching, and what we should be learning.

Yes, the invention of the pocket calculator diminished people's ability to find square roots, and logarithms in their head or by pencil and paper. And because of that, we could progress to more depth in other topics. But yes, there are pros and cons. Now there is a lot of time and effort to save for the students on the programming aspect when they use LLMs, which however also implies that they can spend it on other aspects of the course.

If programming is the goal and essence of the course, like in undergraduate programming courses, one could argue to forbid the use of LLMs. Which could be enforced by exams or homework in computer laboratories on site where there is supervision and technology to enforce this. Or smaller offline oral examinations about homework, or supervising peer reviewed student assignments. Having the perspective of exams/assessments without the possibility to use LLMs might stimulate the students to train and practice without them. On the other hand, if after trying exercises themselves, they are stuck, LLMs can be great tutors, available any time, which means that TAs can maybe be used in other ways.

However, for many courses, such as data analysis, the essence could be more about understanding the algorithms, methods, and interpretation of the results. For this type of course I think the use of LLMs can be a blessing, because you can increase the complexity and depth of the contents of the course. If you target insight by programming, ask questions about the particular insights you expect to be gained by the implementation experience. Already assuming that the students use LLMs, you can ask questions about the computational complexity of their code, and alternative different implementations. You can focus more on in-depth experiences with different data sets. But the problem is that GPT-4 is also already getting quite good in the reasoning skills that can be expected from students even in advanced courses.

One way to deal with this is to give more realistic and open-ended questions and data sets where there are multiple possible correct answers. Such that the students have to choose and analyze themselves. The challenge could become to formulate and create questions that are educational and challenging even when the students will be using LLMs.

  • LLMs are a tool for experts. They should be taught, but only on advanced programming course when students can already program competently and have gained problem solving skills and code analysis skills (so they can spot where the LLM is giving them a bad solution). LLMs don't understand the code they produce, if the user doesn't understand it either, we have a recipe for low quality code. Commented Aug 29, 2023 at 7:55

Why are you testing "hello world"?

It is common to give assignments that boil down to a little more than "hello world". Consider why you give such assignments - the students ability to do "hello world" is usually not the goal.

If you treat it as a learning opportunity, where you offer to fix problems the student has with writing "hello world", instead of an assessment that determines if they get credit for the course, the GPT problem sort of goes away.

Your goal is to have the student honestly try the homework, then provide feedback on how to do it better, and repeat until they can actually do the homework type problem reliably. Handing a student a problem and saying "solve it" doesn't really do this; it will divide your students into "the ones who can solve the problem" and "the ones who cannot", but it won't substantially move students in the ones who cannot bucket into the ones who can bucket.

Homework as tutoring

Require that they turn in the "hello world" problems. These will be corrected by your TAs, but the assignment is to attempt it, not to succeed at it.

Students whose assignment doesn't succeed can try again and get marked again.

Assignments build on each other. You are expected to have mastered assignment #1 before you try assignment #2.

Actually handing in an assignment, that honestly attempts to solve the problem, at the level of competence expected of someone entering the class, is worth "full marks"; if it fails abysmally, the student may be required to do some tutoring and try again.

This will require some prerequisites on students.

Assessment as Assessment

Your assessments -- the exams will have problems -- similar to the assignments, and often simpler, but different. Simply memorizing will not work. ChatGPT will not be available during the exam.

The exam will have a choice of more than one problem to solve.

Students are encouraged to use GPT or whatever to help them learn

If a student is having problems with a question, they are encouraged to try to use ChatGPT to prototype. They will, however, have to be able to solve the problem without ChatGPT.

You can even provide sample solutions.

Multiple assessments

Don't have 1 or 2 high-stakes assessments of the student's progress. Students will falsely think they know something after they copy-paste it from somewhere else. An actual early assessment may wake them up.


I used to teach mathematics about the time that computer algebra systems were being built for smartphones. I used to encourage students to use smartphones to do the mathematics because the department had a policy of using TI-Nspires with a built-in CAS anyway. So, the approach was two-fold and simple:

  1. Design a series of questions that show a problem done and instead of asking the student to solve the problem, ask the student to explain the rationale in the steps of the problem solving itself. Why did we move from A to B? You can also structure your language to contain hypotheticals and counterfactuals. If X were Y in step A, would we still arrive at step B? If NOT X, why wouldn't we transform the equation in such and such a manner?

  2. Ask natural language questions about the concepts involved and make them linguistically challenging. Programming language theory is replete with concepts about syntax and semantics and specific programming languages, given the complexity of the BNF and the idioms that are used, can be torturous to master. Take JS equality rules for instance. Go after questions that not only allow for the use of technology, but require it. Imagine assigning work that asks natural language questions about JS equality, not only by asking a student to fill out such a table, but then to either craft natural language or to answer questions that use indexicals that refer to the table. In other words, create Captcha-like questions. Even if a student finds a way to translate a graph or picture into words to feed to an LLM, make them work for it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .