{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/on-the-similarity-of-circuits-across","title":"On the Similarity of Circuits across Languages: a Case Study on the Subject-verb Agreement Task","arxiv_id":"2410.06496","date":"2024-10-09","proceeding":null,"authors":["Javier Ferrando","Marta R. Costa-jussà"],"abstract":"Several algorithms implemented by language models have recently been successfully reversed-engineered. However, these findings have been concentrated on specific tasks and models, leaving it unclear how universal circuits are across different settings. In this paper, we study the circuits implemented by Gemma 2B for solving the subject-verb agreement task across two different languages, English and Spanish. We discover that both circuits are highly consistent, being mainly driven by a particular attention head writing a `subject number' signal to the last residual stream, which is read by a small set of neurons in the final MLPs. Notably, this subject number signal is represented as a direction in the residual stream space, and is language-independent. We demonstrate that this direction has a causal effect on the model predictions, effectively flipping the Spanish predicted verb number by intervening with the direction found in English. Finally, we present evidence of similar behavior in other models within the Gemma 1 and Gemma 2 families.","url_abs":"https://arxiv.org/abs/2410.06496v1","url_pdf":"https://arxiv.org/pdf/2410.06496v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"on-the-similarity-of-circuits-across","repo_url":"https://github.com/javiferran/circuits_languages","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"jax","reach":{"status":"ok"}}],"tasks":[],"methods":[{"method_slug":"attention","method_name":"Attention"},{"method_slug":"set","method_name":"SET"},{"method_slug":"softmax","method_name":"Softmax"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2410.06496","atlas_url":"https://app.syntology.ai/?focus=2410.06496","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2410.06496"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/javiferran/circuits_languages","reach":{"status":"ok"}}],"summary":{"ran":3,"unverified":2},"by_repo_kind":{"official":{"samples":5,"ran":3,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":5,"samples":[{"code_sha256_prefix":"ccd417207b4aa0d4","entry":"clean_blocks_labels","repo":"javiferran/circuits_languages","repo_kind":"official","path":"utils_sva.py","file_url":"https://github.com/javiferran/circuits_languages/blob/HEAD/utils_sva.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ccd417207b4aa0d4"}},{"code_sha256_prefix":"f033f532f9df6d74","entry":"get_logit_diff","repo":"javiferran/circuits_languages","repo_kind":"official","path":"utils_sva.py","file_url":"https://github.com/javiferran/circuits_languages/blob/HEAD/utils_sva.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f033f532f9df6d74"}},{"code_sha256_prefix":"b3c861ba7a6fc559","entry":"load_sva_dataset","repo":"javiferran/circuits_languages","repo_kind":"official","path":"load_dataset.py","file_url":"https://github.com/javiferran/circuits_languages/blob/HEAD/load_dataset.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b3c861ba7a6fc559"}},{"code_sha256_prefix":"b470dce4af570c93","entry":"get_valid_spanish_verbs_nouns","repo":"javiferran/circuits_languages","repo_kind":"official","path":"load_dataset.py","file_url":"https://github.com/javiferran/circuits_languages/blob/HEAD/load_dataset.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b470dce4af570c93"}},{"code_sha256_prefix":"86a9d6d5dc9b184e","entry":"read_files","repo":"javiferran/circuits_languages","repo_kind":"official","path":"load_dataset.py","file_url":"https://github.com/javiferran/circuits_languages/blob/HEAD/load_dataset.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"86a9d6d5dc9b184e"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}