1. Abstract
This project investigates the classification of cognitive reading states—specifically, Normal Reading (NR) versus Task-Specific Reading (TSR)—using natural language processing and machine learning techniques on the ZuCo dataset. The core objective was to determine if linguistic features of a text could serve as effective predictors of the cognitive intent of a reader. I implemented a comparative analysis framework, evaluating two distinct feature engineering strategies. The first approach utilized pre-trained sentence embeddings to capture semantic context, while the second involved engineering a comprehensive set of discrete linguistic features, including lexical, readability, and syntactic complexity metrics derived using spaCy and textstat. Initial experiments with models like RandomForest and SVM revealed that both feature sets held predictive power, with a RandomForest model using enhanced discrete features achieving a top F1-score of 0.745 for the TSR class. To further improve performance, I developed an advanced methodology involving the fine-tuning of a BERT transformer model to generate task-specific embeddings. These specialized embeddings were then concatenated with the discrete features and used to train a Multi-Layer Perceptron (MLP). This hybrid approach yielded a significant performance increase, achieving a final F1-score of 0.947, demonstrating the synergistic value of combining deep semantic representations with explicit linguistic markers for cognitive state classification.
2. Introduction & Problem Statement
In the intersection of cognitive science and computational linguistics, researchers often employ physiological signals like electroencephalography (EEG) and eye-tracking to study the cognitive processes underlying human reading. While these methods provide direct insights, they can be intrusive, expensive, and require specialized laboratory environments. This project addresses a fundamental question arising from this challenge: can the linguistic properties of a text itself serve as a reliable proxy for the reader’s cognitive state? The primary motivation is to develop a computational model capable of distinguishing between two distinct reading intentions—Normal Reading (NR) for general comprehension and Task-Specific Reading (TSR) for locating specific information—based solely on the textual data.
The potential applications for such a model are significant. In educational technology, it could enable adaptive learning platforms to tailor content delivery based on a student’s inferred reading pattern. In user experience research, it could inform the design of more effective and less cognitively demanding information systems. For this investigation, I utilized the ZuCo Dataset, a rich resource that pairs natural sentences with corresponding EEG and eye-tracking data. However, my approach deliberately excluded the physiological signals, focusing exclusively on the textual sentences labeled with their associated reading condition (NR or TSR).
The project was structured around the following core objectives:
- To process and structure the sentence data from the ZuCo dataset, creating a clean and balanced corpus for binary classification.
- To engineer and compare two divergent feature sets: (a) dense semantic vector representations from a pre-trained language model and (b) a wide array of discrete, interpretable linguistic features.
- To systematically train and evaluate a suite of classical machine learning classifiers to establish baseline performances for each feature engineering strategy.
- To implement an advanced deep learning approach by fine-tuning a BERT transformer model on the specific task, thereby creating domain-specialized sentence embeddings.
- To develop and evaluate a final hybrid model that fuses the fine-tuned embeddings with the engineered linguistic features to achieve state-of-the-art performance on this classification task.
3. Methodology & Technical Approach
My methodology followed a structured progression from data preprocessing and feature engineering to model evaluation and advanced architectural enhancement.
Data Preprocessing and Structuring The initial phase involved parsing and consolidating sentence data from the ZuCo dataset, which was provided in separate CSV files for the NR and TSR conditions. A key preprocessing step was the rigorous handling of duplicate and overlapping data. I identified unique sentences for each condition and, critically, removed any sentences that were common to both lists. This step was essential to prevent data leakage and ensure that the model would learn from linguistic patterns genuinely distinctive to each cognitive state, rather than memorizing shared examples. The raw text was normalized by converting it to lowercase and removing extraneous whitespace. After this cleaning and deduplication process, the final dataset consisted of 635 unique sentences, which were then numerically encoded for classification (NR: 0, TSR: 1).

Figure 1: Character - Word Length DistrbutionFeature Engineering Strategies I implemented two parallel feature engineering pipelines to explore different facets of the text.
- Strategy A: Sentence Embeddings To capture the semantic meaning and contextual information of each sentence, I used the
sentence-transformerslibrary to generate dense vector embeddings. I selected theall-MiniLM-L6-v2model, a high-performance and computationally efficient transformer, to convert each sentence into a 384-dimensional vector. This approach represents the text in a rich, continuous semantic space, allowing models to identify subtle differences in meaning and intent. - Strategy B: Discrete Linguistic Features This strategy focused on creating a set of explicit, interpretable features that quantify various aspects of linguistic complexity. This was further divided into two tiers:
- Base Features: I first extracted fundamental text statistics, including character and word counts. Using the
textstatlibrary, I computed established readability scores such as Flesch Reading Ease, Flesch-Kincaid Grade Level, and the Gunning Fog Index. Lexical diversity was measured using the Type-Token Ratio (TTR). - Enhanced Syntactic Features: To add syntactic depth, I employed the
spaCylibrary to perform dependency parsing and Part-of-Speech (POS) tagging. From the parsed output, I engineered features such as the counts of key POS tags (verbs, nouns, adjectives, adverbs), the number of subordinate clauses (proxied by counting marking prepositions like ‘if’, ‘while’), and the average dependency distance between words, which serves as a proxy for syntactic complexity.
- Base Features: I first extracted fundamental text statistics, including character and word counts. Using the
Modeling and Advanced Architecture The evaluation framework was designed in two stages to systematically assess performance.
- Baseline Model Evaluation: I trained and evaluated a suite of six classical machine learning classifiers from
scikit-learnandLightGBM: Logistic Regression, Decision Tree, RandomForest, SVM, LightGBM, and a Multi-Layer Perceptron (MLP). Each classifier was tested on three distinct feature sets: (1) Sentence Embeddings alone, (2) Scaled Base Discrete Features, and (3) Scaled Enhanced (Syntactic) Discrete Features. For models sensitive to feature scale (like SVM and MLP), I appliedStandardScaler. - Advanced Model: Fine-Tuned BERT and Hybrid MLP: Recognizing the limitations of pre-trained embeddings, I implemented a more sophisticated approach. Using the
transformersandtorchlibraries, I fine-tuned abert-base-uncasedmodel directly on the NR/TSR classification task. To ensure robustness, this process was conducted within a 5-fold Stratified Cross-Validation loop. I then used the best-performing fine-tuned BERT model from the cross-validation to extract new, task-specific 768-dimensional embeddings for all sentences. Finally, these powerful embeddings were concatenated with the scaled enhanced discrete feature set. This combined, hybrid feature vector was used to train a final MLP, which included BatchNorm and Dropout layers for regularization, to achieve the highest possible classification accuracy.
# Conceptual snippet for creating the final hybrid feature set
scaler = StandardScaler()
scaled_enhanced_features = scaler.fit_transform(df_enhanced_discrete_features)
# Concatenate fine-tuned embeddings with scaled discrete features
combined_features = np.concatenate(
(fine_tuned_embeddings_array, scaled_enhanced_features), axis=1
)
4. Results & Evaluation
The primary metric for model evaluation was the F1-score for the TSR class (label 1), as accurately identifying the task-oriented reading state was considered the more challenging and valuable objective. This was supplemented by overall accuracy and macro F1-score for a comprehensive view of performance.
Initial Model Comparison The first round of experiments revealed clear patterns. The RandomForest classifier trained on the Enhanced Discrete Features (including syntactic information from spaCy) emerged as the top performer among the baseline models, achieving a TSR F1-score of 0.745. Closely following was the SVM trained on Sentence Embeddings, with a TSR F1-score of 0.723. These results indicated that both engineered syntactic features and deep semantic representations contained strong, albeit different, predictive signals. The discrete features, particularly the enhanced set, provided a slight edge in this initial stage, highlighting the importance of explicit structural information.

Figure 2: Chart of F1-Scores for Initial ModelsAdvanced Hybrid Model Performance The two-stage advanced methodology yielded a substantial improvement in performance.
- BERT Fine-Tuning: The 5-fold cross-validation of the
bert-base-uncasedmodel yielded a mean TSR F1-score of 0.743, demonstrating a robust baseline from the fine-tuning process itself. - Final MLP with Combined Features: The final test was conducted on the advanced MLP, which was trained on the hybrid feature set combining embeddings from the best fine-tuned BERT model and the scaled enhanced discrete features. This model produced the project’s best results, achieving a TSR F1-score of 0.947, an overall accuracy of 94.5%, and a macro F1-score of 0.945.

Figure 3: Final Model Performance SummaryThe dramatic increase in performance from ~0.75 to ~0.95 F1-score underscores the power of this hybrid approach. It validates the hypothesis that combining domain-adapted semantic representations with a rich set of explicit linguistic and syntactic features allows the model to capture a more complete and discriminative signal than either feature set can provide alone.
5. Challenges & Learnings
- Challenge: Data Preparation and Scarcity: A significant initial challenge was cleaning the dataset. The presence of sentences that appeared in both NR and TSR conditions required a careful deduplication strategy to prevent the model from learning spurious correlations. This process resulted in a relatively small final dataset of 635 sentences, which heightened the risk of overfitting and made robust evaluation techniques like cross-validation essential.
- Challenge: Computationally Intensive Feature Engineering: While the experimental feature generated using a local LLM (
Ollama) was conceptually promising, it proved to be computationally prohibitive for the entire dataset. This highlighted a practical trade-off between feature sophistication and the resources required for implementation. Similarly, fine-tuning the BERT model required a GPU environment (facilitated by Google Colab) and careful management of the training pipeline. - Key Learning 1: The Power of Fine-Tuning: This project was a clear demonstration of transfer learning’s value. While off-the-shelf embeddings from
all-MiniLM-L6-v2provided a strong baseline, fine-tuning a BERT model on the specific NR/TSR classification task created embeddings that were significantly more attuned to the nuances of the domain, forming the foundation of the final model’s success. - Key Learning 2: The Synergy of Hybrid Features: A crucial takeaway was that engineered linguistic features are not obsolete in the age of large language models. The final MLP’s superior performance was not due to embeddings alone, but to their combination with discrete features measuring readability, lexical diversity, and syntactic structure. This suggests that providing explicit, interpretable linguistic signals can complement the implicit knowledge learned by transformers, leading to more robust and accurate models.
6. Limitations & Ethical Considerations
Limitations
- Generalizability: The model was trained exclusively on text from the ZuCo dataset. Its performance may not generalize to texts from different genres, topics, or linguistic styles without further training.
- Dataset Size: The final dataset of 635 sentences is small for deep learning standards. A larger and more varied dataset would be necessary to build a truly robust and widely applicable model.
- Proxy vs. Direct Measurement: It is critical to acknowledge that this model predicts a textual correlate of a cognitive state, not the cognitive state itself. The classification is based on the properties of the text associated with a particular reading task in an experimental setting. The same text could be read with different intentions by different individuals in a different context.
Ethical Considerations
- Cognitive Privacy: If deployed, such a model could infer a user’s intent or cognitive state from their reading behavior. This raises privacy concerns, as a user’s focus and comprehension patterns could be monitored. Any application using this technology would require user consent and a high degree of transparency.
- Potential for Misuse: Technology that infers cognitive states could be used for manipulative purposes, such as dynamically altering content to exploit a reader’s perceived lack of focus or to optimize for persuasion over comprehension.
- Bias: The model reflects the linguistic properties of its training data. It could exhibit biases and perform less accurately on texts written by or for underrepresented demographic or linguistic groups.
7. Conclusion & Future Work
This project successfully developed a machine learning pipeline to classify cognitive reading states from text with high accuracy. The key finding is the superior performance of a hybrid model that combines task-specific embeddings from a fine-tuned BERT transformer with a rich set of engineered linguistic features. The final MLP classifier achieved an F1-score of 0.947 for the TSR class, demonstrating that a fusion of deep semantic understanding and explicit syntactic analysis provides a powerful signal for this task.
For future work, several promising directions exist:
- Multi-Modal Integration: The most direct extension would be to incorporate the physiological data (EEG and eye-tracking) from the ZuCo dataset, creating a multi-modal model that learns from both textual and cognitive signals.
- Larger Datasets: Testing and further training the model on larger and more diverse text corpora would be crucial for improving its generalizability.
- Advanced Architectures: Experimenting with more advanced transformer models (like RoBERTa or DeBERTa) and exploring attention mechanisms within the MLP to weigh the importance of different features could yield further performance gains.
8. Technologies Stack
- Data Analysis and Manipulation: Pandas, NumPy
- Machine Learning: Scikit-learn (LogisticRegression, DecisionTreeClassifier, RandomForestClassifier, SVC, MLPClassifier), LightGBM
- Deep Learning & NLP: PyTorch, Hugging Face Transformers (BERT), Sentence-Transformers, spaCy, NLTK, Textstat
- Visualization: Matplotlib, Seaborn
- Core Language: Python 3
9. References
- Hollenstein, N., et al. (2020). ZuCo 2.0: A Dataset of Physiological Recordings During Natural Reading and Annotation. Proceedings of the 12th Language Resources and Evaluation Conference.
- Devlin, J., Chang, M. W., Lee, K., & Toutanova, K. (2019). BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics.
- Reimers, N., & Gurevych, I. (2019). Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks. Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing.