INF1-IP: Week 5

Lecture 8 - Introduction to Generative AI

This lecture does not introduce new programming concepts and as such is not assessed and has no related self-guided notebook or key terms. We give this lecture because we think it is important for programmers to have a basic understanding of the field of AI, and give it in this week to not provide too much new programming material in the week of the first Class Test.

  • Lecture slides: TBA

 

Learning outcomes
  • Describing the field of artificial intelligence and its major subfields
  • Understanding, on a high level, how large language models generate text
  • Understanding the ethical implications of creating and using LLMs and the causes of these issues

 

Further reading
  • The University of Edinburgh's generative AI platform: ELM
  • Anatomy of an AI System, 2018, by Kate Crawford and Vladan Joler: shows everything that goes into building an Amazon Echo device! Pre-GenAI but still very relevant today.
  • Emily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. 2021. On the Dangers of Stochastic Parrots: Can Language Models Be Too Big? 🦜. In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency (FAccT '21). Association for Computing Machinery, New York, NY, USA, 610–623. https://doi.org/10.1145/3442188.3445922

 


 

Lecture 9 - Code quality 1: Testing and documentation

  • Lecture slides: TBA
  • Self-guided notebook (right-click → Save As... then remove the .txt part so it is saved as an .ipynb)

 

Learning outcomes
  • Applying decomposition and DRY to give functions clear, reusable jobs
  • Explaining test-driven development and the red → green → refactor cycle
  • Writing assert checks to automatically verify program functionality

 

Key terms
Click to expand.

Decomposition

Breaking a problem into smaller parts with clear responsibilities.

DRY

“Don't Repeat Yourself”: keeping a shared rule in one place.

Refactoring

Improving code's structure while preserving its intended behaviour.

Assertion

A condition that is checked during execution. A false condition causes an AssertionError.

Test case

An input together with its expected result or behaviour.

Test-driven development

An approach to coding in which you write a failing test for a small requirement, implement it, and then improve structure while keeping the tests passing.

Regression test

A retained check that can catch the return of a repaired bug.

 

New syntax
Click to expand.

assert condition

Continues silently if condition evaluates to True or stops the program with AssertionError if not.

assert condition, "message"

Includes a message with the AssertionError if the assertion fails.

AssertionError

A type of error raised when an assertion fails.

 

Further reading and practice

 


 

Tutorial

Tutorial 3: The Tools of the Trade 2 walks you through installing packages from the internet and setting up virtual environments to manage more advanced Python projects.

  • Interactive notebook (right-click → Save As... then remove the .txt part so it is saved as an .ipynb)
    • Note that this notebook was created to be used in Notable; its interactive checker cells might not work in every environment.

 


 

Assessment

Class Test 1 will take place on Thursday 22nd October in AT6:06. Check your timetable to see which session you are scheduled for.

For details, see Assessment.

 


 

License
All rights reserved The University of Edinburgh