Generative AI policy

Generative AI policy #

One of the pedagogical principles of the course is that programming skills are learned by doing, not by watching someone else. Consequently, anything that you turn in as your work in the course should have been generated by you, not by a generative AI system such as a large language model (LLM).

This doesn’t mean that LLMs should never be used. But there are good uses and bad uses of LLMs.

Good uses can be very helpful for clarifying concepts and improving understanding. You can often identify appropriate queries because they are phrased in terms of “why” questions.

Bad uses usurp the learning by doing your work for you. Such inappropriate queries are often phrased as “how” questions or as commands.

Although the distinction between good and bad uses, appropriate or inappropriate queries, should be clear, I include below some examples of good questions and bad queries. When in doubt about whether a use of an LLM is good or bad, it’s undoubtedly bad. Avoid it.

Inappropriate use of generative AI systems such as LLMs is a violation of the Academic integrity and collaboration policy, and of the Harvard College honor code.

Good questions #

Good questions help clarify concepts and improve understanding. Here are some examples. (These are only examples; and do not exhaust the possibilities of misuse of LLMs. Tread carefully.)

Conceptual understanding #

  • “Why does OCaml use pattern matching instead of switch statements?”
  • “What’s the difference between structural and physical equality in functional programming?”
  • “Why are immutable data structures preferred in functional programming?”
  • “Can you explain why tail recursion is more efficient than regular recursion?”
  • “What makes higher-order functions more powerful than first-order functions?”
  • “Why does the type system prevent certain kinds of bugs?”
  • “What’s the relationship between closures and scope in functional languages?”

Learning strategies #

  • “What’s a good mental model for understanding how fold_left processes a list?”
  • “How can I tell when to use a map versus a fold?”
  • “How do I think about designing an abstract data type?”

Understanding error messages #

  • “What does the OCaml error ‘This expression has type X but an expression was expected of type Y’ generally mean?”
  • “What are common causes of ‘unbound value’ errors in OCaml?”
  • “How do I read and interpret OCaml’s type error messages?”

Debugging strategies #

  • “What’s a systematic approach to debugging type errors in functional programs?”
  • “How can I use the OCaml REPL to isolate where a bug is occurring?”
  • “What are effective strategies for debugging recursive functions?”
  • “When my program compiles but produces wrong results, what debugging steps should I follow?”
  • “Why might a function return None when I expect Some value?”
  • “What typically causes infinite loops in recursive functions?”
  • “What could cause a ‘stack overflow’ error in a recursive function?”

Bad questions #

Bad questions undermine learning by having the AI do your work.

Direct solution requests #

  • “Write an OCaml function that implements the prisoners dilemma strategy for Problem Set 1”
  • “Here’s Problem 3 from Lab 5, can you complete this code?”
  • “What’s the solution to this week’s problem set?”
  • “Here’s the lab specification, write the code for me”
  • “Convert this Python solution I found into OCaml for my assignment”
  • “Generate unit tests for my problem set submission”

Having AI debug your code #

  • “Debug this code I wrote for my problem set” [with code pasted]
  • “Here’s my Lab 5 code [pastes code]. Why doesn’t it work?”
  • “My problem set solution gives the wrong output. Here’s my code [pastes], what’s wrong?”
  • “Here’s my solution to the lab exercise [pastes code]. What mistakes did I make?”
  • “My code fails the unit tests. Here it is [pastes]. How do I fix it?”
  • “Here’s the error message I got on my problem set submission [with code]. What should I change?”
  • “Find the bug in my implementation” [pastes assignment code]
  • “My red-black tree implementation has a bug somewhere [pastes 200 lines]. Can you find it?”
  • “Trace through my code and tell me where the logic error is”

Exam help #

  • “Here’s an exam question, what’s the answer?”
  • “I’m taking the midterm, how do I solve this problem?”

Working around learning #

  • “Explain this entire lab’s solutions to me”
  • “What’s the most elegant way to solve [specific assignment problem]?”