[Paper Review] minicons: Enabling Flexible Behavioral and Representational Analyses of Transformer Language Models
minicons is an open-source Python library that provides a standard API for performing behavioral (prediction-level) and representational (activation-level) analyses of transformer language models, with case studies on BERT learning dynamics and zero-shot abductive reasoning.
We present minicons, an open source library that provides a standard API for researchers interested in conducting behavioral and representational analyses of transformer-based language models (LMs). Specifically, minicons enables researchers to apply analysis methods at two levels: (1) at the prediction level -- by providing functions to efficiently extract word/sentence level probabilities; and (2) at the representational level -- by also facilitating efficient extraction of word/phrase level vectors from one or more layers. In this paper, we describe the library and apply it to two motivating case studies: One focusing on the learning dynamics of the BERT architecture on relative grammatical judgments, and the other on benchmarking 23 different LMs on zero-shot abductive reasoning. minicons is available at https://github.com/kanishkamisra/minicons
Motivation & Objective
- Motivate and enable systematic analyses of transformer-based LMs to understand what they learn during pre-training.
- Provide a standard API for extracting word/sequence probabilities and contextualized embeddings across multiple layers.
- Demonstrate two motivating case studies to illustrate learning dynamics and zero-shot abductive reasoning.
- Position minicons as a scalable tool integrated with the Hugging Face ecosystem to broaden access to BlackboxNLP analyses.
Proposed method
- Two core modules with batch-enabled analysis workflows: scorer for prediction-level analyses and cwe for representational analyses.
- scorer supports both MaskedLMScorer and IncrementalLMScorer to extract token-, sequence-, or partially conditioned-probabilities and derive metrics like log-probabilities, surprisals, and word/rank information.
- cwe.extract_representation() provides contextualized embeddings from single or multiple layers, with options to reduce sub-word representations and to obtain phrase or sentence embeddings.
- Analyses can be run end-to-end on pre-trained models without fine-tuning, leveraging batched computation on CPU or GPU.
- Library integrates with Transformers and Hugging Face Model Hub to enable large-scale benchmarking.
- Case-study methods include tracking learning dynamics of linguistic phenomena in BERT variants and evaluating abductive reasoning in multiple LMs using partial-score calculations.
Experimental results
Research questions
- RQ1How do transformer LMs learn linguistic phenomena during pre-training as observed through prediction-based analyses?
- RQ2To what extent do pre-trained LMs exhibit abductive reasoning capabilities in a zero-shot setting as measured by sequence probabilities?
- RQ3Can a standard API facilitate scalable, reproducible behavioral and representational analyses across diverse models and datasets?
Key findings
- Learning dynamics show convergence of MultiBERTs toward a reference BERT-base model across many linguistic phenomena, with varying rates of acquisition.
- Certain phenomena (e.g., number/gender agreement) are learned earlier, while others (e.g., island effects) are learned more slowly.
- Unsupervised abductive reasoning results indicate most models perform near or at chance, with some models approaching state-of-the-art levels only through fine-tuning or explicit knowledge integration.
- ALBERT-xxlarge-v2 achieves relatively strong abductive reasoning performance in zero-shot settings despite being parameter-efficient.
- Results suggest scaling alone is unlikely to achieve major gains in zero-shot abductive reasoning; improvements likely require architecture/knowledge-enhanced strategies.
- minicons enables replication and extension of such analyses by providing standardized, efficient extraction of probabilities and contextual embeddings.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.