November 14, 2024

Bridging Human and Machine Learning: a pedagogical perspective on LLMs' learning and hallucinations

Unveiling the parallels between children’s literacy development and LLM hallucinations, this article explores how human and machine learning

Lucas Gabriel

CW's Artificial Intelligence Coordinator

 This image appears to feature an abstract visualization of two hands or forms made of glowing particles and translucent waves, illuminated in hues of orange, grey and blue. The effect creates a sense of energy, connection, or interaction, set against a dark background filled with small light particles

General Treatise on the Greatness of the Insignificant 1

Poetry is kept in words—it’s all I know.
My fate is to know almost nothing.
I have depths in nothingness.
I have no connections with reality.
To me, powerful is not the one who discovers gold.
To me, the powerful one is he who discovers insignificances (of the world and ours).
For this small sentence, they praised me as an idiot.
I was moved.
I am weak for praise.

Manoel Barros

The similarities between children's early writing attempts and LLM hallucinations are striking. Both processes involve constructing coherent language from incomplete or ambiguous information through trial and error. Just as children refine their literacy skills by experimenting and learning from mistakes, LLMs improve through iterative training and fine-tuning to reduce errors.

Emilia Ferreiro and Ana Teberosky’s research on reading acquisition, as presented in Literacy Before Schooling (1982), challenged long-held beliefs about child learning. Their studies provide profound insights not only for education but also for artificial intelligence. By unraveling the stages through which children develop literacy skills, we can draw meaningful parallels with the functioning of Large Language Models. Both processes embody the active construction of knowledge through pattern recognition and hypothesis testing, highlighting the intricate similarities between human cognitive development and machine learning.

Drawing inspiration from Jean Piaget's constructivist theories, which emphasize that children actively build their understanding through experiences, Ferreiro and Teberosky viewed children as proactive learners who experiment and develop their knowledge through interaction with their environment.

The idea that children from different cultures learn literacy in varied ways is a relatively new concept, being broadly accepted only in the past 120 years. Before this shift, it was commonly believed that children's minds were passive receptacles into which knowledge could be poured, much like filling a blackboard with information. Ferreiro and Teberosky's research provided compelling evidence to the contrary, demonstrating that children think for themselves and actively construct their understanding of language. Their work shed light on the unique cognitive abilities of children and the dynamic nature of their learning processes, proving that children are not just small adults but distinct thinkers with their own ways of making sense of the world.Their insights offer valuable parallels with the development of artificial intelligence, particularly Large Language Models (LLMs) like GPT-4 and Claude, and open source models, such as, Mistral, Llama, Phi, etc.

Ferreiro and Teberosky’s Research: Stages of Reading Acquisition

Ferreiro and Teberosky conducted their groundbreaking studies in the Spanish-speaking communities of Mexico. The research identified several stages through which children progress as they develop literacy skills:

  1. Iconic Stage: Scribbles as Silent Stories
    In the Iconic Stage, children represent writing with drawings or symbols. Instead of writing actual words, they use images to express what they intend to say. For example, when asked to write the word "heart," a child might draw a heart symbol. This initial phase is about exploring the physical act of writing through visual representations.
  1. Garatuja Stage: The First Whispers of Writing
    Moving into the Garatuja Stage, children begin to recognize that writing involves more than just drawing icons. They start to produce marks and scribbles that resemble writing but still lack a clear connection to sounds or letters. For instance, attempting to write "coração" (heart) might result in random lines and curves that mimic the flow of writing without forming actual letters or sounds.
  1. Pre-Syllabic Stage: Bridging Sounds and Symbols
    In the Pre-Syllabic Stage, children start to associate sounds with their written forms. They begin to understand that writing represents spoken language, even if they haven't yet mastered the connection between specific letters and sounds. For example, a child might attempt to write "coração" by combining random letters that don't yet correspond accurately to the syllables of the word.
  1. Syllabic Stage Without Sound Value: Recognizing Syllables
    During the Syllabic Stage Without Sound Value, children begin to segment words into syllables but do not yet consistently link these syllables to their corresponding sounds. For example, the word "jacaré" (alligator) might be written with only three letters, representing its three syllables, but without accurately reflecting the sounds of each syllable.
  1. Syllabic Stage With Sound Value: Associating Sounds with Syllables
    In the Syllabic Stage With Sound Value, children start to connect specific sounds to their written syllables. They may write parts of words using letters that correspond to the sounds they hear. For instance, "boneca" (doll) might be written as “O-E-A,” where each letter represents a syllable sound, helping bridge the gap between spoken and written language.
  1. Syllabic-Alphabetic Stage: Organizing Phonemes
    Moving into the Syllabic-Alphabetic Stage, children refine their ability to associate individual phonemes (the smallest units of sound) with specific letters. They begin to systematically represent sounds using letters, although some inconsistencies and errors may still occur. For example, a child might write “monkky” instead of “monkey,” demonstrating a clearer understanding of sound-letter correspondence but still making minor spelling mistakes.
  2. Alphabetic Stage: Mastery in Motion
    In the Alphabetic Stage, children achieve a mature grasp of orthographic rules and the complexities of language. Their spelling aligns closely with standard conventions, and they can accurately represent both regular and irregular spellings. The word "monkey" is consistently spelled correctly, reflecting their comprehensive understanding of phoneme-grapheme relationships.

To illustrate these stages, consider the evolution of the word "monkey" through each phase:

  • Iconic Stage: Draws a picture of a monkey.
  • Garatuja Stage: Scribbles resembling writing without clear letters.
  • Pre-Syllabic Stage: Writes random letters that do not correspond to syllables.
  • Syllabic Stage Without Sound Value: "J C P R" (attempting to segment into syllables without correct sounds).
  • Syllabic Stage With Sound Value: "O N K" (representing syllable sounds).
  • Syllabic-Alphabetic Stage: "monKky" (attempting sound-letter correspondence with minor errors).
  • Alphabetic Stage: "Monkey" (correctly spelled)

One of the most insightful aspects of their study is the interaction between teachers and children. Instead of dismissing early writing attempts as mere scribbles, teachers engaged children in conversations about their writing. For instance, when a child wrote "whale" with more letters than "monkey," the teacher might ask why. The child's thoughtful response, "Because a monkey is smaller and needs fewer letters, while a whale is bigger and needs more, of course!," reveals their logical reasoning and active engagement in understanding language rules. This dialogue highlights how children actively construct their understanding of language, much like scientists forming hypotheses through experimentation.

Large Language Models: Probabilistic Functions and Hallucinations

Large Language Models (LLMs) operate by predicting the next word in a sequence based on vast datasets. These models function as probabilistic entities, analyzing patterns in language to generate coherent and contextually relevant text. However, despite their sophistication, LLMs sometimes produce "hallucinations"—outputs that are factually incorrect or nonsensical.

Hallucinations in LLMs occur because these models generate text based on probabilities rather than true understanding. They analyze the likelihood of word sequences without comprehending the underlying meaning, leading to occasional errors. For example, an LLM might confidently provide incorrect information about a historical event or fabricate details that have no basis in reality.

Bridging Child Errors and LLM Hallucinations

Imagine a child’s first scribbles as an AI model's initial text generation—both are exploratory and imperfect. When a child draws a heart instead of writing "heart," they are experimenting with expressing meaning through symbols. Similarly, when an LLM produces a hallucination, it's navigating vast data to predict plausible word sequences, occasionally missing the mark.

However, it's important to recognize the differences. Critics argue that LLMs lack genuine understanding and consciousness, making their "learning" fundamentally different from human cognition. While this is a valid point, the iterative learning and error correction seen in LLMs still offer valuable lessons for refining AI. By viewing AI development through the lens of cognitive science, we can foster interdisciplinary innovations that enhance both human learning and machine intelligence.

Reflecting on learning and intelligence, one might wonder if the hallucinations of LLMs indicate a nascent form of understanding. While LLMs do not possess consciousness or intentionality, their ability to generate plausible text from probabilistic patterns mirrors the active role children play in constructing linguistic knowledge. The "errors" produced by both children and LLMs may not merely be flaws but essential components of a learning process striving to decode the intricate structures of language.

As we continue to advance AI technologies, these interdisciplinary connections will be crucial in fostering models that more accurately and reliably emulate human language understanding. By embracing the trial-and-error nature of both human and machine learning, we open doors to innovations that honor the complexity and beauty of language itself, bridging the gap between human and machine learning in our quest to comprehend and replicate intelligence.

(1) Tratado geral das grandezas do ínfimo (Manoel de Barros)

A poesia está guardada nas palavras — é tudo que eu sei.
Meu fado é o de não saber quase tudo.
Sobre o nada eu tenho profundidades.
Não tenho conexões com a realidade.
Poderoso para mim não é aquele que descobre ouro.
Para mim poderoso é aquele que descobre as insignificâncias (do mundo e as nossas).
Por essa pequena sentença me elogiaram de imbecil.
Fiquei emocionado.
Sou fraco para elogio.