LLM-MRI Python module: a brain scanner for LLMs - Costa, Luiz; Figênio, Mateus; Santanchè, André; Gomes-Jr, Luiz (Anais Estendidos do Simpósio Brasileiro de Banco de Dados (SBBD); 2024: Anais Estendidos do XXXIX Simpósio Brasileiro de Bancos de Dados, 2024)
LLMs (Large Language Models) have demonstrated human-level language and knowledge acquisition skills in several tasks. However, despite the recent success and broad use, understanding how these skills are learned and encoded inside the underlying neural network is still challenging. The goal of the LLM-MRI package is to simplify the study of activation patterns in any transformer-based LLM, similarly to how MRI (magnetic resonance imaging) simplifies with biological brains. The package, written for the Python language, allows the mapping of neural regions using a parameterized reduction of the model's dimensionality. Neural regions can be visualized according to the forward-pass activations stimulated by a set of documents. Similarly, the package enables the creation of graph models representing the interlayer network of connections stimulated by a set of documents. These features allow for qualitative and quantitative assessments of the underlying structure of activations, depending on the type of documents that the LLM model is exposed to.