Department of Computer Science and Technology

Course pages 2019–20

Machine learning for programming

Principal lecturer: Dr Andrew Rice
Additional lecturers: Miltos Allamanis, Marc Brockschmidt
Taken by: MPhil ACS, Part III
Code: P252
Hours: 16 (8 2-hours sessions)
Class limit: max. 10 students
Prerequisites: Undergraduate-level knowledge of compilers, program analysis, machine learning. Good programming skills are essential.


This module investigates how machine learning techniques can be applied to the analysis and synthesis of computer programs. A variety of machine learning techniques will be covered considering different applications such as program repair, code suggestion, summarisation and comment-generation.
The course is based around the implementation of machine learning tasks. For example, 'CommentGeneration: generate a Javadoc comment for a method in a class' or 'VarNaming: given a piece of source code with the name of a single variable removed predict the missing name'.
Module attendees will be given a list of tasks and their descriptions before the course starts and asked to rank them in order of preference. Each student will be assigned a task to implement over the course. We will suggest relevant papers to form the starting point for each project.


  • Session 1 (2hr): Introduction, task assignment, project planning
  • Session 2 (2hr): Briefing lecture and deep learning practical
  • Session 3 (2hr): Individual demonstrations of completed practicals, feedback on project plan
  • Sesions 4,5,6,7 (2hr): Weekly 1-on-1 feedback sessions
  • Session 8 (2+2 hr): Show and tell presentations, demo, brief writeup: what works well and what doesn't. 15 minute slots.


On completion of this module, students should:

  • gain a general familiarity with the state-of-the-art in this area;
  • have investigated one particular technique in detail;
  • have attempted to reproduce a research result from the literature.


Students will deliver regular written reports of progress and a project writeup. Marks will also be assigned for the quality of the software written and the final presentation.


  1. Feature extraction practical (5%)
  2. Deep learning practical: model implementation + evaluation (5%)
  3. Written project plan (10%)
  4. Half-page weekly summary 1 (5%)
  5. Half-page weekly summary 2 (5%)
  6. Half-page weekly summary 3 (5%)
  7. Half-page weekly summary 4 (5%)
  8. Project presentation (10%)
  9. Project report and code (50%)

Recommended reading

Course participants will benefit from an understanding of sequence processing. We suggest the tutorial 'Understanding LSTMs' ( by Chris Olah and the practical exercises: Generating Names with a Character-Level RNN for PyTorch (, and Text generation using a RNN with eager execution for TensorFlow ( During the course students are free to choose their preferred machine learning libraries so there is no requirement to learn both PyTorch and Tensorflow.

The other aspect of this course requires is a familiarity with javac (the Java compiler). We make use of an existing open-source feature extractor for javac ( To find out more about the workings of the Java compiler we recommend 'The Hitchhiker's Guide to javac' (

As the course progresses we will recommend specific papers based on the particular task each student is undertaking.