Tesi etd-06162025-195900 |
Link copiato negli appunti
Tipo di tesi
Tesi di laurea magistrale
Autore
CUSANO, CLAUDIA
URN
etd-06162025-195900
Titolo
Eye-tracking e modelli linguistici neurali: il contributo di surprisal e cosine similarity nel confronto tra Baby e Large Language Model
Dipartimento
FILOLOGIA, LETTERATURA E LINGUISTICA
Corso di studi
INFORMATICA UMANISTICA
Relatori
relatore Prof. Lenci, Alessandro
relatore Dott. Capone, Luca
relatore Dott. Capone, Luca
Parole chiave
- baby language model
- cosine similarity
- eye-tracking
- large language model
- surprisal
Data inizio appello
04/07/2025
Consultabilità
Completa
Riassunto
Nel campo della linguistica computazionale, si è consolidata l’ipotesi che i modelli di linguaggio neurali siano in grado di fornire predittori utili per spiegare la variabilità nei tempi di lettura umana. Il presente lavoro si propone di valutare in che misura due metriche la surprisal, una misura della probabilità di una parola di occorrere in un determinato contesto e il coseno di similarità tra vettori di embedding, un valore che indica la similarità fra elementi testuali rappresentati dal modello — siano in grado di predire l’andamento di queste misure comportamentali durante la lettura in inglese (L1). Due ipotesi principali guidano lo studio: da un lato, si prevede che gli effetti lineari robusti della surprisal e della similarità semantica emergano come predittori significativi dei tempi di lettura, in linea con quanto riportato in letteratura; dall’altro, si esplora se — e in che misura — il valore predittivo di tali metriche vari in funzione dell’architettura e dell’addestramento del modello.
In particolare, l’attenzione è rivolta alle differenze comportamentali tra modelli autoregressivi e bidirezionali, nonché tra modelli Baby (addestrati con su quantità di dati limitate e in condizioni più cognitivamente plausibili) e modelli di grandi dimensioni (Large Language Models). Sono state selezionati quattro LM: due modelli small-scale (di piccole dimensioni) — LTG-BERT e Concrete-GPT, un modello di tipo decoder addestrato con un approccio di curriculum learning — e due modelli large-scale (di grandi dimensioni) già ben affermati: RoBERTa e GPT-XL.
Su ciascuna di queste architetture sono stati costruiti dei modelli misti a effetti casuali (modelli lineari misti) per prevedere tre misure legate ai tempi di lettura: la durata della prima fissazione (first fixation duration) (FFD), il tempo totale di lettura total reading time (TRT) , il numero di fissazioni (number of fixations) (NF). Per ogni modello linguistico e per ognuna di queste misure, sono state testate quattro configurazioni predittive: un modello di base con solo variabili linguistiche note per influenzare i tempi di lettura; (i) la baseline (BL) che integra solo proprietà lessicali, (ii) un modello che aggiunge la cosine similarity (BL+COS); (iii) che integra la surprisal (BL+SUR), (iv) infine uno che include sia cosine similarity che surprisal (BL+COS+SUR).
I risultati ottenuti mostrano che l’aggiunta delle metriche computazionali di surprisal e cosine similarity migliora significativamente la predizione delle misure oculometriche, rispetto ai modelli di baseline che includono esclusivamente variabili linguistiche note per influenzare i tempi di lettura (quali la lunghezza e la frequenza della parola, o il salto della parola precedente). Il miglioramento più consistente — osservato su tutte le variabili dipendenti (First Fixation Duration, Total Reading Time e Number of Fixations) — si registra nei modelli che integrano entrambe le metriche, ovvero la configurazione BL+COS+SUR.
Un’ulteriore riflessione emerge dal confronto tra modelli encoder-based e decoder-based. Solo i modelli basati su architettura decoder (GPT-XL e ConcreteGPT) mostrano in modo sistematico e coerente coefficienti negativi per la cosine similarity, in linea con l’ipotesi teorica secondo cui parole semanticamente più attese in un contesto linguistico tendono a ridurre i tempi di elaborazione.
Tra i modelli analizzati, GPT-XL si distingue come il più performante, riuscendo a catturare in modo sistematico gli effetti della surprisal e della similarità semantica in accordo con le aspettative teoriche. Tuttavia, è particolarmente interessante osservare come anche ConcreteGPT — nonostante sia stato addestrato su un volume di dati significativamente inferiore e qualitativamente differente — risulti sorprendentemente competitivo. Questo risultato suggerisce che strategie di addestramento ispirate all’apprendimento umano, come il curriculum learning, possano incidere positivamente sulla capacità dei modelli di generalizzare e di aderire ai dati comportamentali.
In modo analogo, anche il modello baby LTG BERT si è dimostrato efficace nel cogliere l’effetto del surprisal, ottenendo prestazioni che, nella maggior parte dei casi, superano quelle del più grande RoBERTa. Il modello riesce infatti a riflettere l’incremento nei tempi di lettura associato a parole meno probabili (effetto surprisal).
Infine, l’analisi comparativa tra le versioni “full” e “minus” dei modelli — ossia versioni da cui è stata rimossa una delle due metriche computazionali — ha evidenziato che l’eliminazione del surprisal comporta una perdita di performance più marcata rispetto all’eliminazione della cosine similarity, in particolare nei modelli autoregressivi. Questo risultato suggerisce che, pur riconoscendo l’importanza della coerenza semantica, è la difficoltà predittiva (ovvero quanto una parola sia inaspettata) a giocare un ruolo più centrale nel determinare i tempi di lettura. Tali evidenze si pongono in linea con la letteratura psicolinguistica e supportano l’ipotesi che i lettori formulino anticipazioni probabilistiche sulle parole successive, basandosi sulla distribuzione statistica del linguaggio.
In the field of computational linguistics, it is now a widely held view that neural language models can provide useful predictors for explaining variability in human reading times. This study aims to evaluate the extent to which two computational metrics — surprisal, a measure of how likely a word is to occur in a given context, and cosine similarity between embedding vectors, which reflects the semantic similarity between textual elements as represented by the model — can predict behavioral patterns during reading in English (L1).
Two main hypotheses guide the investigation: on one hand, we expect robust linear effects of surprisal and semantic similarity to emerge as significant predictors of reading times, in line with previous literature; on the other, we explore whether — and to what extent — the predictive value of these metrics varies as a function of model architecture and training strategy.
In particular, the analysis focuses on differences in behavior between autoregressive and bidirectional models, as well as between Baby-scale models (trained on limited data under more cognitively plausible conditions) and large-scale language models (LLMs). Four models were selected: two small-scale models — LTG-BERT and ConcreteGPT, a decoder-based model trained using a curriculum learning approach — and two large-scale models: RoBERTa and GPT-XL.
For each of these architectures, linear mixed-effects models were built to predict three oculometric measures related to reading times: first fixation duration (FFD), total reading time (TRT), and number of fixations (NF). For each language model and each dependent variable, four predictive configurations were tested:
(i) a baseline model (BL) including only lexical variables known to influence reading times;
(ii) a model adding cosine similarity (BL+COS);
(iii) one including surprisal (BL+SUR);
(iv) and finally, one combining both metrics (BL+COS+SUR).
The results show that the inclusion of computational metrics — surprisal and cosine similarity — significantly improves the prediction of eye-tracking measures compared to baseline models that include only well-known linguistic predictors (such as word length, word frequency, and whether the previous word was skipped). The most consistent improvement — observed across all dependent variables (FFD, TRT, and NF) — occurs in models that integrate both metrics, namely the BL+COS+SUR configuration.
A further insight emerges from the comparison between encoder-based and decoder-based models. Only the decoder-based models (GPT-XL and ConcreteGPT) systematically show negative coefficients for cosine similarity, in line with the theoretical expectation that more semantically expected words tend to reduce processing times.
Among all models analyzed, GPT-XL stands out as the top performer, consistently capturing both surprisal and semantic similarity effects in accordance with theoretical predictions. However, it is particularly noteworthy that ConcreteGPT — despite being trained on a significantly smaller and qualitatively different dataset — proves to be surprisingly competitive. This result suggests that training strategies inspired by human learning, such as curriculum learning, may enhance a model's ability to generalize and align with behavioral data.
Similarly, baby LTG-BERT also demonstrated strong sensitivity to surprisal effects, often outperforming the larger RoBERTa model. Notably, it was able to reflect the expected increase in reading times for less predictable words (surprisal effect).
Finally, a comparative analysis between the “full” and “minus” versions of the models — i.e., versions from which one of the two computational metrics was removed — revealed that removing surprisal resulted in a greater performance drop than removing cosine similarity, especially in autoregressive models. This finding suggests that while semantic coherence plays an important role, predictive difficulty (i.e., how unexpected a word is) is more central in determining reading times. These results align with psycholinguistic literature and support the hypothesis that readers anticipate upcoming words based on the statistical distribution of language.
In particolare, l’attenzione è rivolta alle differenze comportamentali tra modelli autoregressivi e bidirezionali, nonché tra modelli Baby (addestrati con su quantità di dati limitate e in condizioni più cognitivamente plausibili) e modelli di grandi dimensioni (Large Language Models). Sono state selezionati quattro LM: due modelli small-scale (di piccole dimensioni) — LTG-BERT e Concrete-GPT, un modello di tipo decoder addestrato con un approccio di curriculum learning — e due modelli large-scale (di grandi dimensioni) già ben affermati: RoBERTa e GPT-XL.
Su ciascuna di queste architetture sono stati costruiti dei modelli misti a effetti casuali (modelli lineari misti) per prevedere tre misure legate ai tempi di lettura: la durata della prima fissazione (first fixation duration) (FFD), il tempo totale di lettura total reading time (TRT) , il numero di fissazioni (number of fixations) (NF). Per ogni modello linguistico e per ognuna di queste misure, sono state testate quattro configurazioni predittive: un modello di base con solo variabili linguistiche note per influenzare i tempi di lettura; (i) la baseline (BL) che integra solo proprietà lessicali, (ii) un modello che aggiunge la cosine similarity (BL+COS); (iii) che integra la surprisal (BL+SUR), (iv) infine uno che include sia cosine similarity che surprisal (BL+COS+SUR).
I risultati ottenuti mostrano che l’aggiunta delle metriche computazionali di surprisal e cosine similarity migliora significativamente la predizione delle misure oculometriche, rispetto ai modelli di baseline che includono esclusivamente variabili linguistiche note per influenzare i tempi di lettura (quali la lunghezza e la frequenza della parola, o il salto della parola precedente). Il miglioramento più consistente — osservato su tutte le variabili dipendenti (First Fixation Duration, Total Reading Time e Number of Fixations) — si registra nei modelli che integrano entrambe le metriche, ovvero la configurazione BL+COS+SUR.
Un’ulteriore riflessione emerge dal confronto tra modelli encoder-based e decoder-based. Solo i modelli basati su architettura decoder (GPT-XL e ConcreteGPT) mostrano in modo sistematico e coerente coefficienti negativi per la cosine similarity, in linea con l’ipotesi teorica secondo cui parole semanticamente più attese in un contesto linguistico tendono a ridurre i tempi di elaborazione.
Tra i modelli analizzati, GPT-XL si distingue come il più performante, riuscendo a catturare in modo sistematico gli effetti della surprisal e della similarità semantica in accordo con le aspettative teoriche. Tuttavia, è particolarmente interessante osservare come anche ConcreteGPT — nonostante sia stato addestrato su un volume di dati significativamente inferiore e qualitativamente differente — risulti sorprendentemente competitivo. Questo risultato suggerisce che strategie di addestramento ispirate all’apprendimento umano, come il curriculum learning, possano incidere positivamente sulla capacità dei modelli di generalizzare e di aderire ai dati comportamentali.
In modo analogo, anche il modello baby LTG BERT si è dimostrato efficace nel cogliere l’effetto del surprisal, ottenendo prestazioni che, nella maggior parte dei casi, superano quelle del più grande RoBERTa. Il modello riesce infatti a riflettere l’incremento nei tempi di lettura associato a parole meno probabili (effetto surprisal).
Infine, l’analisi comparativa tra le versioni “full” e “minus” dei modelli — ossia versioni da cui è stata rimossa una delle due metriche computazionali — ha evidenziato che l’eliminazione del surprisal comporta una perdita di performance più marcata rispetto all’eliminazione della cosine similarity, in particolare nei modelli autoregressivi. Questo risultato suggerisce che, pur riconoscendo l’importanza della coerenza semantica, è la difficoltà predittiva (ovvero quanto una parola sia inaspettata) a giocare un ruolo più centrale nel determinare i tempi di lettura. Tali evidenze si pongono in linea con la letteratura psicolinguistica e supportano l’ipotesi che i lettori formulino anticipazioni probabilistiche sulle parole successive, basandosi sulla distribuzione statistica del linguaggio.
In the field of computational linguistics, it is now a widely held view that neural language models can provide useful predictors for explaining variability in human reading times. This study aims to evaluate the extent to which two computational metrics — surprisal, a measure of how likely a word is to occur in a given context, and cosine similarity between embedding vectors, which reflects the semantic similarity between textual elements as represented by the model — can predict behavioral patterns during reading in English (L1).
Two main hypotheses guide the investigation: on one hand, we expect robust linear effects of surprisal and semantic similarity to emerge as significant predictors of reading times, in line with previous literature; on the other, we explore whether — and to what extent — the predictive value of these metrics varies as a function of model architecture and training strategy.
In particular, the analysis focuses on differences in behavior between autoregressive and bidirectional models, as well as between Baby-scale models (trained on limited data under more cognitively plausible conditions) and large-scale language models (LLMs). Four models were selected: two small-scale models — LTG-BERT and ConcreteGPT, a decoder-based model trained using a curriculum learning approach — and two large-scale models: RoBERTa and GPT-XL.
For each of these architectures, linear mixed-effects models were built to predict three oculometric measures related to reading times: first fixation duration (FFD), total reading time (TRT), and number of fixations (NF). For each language model and each dependent variable, four predictive configurations were tested:
(i) a baseline model (BL) including only lexical variables known to influence reading times;
(ii) a model adding cosine similarity (BL+COS);
(iii) one including surprisal (BL+SUR);
(iv) and finally, one combining both metrics (BL+COS+SUR).
The results show that the inclusion of computational metrics — surprisal and cosine similarity — significantly improves the prediction of eye-tracking measures compared to baseline models that include only well-known linguistic predictors (such as word length, word frequency, and whether the previous word was skipped). The most consistent improvement — observed across all dependent variables (FFD, TRT, and NF) — occurs in models that integrate both metrics, namely the BL+COS+SUR configuration.
A further insight emerges from the comparison between encoder-based and decoder-based models. Only the decoder-based models (GPT-XL and ConcreteGPT) systematically show negative coefficients for cosine similarity, in line with the theoretical expectation that more semantically expected words tend to reduce processing times.
Among all models analyzed, GPT-XL stands out as the top performer, consistently capturing both surprisal and semantic similarity effects in accordance with theoretical predictions. However, it is particularly noteworthy that ConcreteGPT — despite being trained on a significantly smaller and qualitatively different dataset — proves to be surprisingly competitive. This result suggests that training strategies inspired by human learning, such as curriculum learning, may enhance a model's ability to generalize and align with behavioral data.
Similarly, baby LTG-BERT also demonstrated strong sensitivity to surprisal effects, often outperforming the larger RoBERTa model. Notably, it was able to reflect the expected increase in reading times for less predictable words (surprisal effect).
Finally, a comparative analysis between the “full” and “minus” versions of the models — i.e., versions from which one of the two computational metrics was removed — revealed that removing surprisal resulted in a greater performance drop than removing cosine similarity, especially in autoregressive models. This finding suggests that while semantic coherence plays an important role, predictive difficulty (i.e., how unexpected a word is) is more central in determining reading times. These results align with psycholinguistic literature and support the hypothesis that readers anticipate upcoming words based on the statistical distribution of language.
File
Nome file | Dimensione |
---|---|
Tesi_Mag...usano.pdf | 1.36 Mb |
Contatta l’autore |