LSMA

LONDON SCHOOL OF MULTIOMICS & AI

Free course

Free course

0 of 35 lessons

Lesson 8 of 9

Module 3 · Coding with AI assistants

Working responsibly

Working responsibly

Working responsibly

Using AI well includes knowing when not to use it, and saying clearly how you did. This is now expected by universities, journals and employers.

⏱ 10 min readModule 3 · Coding with AI assistantsFree
Lesson at a glance3 steps · about 10 min
  1. When not to use it
  2. Disclose it
  3. Keep a short log

When not to use it

  • When you are learning a fundamental skill. Struggle a little first; that is how the skill forms.
  • When you cannot check the answer: an unfamiliar statistical method, a clinical decision, a security setting.
  • When the rules of a course, exam, employer or funder do not allow it. Read them.

Why each of these matters

  • Learning a fundamental skill. A skill forms when you have to recall and apply it yourself. If an assistant writes every for loop and every if statement for you, the code may run, but you will not recognise the mistake when a loop stops one item early. A good rule while you are learning: write a first attempt yourself, and only then ask the assistant to explain what is wrong with it.
  • When you cannot check the answer. An assistant produces text that sounds equally confident whether it is right or wrong. Suppose you ask which test compares tumour and normal samples taken from the same patients. If you do not yet know the difference between a paired test (two measurements from the same person) and an unpaired one (two separate groups), you cannot tell whether the suggestion fits. The same goes for a clinical decision, where an error affects a patient, and for a security setting, where an error may expose data and nobody notices until it is too late.
  • When the rules do not allow it. Rules differ widely. One course may allow assistants for coursework and forbid them in exams; an employer may allow only an approved tool; some funders do not allow reviewers to paste an application they are assessing into an AI tool, because that document is confidential. The rules usually sit in a course handbook, an IT policy or the guidance for applicants. Reading them takes minutes; breaking them can cost a degree or a job.

There is also a data question behind all three. Text you type into an online assistant leaves your computer and is processed by someone else's servers. Never paste identifiable patient data, unpublished results or passwords into a tool your organisation has not approved for that purpose.

The other side of the list is where an assistant fits well: tasks you could do yourself and can check quickly. Restyling a figure you have already drawn correctly, turning a working loop into a pandas command, writing the docstrings for functions you understand, or explaining an error message are all good examples. A simple question sorts most cases: could I check this answer properly within a few minutes? If yes, the assistant saves you time. If no, it moves the work from writing to checking, and the checking is the hard part.

A quieter risk is automation bias: the tendency to accept a machine's suggestion and to stop looking for mistakes, especially when it has been right many times before. You saw its effect in the studies of Read before you run. The defence is not suspicion of every line, but a fixed routine, such as the review checklist and tests, that you follow whether or not the code looks right.

Disclose it

Most journals say AI tools cannot be authors, because they cannot take responsibility for the work, and that their use must be described. Policies differ, so check your journal's and institution's guidance. A disclosure says which tool, what for, and how the output was checked.

Being an author is more than writing words. An author approves the final version, answers questions from readers and reviewers, and corrects the record if an error is found later. A piece of software can do none of these things, so the responsibility stays with the people who used it. A disclosure is a short, plain statement that lets a reader judge how the work was done. Below is an example for a small code project. It lives in the project's README, the text file that people read first when they open a code folder.

README.md
## Use of AI tools
An AI coding assistant ([tool and version], used [month year]) helped draft
`seqtools.py` and suggested test cases. All code was reviewed by the author,
expected values in the tests were worked out by hand, and all tests pass.
No data were shared with the tool.

What this does

This is not Python. It is Markdown, a plain-text format that sites such as GitHub display with headings and formatting. Line by line:

  • ## Use of AI tools is a heading. In Markdown, two # signs make a second-level heading, so this appears as a section title inside the README.
  • The first sentence names the tool. The square brackets are placeholders: you replace [tool and version] and [month year] with the real details. The date matters because assistants are updated often, and the same request can give different code a few months later.
  • It then says what the tool did: it helped draft one file, seqtools.py, and suggested test cases. The backticks around the file name make Markdown show it in a code font.
  • The second sentence says how the output was checked: a person reviewed all the code, the expected values in the tests were worked out by hand, not taken from the tool, and the tests pass.
  • The last line covers data. It tells a reader that no samples, patient records or unpublished results were sent to the tool.

Notice what the disclosure leaves out. It does not list every prompt, and it does not apologise for using the tool. Five lines are enough for a reader to judge the work.

The most common weak disclosure is a single vague sentence, such as "AI tools were used in this project". It tells a reader nothing they can act on: not which parts, not what for, and not how anything was checked. Each of the three elements, which tool, what for and how it was checked, answers a question a reviewer would otherwise have to ask.

In a paper or thesis, the same content usually goes in the methods section or the acknowledgements, whichever the journal or university asks for. A methods version might say that an AI coding assistant, named with its version, was used to draft the functions for quality filtering; that all code was reviewed by the authors and tested against hand-worked examples; and that no study data were shared with the tool. It is the README text above, written as prose.

The rule that AI tools cannot be authors is set out in several guidelines. The International Committee of Medical Journal Editors (ICMJE) added it to its Recommendations in 2023. The Committee on Publication Ethics (COPE) published a position statement, “Authorship and AI tools”, the same year. Nature set out similar ground rules in an editorial in January 2023.

Policies agree on authorship but differ on details: whether help with code or language editing must be disclosed, and where the statement goes, such as the methods or the acknowledgements. They are also revised often. Read the current policy of the journal you are submitting to, and note the date of the version you followed.

Keep a short log

For anything substantial, note the date, the tool, what you asked, and what you changed. It takes a minute, makes your work reproducible, and answers questions from supervisors and reviewers later.

A log entry can be a single line in a text file kept next to your code. For example, in words: on a given date, using a named assistant, you asked for a function that reports the GC content of each sequence in a FASTA file; you renamed two variables, added a check for empty sequences that the draft did not handle, and wrote three tests with hand-worked answers.

Why bother? Reproducible work is work that someone else, or you in a year's time, can repeat and get the same result. You cannot rely on asking the assistant again, because its answer may differ. What you can rely on is the code you kept and the record of what you changed and why. The usual mistake is to keep no notes at all, and then be unable to say months later which parts of a thesis chapter's code were drafted by a tool.

A log is most useful when every entry has the same few parts: the date, the tool, the task in a sentence, what you changed, and how you checked it. The last part matters most. "Tested" alone says little; "three pytest tests with hand-worked answers, as in Testing AI-written code" tells a reader exactly what was done. What you leave out matters too: never copy data or keys into the log, for the reasons in Privacy, security and licences. Describe the data instead, for example "a sample sheet with 48 rows and 6 columns".

Worked example · who is accountable?

an AI-drafted function miscounts reads → a figure in your thesis is wrong
the tool is not the author, so the error is yours
tests, review and disclosure are how you stay in control of what you sign

Step by step. First, the function was drafted by a tool and used without a test that compared it with a hand-counted answer. Second, its output became a figure, so the error moved from the code into your results. Third, you put your name to the thesis, and the tool cannot share that responsibility. Fourth, the defences are the habits from this module: a test with a value you worked out yourself would have caught the miscount, a line-by-line review might have spotted the cause, and the disclosure tells examiners exactly which code to look at.

What the answer means. Using an assistant does not change who answers for the result. It changes how much checking you need to do. The more of the code a tool wrote, the more you rely on tests and review to be sure it does what you think.

The whole routine in one picture

The four habits in this lesson fit together in order: decide whether to use the assistant at all, check what it gives you, record what you did, and say so when you share the work.

Working responsibly · LSMA free course Four boxes from left to right: decide whether to use an assistant, check its output, log what you did, and disclose it. A bar underneath says you remain accountable for the work. FROM REQUEST TO SUBMISSION 1 · DECIDE 2 · CHECK 3 · LOG 4 · DISCLOSE Can I check the answer myself? Do the rules allow it? Read every line. Test against values worked out by hand. Date and tool, what you asked, what changed. Which tool, what it did, how the output was checked. The tool is not the author: you remain accountable for the work
Read left to right. Steps 1 and 2 happen while you work; steps 3 and 4 make the work open to others. The bar underneath holds for every step. Schematic.
Go deeper: let git keep the log for you

If your project uses git, the version control system, each commit can carry your log entry for you. Commit AI-drafted code on its own, with a message that says so: git commit -m "Add gc_content, drafted with AI assistant; tests worked by hand". Months later, git log --oneline -- seqtools.py lists every change to that one file, with dates and messages, and shows which commits involved a tool.

Record the package versions too. pip freeze > requirements.txt writes every installed package and its exact version into a text file. The same code can behave differently under a different pandas or scikit-learn version, so this file is part of what makes the work reproducible. Together, the commit messages and the requirements file answer most of the questions a supervisor or reviewer will ask.

Key point

Use AI openly, check it rigorously, and be able to explain every line of what you submit.

A second example: in a lab meeting, a colleague asks why your script removes reads shorter than 30 bases. "The assistant put that in" is not an answer. "Shorter reads map to too many places in the genome, so I kept the cut-off the assistant suggested after checking it against our protocol" is. If you cannot give the second kind of answer for a line, find out before you submit.

Further reading · Module 3Wilson et al. 2014: testing and review habits that apply to AI-written code too. · All reading for this course

Check your understanding

1. Why can an AI tool not be listed as an author?

2. What belongs in a disclosure?

3. When is it wise not to use an assistant?

Up next

Project

A tested tool, built with AI

Ask BioTutor

Create a free website with Framer, the website builder loved by startups, designers and agencies.