Daily Archives: October 31, 2024

AI in Epi 554 (part 3)

Debugging 2: When the code does not fail, but still is wrong

Reminder of Intro and Debugging 1: AI is BS, but not useless; Prompt with error, get suggestions, keep asking, if necessary.

This time, what if there is no error, but something is wrong?

  1. Create a MCVE (minimal complete verifiable example), possibly including a screenshot
  2. Describe the issue to a ChatBot, and keep iterating if necessary. (This will be necessary more often than for Debugging when Code Fails, because then you have an error message to work with!)

The anatomy of an MCVE (follow link for more detail):

  1. Minimal: Use as little code as possible that still produces the same problem
  2. Complete: Provide all parts someone else needs to reproduce your problem in the question itself
  3. Reproducible: Test the code you’re about to provide to make sure it reproduces the problem

Remember the first precept of prompt engineering:  Tell AI who you want it to imitate e.g. “You are a friendly and expert teaching assistant.”

Lauren Wilner (Epi 560 TA) says: I advise the students to tell ChatGPT something like: “Please pretend to be my TA who I go to when I have trouble with my coding in my Data Management class. I am coding in R, and she helps me by giving me tips on rewriting my code and gives me sample lines of code I can use and ensure they do what I want. She also tells me how to know whether the code that she gave me is doing what I expected. The code I am working does X. Currently, I have the following lines of code: Y. Can you please help me rewrite this into a loop?”

Watch out for a common pitfall with BS Bots! Lauren Wilner says, “I find that if I ask ChatGPT what is wrong with something or how something can be improved or whether something is X, it will never say “looks good” or “no problems” or “no improvements needed” – it will always make some change or update. Sometimes that update makes things worse! So, overuse can be an issue.

“Again, it comes back to knowing what you expect or want to see and using ChatGPT to assist you and not do things for you.”

In summary: AI is BS, not useless; Useful for debugging; don’t stay stuck for long, prompt with MCVE code example, and polite request for help. Keep convo going if necessary. 

Comments Off on AI in Epi 554 (part 3)

Filed under education, Uncategorized