Units 6 and 7. Generative artificial intelligence: foundations and applications

NoteObjectives
  • Explain what generative AI is and how language models produce text.
  • Know its innovative applications, its technical challenges and open lines of research.
  • Recognise its responsible uses for study and its limits, especially hallucinations.
  • Verify the information and references that an AI produces.

Required reading

Walters, W. H.; Wilder, E. I. (2023). Fabrication and errors in the bibliographic citations generated by ChatGPT. Scientific Reports, 13, 14045.

Further reading

  • Kasneci et al. (2023)
  • Bender et al. (2021)

The generative AI block covers units 6 to 9 of the syllabus. This chapter covers foundations, applications and technical challenges (units 6 and 7); the next one covers ethics, authorship and regulation (units 8 and 9).

1. What generative AI is

Generative artificial intelligence produces new content (text, images, audio, code) from patterns learned from large amounts of data. Conversational assistants are based on language models: systems trained on huge collections of texts to predict the most likely word (in fact, word fragment) that follows a given text. By repeating that prediction again and again, the model writes fluent answers.

Three important consequences follow:

  • The model produces what is plausible, not necessarily what is true. Bender et al. (2021) critically called them “stochastic parrots”: they combine linguistic forms without their own access to meaning or facts.
  • What it knows depends on its training data: it may not know recent facts and may reproduce the biases in those data.
  • How you ask matters: a clear prompt, with context, goal and format, gives better results.
The text 'The library offers …' goes into a box labelled 'Language model', which returns probability bars for the next word: books 46%, access 31%, services 15%, coffee 5% and dragons 3%. Note: invented probabilities to illustrate the idea.
Figure 1: How a language model generates text: it estimates the probability of each possible continuation and chooses one; then it repeats. Nothing in the process checks that the result is true.

Some systems combine the model with a search engine or a document collection and answer from what they retrieve (retrieval-augmented generation). This improves currency and makes it possible to link sources, but it does not eliminate errors: you must check that the source says what the system claims.

2. Innovative applications and technical challenges

Generative AI is already used to draft and translate texts, summarise documents, write and review code, create images, audio and video, support customer service with conversational assistants and help search for and organise information. In information and documentation, applications include automatic description of collections, transcription of historical documents and search engines that answer in natural language citing their sources.

Its technical challenges define the open lines of research:

Challenge What it involves
Truthfulness Reducing hallucinations and grounding answers in verifiable sources
Currency Incorporating information after training without retraining the whole model
Explainability Understanding why the model produces a particular answer
Bias Detecting and mitigating biases inherited from the data
Efficiency Reducing the energy consumption and cost of training and using the models
Evaluation Reliably measuring what they can do and where they fail
Detection Distinguishing generated content from human content, which cannot be done reliably today

3. Hallucinations

A hallucination is an answer that looks correct but is false or invented. In academic work, the most dangerous one is the fabricated reference: an article with plausible authors, title, journal and DOI that does not exist. Walters & Wilder (2023) asked ChatGPT for short literature reviews and checked every reference: a large share of GPT-3.5’s citations were fabricated, and with GPT-4 a smaller but noticeable proportion remained; in addition, many real references contained errors.

On the left, three pieces: an author surname from the field, the name of a real journal and a title on the topic. They combine into a complete, plausible reference. An arrow leads to a magnifying glass checking a database, which returns: not found.
Figure 2: How a fabricated reference arises. The model combines plausible pieces (a real author, a real journal, a title on the topic) into a reference that does not exist; only checking in a database reveals it.

4. Responsible uses for study

Kasneci et al. (2023) review opportunities (tailored explanations, writing support, personalised practice) and risks (dependence, errors, bias, plagiarism). A practical criterion is to distinguish uses by what you delegate:

Use Risk Good practice
Asking it to explain a concept Medium Compare with a textbook or a reliable source
Generating ideas or an initial outline Low-medium Use it as a starting point, not as a result
Checking the spelling and clarity of your text Low Review each change; the text is still yours
Searching for literature High Verify every reference in a database
Summarising a document Medium Read the original; the summary may omit or invent
Writing the assignment for you Unacceptable It is presenting someone else’s work as your own (Unit 3)

Before using AI in a course, check what the teaching staff allow and declare its use when required (you will see this in the next chapter).

5. How to verify what an AI produces

  1. References: look up each one by its DOI (at doi.org or Crossref) or by its title in Google Scholar, OpenAlex or the database for your field. Check authors, year and journal.
  2. Data and facts: apply lateral reading and SIFT (Unit 1).
  3. Attributed quotations: find the sentence in the original source.
  4. Content: check that the real source says what the AI claims it says.

R practice: checking references against a database

The %in% operator checks which elements of one vector are in another. Imagine an AI has given you five DOIs and you have a list of the DOIs that exist in a database:

Exercise 6.1

Calculate the proportion of fabricated references (those not in the database). Remember that ! reverses a logical value and that mean() of a logical vector gives the proportion of TRUE.

Compare with the vector database.

mean(!(ai_dois %in% database))

0.4: two of the five references do not appear. In practice, a DOI missing from a list does not prove it does not exist: you have to look it up at doi.org. But a DOI with a strange format or one that does not resolve is a clear sign of a fabricated reference.

Lab: a miniature language model

Lab · runs in your browser

This toy model has “read” only a dozen sentences about libraries and information. For each word it counts which words follow it and how often (a bigram model). Choose a starting word and the temperature: with low temperature it almost always picks the most likely word; with high temperature it takes more risks. Generate several sentences: you will see fluent and plausible texts, some of them false. Large models are vastly more complex, but they share this idea: predicting what comes next, not checking the truth.

Try: generate sentences from “the” at temperature 2. Do any of them claim something the corpus does not say? That is, on a small scale, a hallucination.

Lab: verifying references

Lab · live data from doi.org and Crossref

Paste the DOIs an AI has given you (one per line; the full link also works). The lab checks at doi.org whether each DOI exists and, if it is registered with Crossref, retrieves the title and year so you can check that they match what the AI told you.

A DOI that exists is not enough: check that the title, authors and year match the reference the AI gave you. Walters & Wilder (2023) found, as well as fabricated references, many real references with errors in their details.

Lab: review your prompt

Lab · runs in your browser · sends nothing to any AI

A good prompt usually gives context, a specific task, the format of the answer, limits and a request for verification. Write yours: the lab looks for those pieces by keywords and suggests what to add. It is a rough guide, not a mark.

Try to improve the example prompt until it has all five pieces and compare it with the one in example 2.

Worked examples

NoteExample 1 · Auditing a bibliography generated by an AI

You ask an assistant for five references on “reproducibility in psychology”. Procedure for each reference:

  1. Does it have a DOI? Open it at https://doi.org/ followed by the DOI. If it does not resolve, be suspicious.
  2. If it resolves, compare title, authors, journal and year with what the AI gave: sometimes the DOI exists but belongs to another article.
  3. If it has no DOI, search for the exact title in quotation marks in Google Scholar, Crossref or OpenAlex.
  4. Classify each reference: correct, with errors (year, authors, pages) or fabricated.
  5. Do not use any reference you have not located and read at least in its abstract.

Common result: some references are real, others mix the authors of one work with the title of another, and one does not exist. This is what is known as a hallucination: the model generates plausible text, it does not query a database (unless it uses a search tool, and even then it is worth checking).

NoteExample 2 · Improving a prompt

Vague prompt: “Tell me about open science”.

Improved prompt: > Act as a tutor for an undergraduate student of Information Science. Explain in 300 words what open science is, with three examples of practices (open access, open data, preregistration). Use clear language. Do not include references: I will search for them myself in databases. At the end, suggest three questions to check whether I have understood.

Elements that improve the result: role, audience, specific task, length, format and limits (here, avoiding references that could be fabricated).

NoteExample 3 · A figure that sounds right

An AI states: “70% of psychology studies cannot be replicated, according to the 2015 project”. Verification: the Open Science Collaboration (2015) project replicated 100 studies and obtained significant results in the same direction in 36% of the replications, compared with 97% of the originals. The AI’s figure is a simplification that mixes criteria: you need to go to the source and cite the exact figure with its definition.

Graded exercises

Basic. Why can a language model fabricate a reference that looks correct?

Because it generates the most likely sequence of words from patterns in its training: it produces something shaped like a reference (plausible authors, a real journal, a year) without checking that it exists.

Intermediate. Rewrite this prompt so that it is useful and safe: “Write the literature review for my bachelor’s thesis”.

Example: “My bachelor’s thesis is about [topic]. Propose a five-section structure for the literature review, with the key concepts of each section and the search terms I should use in Dialnet and Scopus. Do not write the text and do not invent references”. This way the AI helps you plan and does not replace your work.

Advanced. Ask two different AI assistants for ten references on a topic you are interested in, audit them all with the procedure in example 1 and compare the error rates.

Present a table with each reference, its status (correct, with errors, fabricated) and the evidence (DOI, search). State the date and the model used: results change between versions.

Activities

Esta actividad necesita JavaScript.

Esta actividad necesita JavaScript.

WarningCommon mistakes
  • Using AI as a literature search engine without verifying each reference.
  • Asking the AI itself whether the reference exists: it may confirm it with complete confidence even if it is false.
  • Taking fluency for accuracy: a well-written text is not a true text.
  • Delegating what the course wants you to learn. AI can help you learn, not learn for you.
  • Not declaring its use when the teaching staff require it (next chapter).

Assessed challenge

ImportantUnits 6 and 7 challenge · Auditing an AI’s references
  1. Ask a generative AI assistant for a list of ten academic references on a topic you are interested in. Save the full prompt and answer.
  2. Verify each reference: does it exist? Are the authors, year, title, journal and DOI correct? Does the content match the topic?
  3. Classify each one as correct, real with errors or fabricated, and calculate the proportions.
  4. Repeat the search in a database (Unit 2) and compare the quality of the results and the time taken.

Submission: a report made with the submission template. It is assessed with the rubric included in the template. This challenge has no solution in the book: each student works on a different topic and the teaching staff mark it.

Self-assessment

Answer all the questions and press Show answers: correct answers turn green, wrong ones red, and you will see your score. You can change your answers and check again. It does not count towards your mark.

  1. A language model generates text by predicting the most likely fragment that follows a given text.
  2. An AI answer that looks correct but is false or invented is called a
  3. If an AI gives a reference with a DOI, authors and journal, the reference exists.
  4. Which of these uses is riskiest?
  5. If 3 of 12 references generated by an AI are fabricated, the proportion fabricated is
  6. Retrieval-augmented generation completely eliminates errors.
  7. Why can a language model fabricate a plausible reference?

  1. What a language model knows depends on its data
  2. Detectors exist today that distinguish AI-generated text from human text with complete reliability.
  3. To check whether a reference given by an AI exists, the most reliable approach is to
  • It repeats that prediction to write the answer.
  • A plausible but false answer.
  • It may be fabricated: it must be verified.
  • Walters and Wilder found many fabricated references.
  • 3 / 12 = 0.25.
  • It improves currency, but sources must be checked.
  • It produces what is plausible, not what is true; there is no intent.
  • It may not know recent facts and may inherit their biases.
  • Detection is one of the open technical challenges.
  • The AI may confidently confirm a false reference.

Further resources

Resource What it is for
Crossref Checking DOIs and metadata
OpenAlex Checking whether an article exists
UNESCO – Guidance for generative AI in education and research (Miao & Holmes, 2023) International guidance
Bender, E. M., Gebru, T., McMillan-Major, A., & Shmitchell, S. (2021). On the dangers of stochastic parrots: Can language models be too big? In Proceedings of FAccT ’21 (pp. 610–623). ACM. https://doi.org/10.1145/3442188.3445922
Kasneci, E. et al. (2023). ChatGPT for good? On opportunities and challenges of large language models for education. Learning and Individual Differences, 103, 102274. https://doi.org/10.1016/j.lindif.2023.102274
Walters, W. H., & Wilder, E. I. (2023). Fabrication and errors in the bibliographic citations generated by ChatGPT. Scientific Reports, 13, 14045. https://doi.org/10.1038/s41598-023-41032-5