This repository contains the code and models for classifying errors injected into NLP models (such as OPUS and T5) under different precision formats (FP16 and FP32).
Cite the work in:
@ARTICLE{11145323,
author={Zhu, Jinhua and Conde, Javier and Gao, Zhen and Reviriego, Pedro and Liu, Shanshan and Lombardi, Fabrizio},
journal={IEEE Transactions on Computers},
title={Concurrent Linguistic Error Detection (CLED): A New Methodology for Error Detection in Large Language Models},
year={2025},
volume={74},
number={11},
pages={3638-3651},
keywords={Protection;Feature extraction;Machine learning;Neural networks;Linguistics;Computational modeling;Electronic mail;Transformers;Large language models;Hardware;LLMs;soft errors;concurrent error detection;T5;OPUS-MT.},
doi={10.1109/TC.2025.3603682}}
The datasets used in this project are based on CNN and IWSLT2017. They include fault-free predictions and predictions with single bit-flip fault injections.
Download the datasets from Zenodo and place them in the datasets/ directory.
The datasets/ directory should contain:
cnn_input_text.txtcnn_output_predict_fault_free.txtcnn_output_predict_single_fi_bit_100times.txtcnn_output_reference.txtiwslt2017_input_text.txtiwslt2017_output_predict_fault_free.txtiwslt2017_output_predict_single_fi_bit_100times.txtiwslt2017_output_reference.txt
The models/ directory contains Jupyter notebooks for training and evaluating the error classification models, as well as the saved model pipelines.
classificator_opus_FP16.ipynb: Classifier for OPUS model with FP16 precision.classificator_opus_FP32.ipynb: Classifier for OPUS model with FP32 precision.classificator_opus_FP16_eval_with_FP32.ipynb: Evaluation of OPUS FP16 classifier using FP32 data.classificator_t5_FP16.ipynb: Classifier for T5 model with FP16 precision.classificator_t5_FP32.ipynb: Classifier for T5 model with FP32 precision.classificator_t5_FP16_eval_with_FP32.ipynb: Evaluation of T5 FP16 classifier using FP32 data.classificator_t5Andopus_FP32.ipynb: Combined classifier for T5 and OPUS models with FP32 precision.
pipeline_opus_model.joblib: Pre-trained pipeline model for OPUS.pipeline_t5_model.joblib: Pre-trained pipeline model for T5.
datasets/: Contains the input texts and model predictions (fault-free and with injected faults).models/: Contains the Jupyter notebooks for data processing and model training, along with the saved.joblibmodels.figs/: Directory for saving generated figures and plots.backup_df_saved/: Directory for saving backup dataframes during processing.
The notebooks require several Python libraries, including:
pandasnumpynltkscikit-learnmatplotlibseabornjoblibopenpyxl
You can install the required packages using pip:
pip install pandas numpy nltk scikit-learn matplotlib seaborn joblib openpyxl- Clone the repository.
- Download the datasets from Zenodo and place them in the
datasets/folder. - Install the required dependencies.
- Open and run the Jupyter notebooks in the
models/directory to train or evaluate the classifiers.