All in One View

Content from Introducing LLMs as a Learning Tool


Last updated on 2026-07-30 | Edit this page

Overview

Questions

  • What do I want to learn?
  • What AI chatbots are available to me?
  • How do I get started?

Objectives

  • Understand learning through challenge
  • Identify a learning goal
  • Choose an AI chatbot
  • Use R to explore data

Generative AI As A Learning Tool

Generative models and agents, including LLMs, can be used to automate a wide variety of tasks, at work and in our lives. But automating a task while we are still learning how to do it can limit our learning and our ability to build up more complex and creative skill sets.

We can use AI tools to positively support our learning journey instead. In this class we will explore and practice some ways that we can use Large Language Models to inform, challenge and support us as we learn how to write software code to analyse research data.

Choosing An AI Partner

There are many popular AI models available online, including:

In addition, institutions might run their own, local copies of models like such as DeepSeek or Mistral:

Choosing A Programming Language

Researchers use many different programming languages to solve problems in data analysis and modeling. This course provides examples in Python and R. Both of these languages are widely used in research computing, since they are open source, freely available and have large user communities who contribute useful code.

You could use the approach in this course to learn other languages too, but remember that the more widely used a language is, the better it is represented in AI training data, and the better an LLM will support it.

Discussion

Challenge : What Tools Do We Have

Do you know what Generative AI tools are available and supported in your environment?

Discuss with each other and with your instructor:

  1. What AI tools have you heard of?
  2. Which are most often used in your institution/s?
  3. Are there any special policies that affect your choice?
  4. Can you access your tool of choice right now?

Choose an appropriate LLM to use today and open a session.

Getting Started with R

Following https://southampton-rsg-training.github.io/data-analysis-and-visualisation-r/1-starting-with-data.html

What is R? What is RStudio?

  • Define R (language) and RStudio (IDE)

Knowing your way around RStudio

  • Screenshot of four panes

R Basics

  • Run 3 + 5 in R Console
  • Create variable with data e.g. weight_kg <- 55
  • View contents e.g. weight_kg

Load Data

R

gapminder <- read.csv( "gapminder_data.csv" )
head( gapminder )
summary( gapminder )
Key Points
  • Generative AI tools like LLMs can either hinder or help our learning
  • We can use them to support our learning through explanations, prompting and challenges
  • Choice of specific tools might depend on local policies.

Content from Writing Effective AI Prompts


Last updated on 2026-07-30 | Edit this page

Overview

Questions

  • FIXME

Objectives

  • Practice interacting with an AI chatbot
  • Use ggplot2 to plot data
  • Remember to ask followup questions

Starting A Conversation


Callout

An Unpredictable World

Most computer programs are deterministic. Given the same input, they will always produce the same output. So in most software lessons, you can expect the same result when you type along with the instructor.

Generative AI is not deterministic, it is probabilistic, so can produce different results from the same input.

As a result, this class will depend on you and your interaction with your LLM of choice. The instructor can guide and direct you, but the experience is not “right or wrong”.

Imagine that you are an early career researcher. You have spent several months carefully collecting data. But you are now under deadline pressure to analyse the data and produce figures for your next paper. You need to write a script to load the dataset, calculate some statistics and produce visualisations, but you have no idea how to proceed.

Challenge

Exercise

Open a LLM chat window in your web browser, type in and submit the prompt:

Teach me to code

Look at the output generated by the LLM and reflect on the questions:

  1. Is the response meaningful and useful?
  2. Does the response suggest leanring paths for the language you want to learn?
  3. Can you identify what you would need to learn to solve your specific data analysis problem?

Many LLMs produce comprehensive and helpful answers to this prompt. However the responses are very general. At the time of writing, Microsoft Copilot, for example, proposes a 7 month curriculum for learning data science. It also proposes learning paths specifically for Python and Javascript. If you are interested in R or other data science languages, this might not be the most helpful approach.

Some More Precision

LLMs are trained on a large variety of texts, and can produce an endless array of possible responses to prompts. In order to generate the most useful response, we need to submit as clear and expressive a prompt as possible. The previous prompt had promising output, but was too general. Let’s try something more specific:

TODO: Python vs R alternatives {prompt} I need to write a script in python to load data, generate statistics and produce figures. What skills do I need to learn to achieve this?

TODO: Consider very different response structures from different LLMs.

Activity 1: Practice interacting with an AI chatbot


Use a chatbot like https://google.com/ai to understand the value of context

  • How many years are available?
    • “It looks like your question is missing some context”
  • How many years are available in gapminder?
    • Official Gapminder Platform (300 years) vs Gapminder R / Python Programming Package (55 years)
  • How many years are available in https://swcarpentry.github.io/r-novice-gapminder/data/gapminder_data.csv?
    • “There are 12 specific years available in that Software Carpentry Gapminder dataset”

Activity 2: Create your first plot (manually)


Load data

  • Confirm gapminder is loaded via head( gapminder ) or refer to Episode 1

Load ggplot2

Run code

R

ggplot( gapminder, aes( year, gdpPercap ) ) +
    geom_point()

Activity 3: Ask the chatbot to explain the code


This is my first time using R. Can you explain what this code is doing, line by line? ggplot( gapminder, aes( year, gdpPercap ) ) + geom_point()

What follow-up questions do you have? Some possibilities: - How does it know to plot year on the x-axis? - Why does ggplot use +? - Explain the difference between aes in ggplot and in geom_point as simply as you can

Activity 4: Modify the plot with help


This is my first time using R. Modify this code in the simplest way possible so that [insert modification]. Explain what the changes do.

Some possibilities: - Dots are colored by continent - color=continent - Dots are spread out more and don’t overlap - geom_jitter() - The outlier dots are labeled - geom_text( data = subset( gapminder, gdpPercap > 50000 ), aes( label = country ), color = “black” )

Content from Analysing a Real Program


Last updated on 2026-07-30 | Edit this page

Overview

Questions

  • FIXME

Objectives

After following this episode, learners will be able to…

  • Run a block of code.
  • Trace the flow of a block of code.
  • Make small modifications to a block of code and observe how its behaviour changes.
  • Prompt a chatbot for an explanation of a line or block of code.

Understanding Existing Code


  • introduce some messy script
    • important to also (briefly) discuss the way scripts are used: typically run on the command line by an interpreter program. that means learning a bit about file paths.
  • a good (AI-free) strategy is to copy out chunks of code and run them, adjust them and run again.
  • as long as you do this on a copy, you can always recover the original version
  • you will often need to include variables from further up the script.
    • with practice, it becomes faster to comment out lines you do not want to run. Most text editors/IDEs provide a keyboard shortcut for this (often Ctrl+/).
    • it can be very helpful to insert print statements at chosen points throughout the code to give a quick indication of the state of variable(s) during execution. Comment them out as needed and remove them altogether when you are done.
    • if you need to, add comments as you go to make note of what’s going on.
    • (later on in the lesson: when you have a chunk behaving how you want it to, it might be good to capture that as a function.)
  • this will help you trace the execution of code, an essential skill for evaluating whether code is doing what you want/need it to even if the code itself is AI-generated (or written by somebody else – or by yourself three months ago!)

EXERCISE here giving learners a chance to practice isolating and interrogating a section of code.

EXERCISE: draw a flow chart describing the code.

  • when you get stuck, cannot figure out what a particular block of code is doing, ask somebody.
  • paste the code into your chatbot, ask it to explain the code. Include information about your level of expertise.
    • always try to understand it yourself first, or at least make a guess: you will learn more if you can compare the chatbot’s response with the answer you expected.
  • if the response includes words you do not understand, ask for a definition (Glosario can be a good source of these too). More on this in the next episode.
  • check your understanding and the veracity of the explanation that was generated.
  • based on your interpretation of the response, adjust the code, predict what will change in the output/behaviour, then run it and check whether you were right.

EXERCISE or activity here for learners to try identifying a small change to a chunk of code, based on the explanation provided.

  • if you get an unexpected result, refer back to the explanation you received and the output you observed, and try to identify your misconception. if you cannot find it, explain to the chatbot what you changed, what you expected to see, what you actually got, and ask for clarification. “what am I missing?” rather than “fix it for me”.

  • bear in mind: sometimes the chatbot will make mistakes! if you don’t seem to be making any progress after trying this for a while, try to find a human to ask, or fire up a new chatbot session to get a “second opinion”.

  • all of the above is a good strategy if you are getting help from a human too!

  • what about providing the entire code base all at once? wouldn’t that be quicker than analysing it line-by-line, section-by-section?

  • it will be harder for you to build you own understanding of the code – it is easier to trace execution through a handful of lines than through hundreds

  • the explanation you receive may be too high-level, e.g. explaining what the script does but not helping you understand how

  • or it may be so long that it becomes overwhelming

  • managing cognitive load by keeping explanations short and taking regular opportunities to test your understanding will aid your learning

  • this will seem slow at first, but you will be able to move more quickly as you continue to learn

Content from Learning About Programming Concepts


Last updated on 2026-07-30 | Edit this page

Overview

Questions

  • FIXME

Objectives

After following this episode, learners will be able to…

  • Appreciate how the use of relevant technical terminology in a prompt can influence the style and accuracy of the response generated.
  • Identify some strategies to help them build a useful mental model of coding.

What More Can We Learn?


  • when you encounter a term or concept that you are not yet familiar with, take the opportunity to learn more.
    • knowing the right vocabulary is valuable so take note of these technical terms to use in future chatbot prompts, search queries, questions to colleagues etc. the language you use in your prompts can significantly influence the quality and specificity of the response you receive.

EXERCISE here for learners to explore how different ways of asking a question can influence the output generated in response.

  • you should be careful not to disappear down a rabbit hole altogether.

  • ask the chatbot for advice on prompting more effectively

  • strategies that can reinforce your learning as you go:

    • practice, practice, practice: ask the chatbot to generate exercises for you to complete to test your understanding
    • draw a concept map: bubbles for concepts and lines connecting them, labelled to describe the relationship(s) between these concepts

EXERCISE for learners to request exercises to reinforce understanding of some coding concept: for loops, maybe? or if/else control flow?

Content from Modifying Code


Last updated on 2026-07-30 | Edit this page

Overview

Questions

  • FIXME

Objectives

After following this episode, learners will be able to…

  • Generate a plan of steps to improve a script.
  • Execute steps in this plan.
  • Evaluate the impact of changes made.
  • Articulate the changes the chatbot should make to extend an existing script.
  • Reflect on what they are learning and what the chatbot is and is not helping with.

Using What We Have Learned


  • it is time to move on from analysing code that has already been written, and begin generating new code
  • the knowledge you have gained so far will help:
    • conceptual understanding, “computational thinking”, and familiarity with technical terminology will help you write a prompt that is more likely to generate the code you want
    • you may be more capable now of anticipating what code you will get back
    • ability to trace the flow of the generated code and test+query parts you do not understand will help you evaluate the usefulness of the output (more on this in the next episode)
  • back to our messy script: upload whole script to chatbot and prompt for:
    • a plan: what can be cleaned up and how?
      • discuss each of these suggestions. are they all useful, relevant? if the chatbot output includes a long list and makes a distinction between recommended and optional steps – do you agree with these suggestions?
    • ask the chatbot to execute one of the proposed steps, e.g. clean up variable names
    • now re-run the script: is it doing the same thing as it was before?

Then an EXERCISE, giving learners the chance to try it out again on their own, e.g. refactor code into functions * (opportunity when looking at functions to call back to earlier “analysing code” episode, where we pulled out chunks and tried them out – often, when you have finished tweaking some code and getting it to do what you want, you should capture it as a function)

  • now that the script is clean, we can think about extending the functionality.
    • ask the audience how they would modify the script – what would they want it to do? e.g. adjust the script to use wildcard to capture all *.tsv files in the working directory
    • spend some time writing prompt together as a group:
      • what info should we include?
      • how should we describe the change we want made?
      • ask participants what they expect to see in the changes produced?

EXERCISE to allow participants to experiment some more

Follow-up discussion EXERCISE to find out what people learned, where they got stuck, any weird behaviour observed from the chatbot, etc?

Toby: I found myself wondering about version control as I worked on this outline: as learners get more and more into this, they are increasingly going to benefit from viewing diffs of changes being made. the commit history also helps the model (then agent) keep track of what’s been done and why, which facilitates experimentation and work spread across multiple sessions. Where and how can we gracefully introduce this stuff?

Content from Validating What We Have Made


Last updated on 2026-07-30 | Edit this page

Overview

Questions

  • FIXME

Objectives

After following this episode, learners will be able to…

  • Recognise that evaluation of generated code and validation of results is essential.
  • Identify ways to test the code generated by a chatbot.
  • Evaluate the importance of testing different parts of the code they generate.

But Is It True?


  • Regardless of whether you wrote the code from scratch or generated it with AI, you will held responsible for the results it produces
  • LLM models make mistakes. Perhaps not often, and especially not when working with common libraries, functions, and tasks similar to those that many people have done in the past.
    • (Toby: not really mistakes, since “mistake” implies intent on the part of the mistake maker: “oops, I was wanted to do X but instead Y happened”)
  • But, whereas a person might give you some indication when they are not confident that they are giving the right answer/good advice (“I’m not really sure but if I had to guess I would say…” or “You should really ask Jessica that question: she knows a lot more about this stuff than I do…”), the output of your chatbot will project the same confidence and positivity regardless of the relevance or factual accuracy of its response.
  • It is up to you to determine whether or not the output generated is accurate and/or does what you need it to do.
  • The code tracing/review skills you have picked up in this lesson will be helpful. But looking at the code is often not enough on its own:
    • Once the script/code base gets large, it becomes difficult for one person to keep a complete mental model of how it works, and how any given change will affect the functioning of the whole. (A similar problem exists for the LLM once the code base gets very large: if the size of all the relevant information exceeds the context window of the model, performance can deteriorate as the model “forgets” critical information.)
    • It can also be difficult to consider the code that isn’t there. Changes generated by a model might all seem sensible by themselves, but be missing something that later turns out to be important.
    • Models perform worse on unusual and niche tasks, those that are not well-represented in their training data. (Toby: find the paper that Greg W shared recently re:model performance vs a benchmark of scientific challenges.) Since research computing tasks are often concerned with questions/data at the limits of current human understanding, you should be prepared to encounter more problems than somebody generating code for more routine tasks in well-trodden territory.

What are some good validation strategies?


  • Test your code!
    • Minimally, run it on a small, test dataset. Check results carefully. Think first about what you expect to see, and compare the outcome with that expectation.
    • Allocate your rigour: consider how crucial each part of the code is, and treat those parts accordingly. For example, routine plotting functions and other standard “boilerplate” is more likely to be generated correctly – and, in the case of the plotting code, errors might be detected quite easily. You might choose to spend less effort reviewing that code. But complex and/or crucial processing and calculations that are particular important for the results you will be reporting from your work merit a much closer look.
    • Consider adding some unit tests to your code: that is, code that tests the correctness of the other code. Programming languages typically have at least one framework to do this, and automated code generation has made it much easier and faster to do. Of course, you will also need to check the tests so that you can be confident that they are correct and/or testing the right things.
      • Toby: I guess unit testing is beyond the scope of this lesson? In which case, I think we should at least point learners towards a resource where they can learn more. Or we could include at least a basic example?
      • Bear in mind that scientific code may be more difficult to test: a lot of unit tests are concerned with things that are quite easily and logically testable, e.g. whether the output of a function is a positive integer, whether the function fails gracefully when provided with unexpected values, etc. But results produced by scientific code may need to be tested for their plausibility, e.g. whether they respect the laws of thermodynamics, whether a number fits within a biologically feasible range, etc. You will need to use your own domain expertise to inform this kind of evaluation, and it is worth noting that LLMs lack the kind of mental model of the world and how it works that you apply in your daily work, making them less likely to provide useful output in these cases.
  • Ask the chatbot to mark its own homework. Some users have reported good results from asking the chatbot/model e.g. “did you miss anything?”. You could also try starting a new chat session or even opening up a different chatbot/model, providing some context for the project, then asking it to review the code and provide constructive feedback on how it could be improved. (Humans can also be good at this!)

Content from Crafting A Learning Path


Last updated on 2026-07-30 | Edit this page

Overview

Questions

  • What am I confident that I know?
  • What do I want to know but don’t yet?
  • How can I ask for a strategy to master those things?
  • What am I missing? What are the gaps in my understanding?
  • How can I ask questions that reveal these gaps?
  • How can I build more complex skillsets?

Objectives

  • FIXME

Ways To Keep The Learning Going

There are a few ways to keep ourselves learning with LLMs, such as

  • Writing clear, detailed prompts
  • Asking for tuition in a specific way
  • Analysing existing code
  • Asking for explanations
  • Using chat to identify gaps in our knowledge

what to learn next: maybe as suggested prompts rather than (or as well as) links to specific recommended reading

  • reproducibility: version control, environment management, reports with Quarto
  • more software development skills and principles
  • logic? i.e. selection criteria > == != etc and &, |
  • agents and AI-forward IDEs, mention security