ChatPaper.aiChatPaper

Hoe programmeerconcepten en neuronen worden gedeeld in codelanguagemodellen

How Programming Concepts and Neurons Are Shared in Code Language Models

June 1, 2025
Auteurs: Amir Hossein Kargaran, Yihong Liu, François Yvon, Hinrich Schütze
cs.AI

Samenvatting

Verschillende studies hebben de mechanismen van grote taalmodellen (LLMs) onderzocht bij coderings taken, maar de meeste hebben zich gericht op programmeertalen (PLs) in een eentalige omgeving. In dit artikel onderzoeken we de relatie tussen meerdere PLs en Engels in de conceptruimte van LLMs. We voeren een few-shot vertaaltaak uit op 21 PL-paren met behulp van twee Llama-gebaseerde modellen. Door de embeddings van tussenliggende lagen tijdens deze taak te decoderen, observeren we dat de conceptruimte dichter bij Engels ligt (inclusief PL-sleutelwoorden) en hoge waarschijnlijkheden toekent aan Engelse tokens in de tweede helft van de tussenliggende lagen. We analyseren neuronactivaties voor 11 PLs en Engels, waarbij we vaststellen dat hoewel taal-specifieke neuronen voornamelijk geconcentreerd zijn in de onderste lagen, die exclusief voor elke PL de neiging hebben om in de bovenste lagen te verschijnen. Voor PLs die sterk zijn afgestemd op meerdere andere PLs, is het identificeren van taal-specifieke neuronen niet haalbaar. Deze PLs hebben ook de neiging om een grotere set sleutelwoorden te hebben dan andere PLs en liggen dichter bij de conceptruimte van het model, ongeacht de invoer/uitvoer-PL in de vertaaltaak. Onze bevindingen bieden inzicht in hoe LLMs intern PLs representeren, waarbij structurele patronen in de conceptruimte van het model worden onthuld. Code is beschikbaar op https://github.com/cisnlp/code-specific-neurons.
English
Several studies have explored the mechanisms of large language models (LLMs) in coding tasks, but most have focused on programming languages (PLs) in a monolingual setting. In this paper, we investigate the relationship between multiple PLs and English in the concept space of LLMs. We perform a few-shot translation task on 21 PL pairs using two Llama-based models. By decoding the embeddings of intermediate layers during this task, we observe that the concept space is closer to English (including PL keywords) and assigns high probabilities to English tokens in the second half of the intermediate layers. We analyze neuron activations for 11 PLs and English, finding that while language-specific neurons are primarily concentrated in the bottom layers, those exclusive to each PL tend to appear in the top layers. For PLs that are highly aligned with multiple other PLs, identifying language-specific neurons is not feasible. These PLs also tend to have a larger keyword set than other PLs and are closer to the model's concept space regardless of the input/output PL in the translation task. Our findings provide insights into how LLMs internally represent PLs, revealing structural patterns in the model's concept space. Code is available at https://github.com/cisnlp/code-specific-neurons.
PDF32June 3, 2025