Skip to content

(Re-)Add content on generative AI #697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions episodes/04-built-in.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,64 @@ NameError: name 'aege' is not defined

- Fix syntax errors by reading the source and runtime errors by tracing execution.

## Other ways to get help
There are several other ways that people often get help when they are stuck with their Python code.

* Search the internet:
paste the last line of your error message or the word "python" and a short description of what you want to do into your favourite search engine
and you will usually find several examples where other people have encountered the same problem and came looking for help.
* [StackOverflow](https://stackoverflow.com/questions) can be particularly helpful for this: answers to questions are presented as a ranked thread ordered according to how useful other users found them to be.
* **Take care:** copying and pasting code written by somebody else is risky unless you understand exactly what it is doing!
* ask somebody "in the real world".
If you have a colleague or friend with more expertise in Python than you have, show them the problem you are having and ask them for help.
* Sometimes, the act of articulating your question can help you to identify what is going wrong.
This is known as ["rubber duck debugging"](https://en.wikipedia.org/wiki/Rubber_duck_debugging) among programmers.

### Generative AI

::::::::::::::::::::::::::::: instructor

### Choose how to teach this section
The section on generative AI is intended to be concise but Instructors may choose to devote more time to the topic in a workshop.
Depending on your own level of experience and comfort with talking about and using these tools, you could choose to do any of the following:

* Explain how large language models work and are trained, and/or the difference between generative AI, other forms of AI that currently exist, and the limits of what LLMs can do (e.g., they can't "reason").
* Demonstrate how you recommend that learners use generative AI.
* Discuss the ethical concerns listed below, as well as others that you are aware of, to help learners make an informed choice about whether or not to use generative AI tools.

This is a fast-moving technology.
If you are preparing to teach this section and you feel it has become outdated, please open an issue on the lesson repository to let the Maintainers know and/or a pull request to suggest updates and improvements.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you are comfortable, demonstrating how to work with an LLM, especially through the build in tools, could be a good way to end the workshop, in addition to pointing out other resources.

motivated by @alee's comment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on how this differs from the point already included on line 284 of the diff?

Demonstrate how you recommend that learners use generative AI.

My aim with this guidance to Instructros was to actively encourage different approaches based on the individual's level of expertise and comfort with using the technology

::::::::::::::::::::::::::::::::::::::::

It is increasingly common for people to use _generative AI_ chatbots such as ChatGPT to get help while coding.
You will probably receive some useful guidance by presenting your error message to the chatbot and asking it what went wrong.
However, the way this help is provided by the chatbot is different.
Answers on StackOverflow have (probably) been given by a human as a direct response to the question asked.
But generative AI chatbots, which are based on an advanced statistical model, respond by generating the _most likely_ sequence of text that would follow the prompt they are given.

While responses from generative AI tools can often be helpful, they are not always reliable.
These tools sometimes generate plausible but incorrect or misleading information, so (just as with an answer found on the internet) it is essential to verify their accuracy.
You need the knowledge and skills to be able to understand these responses, to judge whether or not they are accurate, and to fix any errors in the code it offers you.

In addition to asking for help, programmers can use generative AI tools to generate code from scratch; extend, improve and reorganise existing code; translate code between programming languages; figure out what terms to use in a search of the internet; and more.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels like more of a "sidebar" comment, since it's not about getting help when you're stuck. I wonder if it makes more sense to put it at the end of this section?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intended this to aid flow into the next paragraph. Roughly, something like:

  • This is how the thing we are talking about now is similar to the things we talked about just before
  • These are some of the ways in which people use this thing beyond what we already talked about
  • But these are some ways in which that could be considered problematic

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. In my view, the ethical problems apply regardless of whether you're using an LLM to get help when stuck, or using it to write whole programs from scratch (or refactor, translate code, etc). So I don't see why it needs to be right here in that regard.

However, there are drawbacks that you should be aware of.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you take my suggestion of making the prior paragraph a "sidebar", then this should probably change to something like:

Suggested change
However, there are drawbacks that you should be aware of.
Additionally, there are drawbacks that you should be aware of.


The models used by these tools have been "trained" on very large volumes of data, much of it taken from the internet, and the responses they produce reflect that training data, and may recapitulate its inaccuracies or biases.
The environmental costs (energy and water use) of LLMs are a lot higher than other technologies, both during development (known as training) and when an individual user uses one (also called inference). For more information see the [AI Environmental Impact Primer](https://huggingface.co/blog/sasha/ai-environment-primer) developed by researchers at HuggingFace, an AI hosting platform.
Concerns also exist about the way the data for this training was obtained, with questions raised about whether the people developing the LLMs had permission to use it.
Other ethical concerns have also been raised, such as reports that workers were exploited during the training process.

**We recommend that you avoid getting help from generative AI during the workshop** for several reasons:

1. For most problems you will encounter at this stage, help and answers can be found among the first results returned by searching the internet.
Copy link
Member

@alee alee Mar 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't necessarily agree with the recommendation that learners not use LLMs during a workshop but this is a pretty soft position. Perhaps a brief interlude could have the instructor use a LLM live and demonstrate the back and forth assessment of the responses provided and techniques for effectively constraining and prompting an LLM. I have found tools like the the latest chatgpt, perplexity, notebooklm, github copilot, v0.dev, etc. to be valuable aids to my work but have also seen first-hand the effects of blind application of LLM responses without critical assessment; regardless people are using and will continue to use these tools so it may be important to demo some subset of good practices around them.

There was a "cooking" / "recipe" analogy raised on the mailing list that I don't think quite fits either, the main concern in my opinion is LLMs are statistical regurgitation-of-our-past-knowledge black boxes - https://garymarcus.substack.com/p/decoding-and-debunking-hard-forks does a good job of articulating these issues...

For a resources section I think this YouTube video (by Andrej Karpathy - worth following IMO) might be worth including, it is an excellent introduction to understanding what the current crop of LLMs actually do and how to more effectively use them:

https://www.youtube.com/watch?v=EWvNQjAaOHw

2. The foundational knowledge and skills you will learn in this lesson by writing and fixing your own programs are essential to be able to evaluate the correctness and safety of any code you receive from online help or a generative AI chatbot.
If you choose to use these tools in the future, the expertise you gain from learning and practising these fundamentals on your own will help you use them more effectively.
3. As you start out with programming, the mistakes you make will be the kinds that have also been made -- and overcome! -- by everybody else who learned to program before you.
Since these mistakes and the questions you are likely to have at this stage are common, they are also better represented than other, more specialised problems and tasks in the data that was used to train generative AI tools.
This means that a generative AI chatbot is _more likely to produce accurate responses_ to questions that novices ask, which could give you a false impression of how reliable they will be when you are ready to do things that are more advanced.


::::::::::::::::::::::::::::::::::::::: challenge

## What Happens When
Expand Down
Loading