import pandas as np: the numpy strikes back

Haotian Yang


Abstract
Python code imports numpy as np so consistently that, to a language model, the alias and the library are almost the same thing. We ask what a model does when a file breaks the convention, as in import pandas as np. Using templated minimal pairs, we score how strongly a model prefers the conventional library’s methods at the use site and compare the swapped binding with a control that binds the same library to an alias with no convention (zz). Across nine open models from 0.5B to 8B parameters, the swap shifts the preference toward the conventional library by 6.8 nats relative to the control (95% CI 4.6 to 9.1). The shift is larger for more frequent conventions, stays flat out to 8,192 tokens, and reaches generated code, where 74% of swapped completions call an attribute the bound library lacks. DeepSeek-V4-Pro makes the same mistake out to 128k tokens even though it names the bound library correctly when asked, and its thinking mode removes the error. In two Qwen2.5 models, activation patching and the logit lens show that the pull travels with the alias token at the use site. Patching the import line barely moves it.
Anthology ID:
2026.blackboxnlp-1.1
Volume:
Proceedings of the 9th BlackboxNLP Workshop: Analyzing and Interpreting Neural Networks for NLP
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Dana Arad, Yonatan Belinkov, Hanjie Chen, Nils Feldhus, Aaron Mueller, Hosein Mohebbi, Gabriele Sarti, Martin Tutek
Venues:
BlackboxNLP | WS
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
1–14
Language:
URL:
https://aclanthology.org/2026.blackboxnlp-1.1/
DOI:
Bibkey:
Cite (ACL):
Haotian Yang. 2026. import pandas as np: the numpy strikes back. In Proceedings of the 9th BlackboxNLP Workshop: Analyzing and Interpreting Neural Networks for NLP, pages 1–14, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
import pandas as np: the numpy strikes back (Yang, BlackboxNLP 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.blackboxnlp-1.1.pdf