Ali Nafisi
2026
Mechanistic Interpretability of Large-Scale Counting in LLMs through a System-2 Strategy
Hosein Hasani | Mohammadali Banayeeanzade | Ali Nafisi | Sadegh Mohammadian | Fatemeh Askari | Mobin Bagherian | Amirmohammad Izadi | Mahdieh Soleymani Baghshah
Findings of the Association for Computational Linguistics: ACL 2026
Hosein Hasani | Mohammadali Banayeeanzade | Ali Nafisi | Sadegh Mohammadian | Fatemeh Askari | Mobin Bagherian | Amirmohammad Izadi | Mahdieh Soleymani Baghshah
Findings of the Association for Computational Linguistics: ACL 2026
Large language models (LLMs), despite strong performance on complex mathematical problems, exhibit systematic limitations in counting tasks. This issue arises from the architectural limits of transformers, where counting is performed across layers, leading to degraded precision for larger counting problems due to depth constraints. To address this limitation, we propose a simple test-time strategy inspired by System-2 cognitive processes that decomposes large counting tasks into smaller, independent sub-problems that the model can reliably solve. We evaluate this approach using observational and causal mediation analyses to understand the underlying mechanism of this System-2-like strategy. Our mechanistic analysis identifies key components: latent counts are computed and stored in the final item representations of each part, transferred to intermediate steps via dedicated attention heads, and aggregated in the final stage to produce the total count. Experimental results demonstrate that this strategy enables LLMs to surpass architectural limitations and achieve higher accuracy on large-scale counting tasks. This work provides mechanistic insight into System-2 counting in LLMs and presents a generalizable approach for improving and understanding their reasoning behavior.
2025
Matina: A Culturally-Aligned Persian Language Model Using Multiple LoRA Experts
Sara Bourbour Hosseinbeigi | MohammadAli SeifKashani | Javad Seraj | Fatemeh Taherinezhad | Ali Nafisi | Fatemeh Nadi | Iman Barati | Hosein Hasani | Mostafa Amiri | Mostafa Masoudi
Findings of the Association for Computational Linguistics: ACL 2025
Sara Bourbour Hosseinbeigi | MohammadAli SeifKashani | Javad Seraj | Fatemeh Taherinezhad | Ali Nafisi | Fatemeh Nadi | Iman Barati | Hosein Hasani | Mostafa Amiri | Mostafa Masoudi
Findings of the Association for Computational Linguistics: ACL 2025
Large language models (LLMs) are powerful tools for a variety of applications, but to interact effectively with users, they must align with the cultural values and linguistic nuances of their audience. However, existing LLMs often fall short in adequately modeling underrepresented languages and cultures, such as Persian, limiting their applicability and acceptance. To address this, we construct diverse, high-quality datasets specifically tailored to Persian linguistic and cultural contexts, ensuring a more authentic and context-aware training process. Using these datasets, we develop Matina, a Persian-focused multi-expert model designed to embody Iranian cultural values and linguistic structures. Matina is trained by fine-tuning LLaMA3.1 8B-Instruct models across five domains: culinary, tourism, socio-culture, translation, and summarization. These experts are combined using a classifier to create a unified multi-expert system. By leveraging culturally aligned datasets, Matina outperforms baseline models in both task performance and user satisfaction, demonstrating the importance of data-driven cultural adaptation in LLM development.