SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2021.acl-long.48 · ACL · 2021

COSY: COunterfactual SYntax for Cross-Lingual Understanding

Jing Jiang, Qianru Sun, Hao Zhang, Yulei Niu, Sicheng Yu

Open in the Atlas

Code that ran

8 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 1 violated it and 1 has no contract verdict; 5 failures of our instrument; 0 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-24; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2021.acl-long.48.json · badge: /api/ran/2021.acl-long.48.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
PluviophileYU/COSY canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
to_list Ran
ran; our contract draft was wrong, not the code
PluviophileYU/COSY/XQA/src/train_eval.py
pointer only (licence: MIT); the stored copy get_code serves, from AI-secure/InfoBERT, is pointer only (licence: NONE) · get_code("9df40357afea56cc")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from AI-secure/InfoBERT, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

exact_match_score Ran
ran, violated the contract we drafted
PluviophileYU/COSY/XQA/src/evaluate_v1_1.py
code served (permissive licence) · get_code("f6c275d6a18330a9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import string
import re

def normalize_answer(s):
    """Lower text and remove punctuation, articles and extra whitespace."""

    def remove_articles(text):
        return re.sub('\\b(a|an|the)\\b', ' ', text)

    def white_space_fix(text):
        return ' '.join(text.split())

    def remove_punc(text):
        exclude = set(string.punctuation)
        return ''.join((ch for ch in text if ch not in exclude))

    def lower(text):
        return text.lower()
    return white_space_fix(remove_articles(remove_punc(lower(s))))

def exact_match_score(prediction, ground_truth):
    return normalize_answer(prediction) == normalize_answer(ground_truth)

ARGS = {
    "prediction": "The quick brown fox jumps over the lazy dog.",
    "ground_truth": "the quick brown fox jumps over the lazy dog"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
f1_score Ran
ran, honoured the contract we drafted
PluviophileYU/COSY/XQA/src/evaluate_v1_1.py
code served (permissive licence) · get_code("2112c433b9c6d343")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

ARGS = {
    "prediction": "The quick brown fox jumps over the lazy dog.",
    "ground_truth": "A quick brown fox jumped over a lazy dog"
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_clean_doc Ran
ran on a synthesized input
PluviophileYU/COSY/XQA/src/utils.py
code served (permissive licence) · get_code("1bb5c85b2e93ee07")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

# Analyze the function: get_clean_doc takes a 'doc' parameter
# The function iterates over doc with enumerate, treating each element as a word (string)
# It checks if word.startswith('##'), so each element must be a string
# The function builds a list of (word, count) tuples where count is an integer

# Create a sample document as a list of strings
# Simulating BERT-style tokenization with subword tokens (## prefix indicates continuation)
doc = [
    "hello",      # word 1
    "##world",    # continuation of "hello"
    "##!",        # continuation
    "this",       # word 2
    "is",         # word 3
    "##a",        # continuation of "is"
    "test"        # word 4
]

ARGS = {
    "doc": doc
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
mixed_segmentation Ran
ran; our contract draft was wrong, not the code
PluviophileYU/COSY/XQA/src/mlqa_evaluation_v1.py
pointer only (licence: MIT); the stored copy get_code serves, from facebookresearch/MLQA, is pointer only (licence: NOASSERTION) · get_code("b6a95b947b35a4d6")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from facebookresearch/MLQA, and GitHub could not classify the licence of that repository (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

normalize_answer Ran
ran; our contract draft was wrong, not the code
PluviophileYU/COSY/XQA/src/evaluate_v1_1.py
code served (permissive licence) · get_code("c6a80c065d2e4851")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import string
import re

def normalize_answer(s):
    """Lower text and remove punctuation, articles and extra whitespace."""

    def remove_articles(text):
        return re.sub('\\b(a|an|the)\\b', ' ', text)

    def white_space_fix(text):
        return ' '.join(text.split())

    def remove_punc(text):
        exclude = set(string.punctuation)
        return ''.join((ch for ch in text if ch not in exclude))

    def lower(text):
        return text.lower()
    return white_space_fix(remove_articles(remove_punc(lower(s))))


ARGS = {
    "s": "The Quick Brown Fox, jumps over the lazy dog!"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
normalize_answer Ran
ran; our contract draft was wrong, not the code
PluviophileYU/COSY/XQA/src/mlqa_evaluation_v1.py
pointer only (licence: MIT); the stored copy get_code serves, from facebookresearch/MLQA, is pointer only (licence: NOASSERTION) · get_code("9cddf0b1a2750978")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from facebookresearch/MLQA, and GitHub could not classify the licence of that repository (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

whitespace_tokenize Ran
ran; our contract draft was wrong, not the code
PluviophileYU/COSY/XQA/src/mlqa_evaluation_v1.py
pointer only (licence: MIT); the stored copy get_code serves, from facebookresearch/MLQA, is pointer only (licence: NOASSERTION) · get_code("a5f7f44e35526909")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from facebookresearch/MLQA, and GitHub could not classify the licence of that repository (NOASSERTION). The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 7 are also present in other papers whose code we hold (7 with at least one paper dated earlier, 0 the same month, 6 later) and 1 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
normalize_answer 133 other papers
28 dated earlier, 99 later, 5 same year, order not determinable, 1 undated · 1 only as an assembly brick
1508.06615 (2015-08)
Character-Aware Neural Language Models
1606.05250 (2016-06)
SQuAD: 100,000+ Questions for Machine Comprehension of Text
1608.07905 (2016-08)
Machine Comprehension Using Match-LSTM and Answer Pointer
and 130 more not named here
exact_match_score 56 other papers
25 dated earlier, 25 later, 6 same year, order not determinable
1508.06615 (2015-08)
Character-Aware Neural Language Models
1606.05250 (2016-06)
SQuAD: 100,000+ Questions for Machine Comprehension of Text
1608.07905 (2016-08)
Machine Comprehension Using Match-LSTM and Answer Pointer
and 53 more not named here
f1_score 41 other papers
23 dated earlier, 14 later, 4 same year, order not determinable
1508.06615 (2015-08)
Character-Aware Neural Language Models
1606.05250 (2016-06)
SQuAD: 100,000+ Questions for Machine Comprehension of Text
1608.07905 (2016-08)
Machine Comprehension Using Match-LSTM and Answer Pointer
and 38 more not named here
to_list 41 other papers
16 dated earlier, 14 later, 11 same year, order not determinable
1902.01718 (2019-02)
End-to-End Open-Domain Question Answering with BERTserini
1910.06188 (2019-10)
Q8BERT: Quantized 8Bit BERT
1911.02984 (2019-11)
The TechQA Dataset
and 38 more not named here
mixed_segmentation 3 other papers
1 dated earlier, 2 later
1910.07475 (2019-10)
MLQA: Evaluating Cross-lingual Extractive Question Answering
2023.emnlp-main.803 (2023 (year only))
Beware of Model Collapse! Fast and Stable Test-time Adaptation for Robust Question Answering
2303.12528 (2023-03)
MEGA: Multilingual Evaluation of Generative AI
whitespace_tokenize 3 other papers
1 dated earlier, 2 later
1910.07475 (2019-10)
MLQA: Evaluating Cross-lingual Extractive Question Answering
2023.emnlp-main.803 (2023 (year only))
Beware of Model Collapse! Fast and Stable Test-time Adaptation for Robust Question Answering
2303.12528 (2023-03)
MEGA: Multilingual Evaluation of Generative AI
normalize_answer 1 other paper
1 dated earlier
1910.07475 (2019-10)
MLQA: Evaluating Cross-lingual Extractive Question Answering

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Pre-trained multilingual language models, e.g., multilingual-BERT, are widely used in crosslingual tasks, yielding the state-of-the-art performance. However, such models suffer from a large performance gap between source and target languages, especially in the zero-shot setting, where the models are fine-tuned only on English but tested on other languages for the same task. We tackle this issue by incorporating language-agnostic information, specifically, universal syntax such as dependency relations and POS tags, into language models, based on the observation that universal syntax is transferable across different languages. Our approach, named COunterfactual SYntax (COSY), includes the design of SYntaxaware networks as well as a COunterfactual training method to implicitly force the networks to learn not only the semantics but also the syntax. To evaluate COSY, we conduct cross-lingual experiments on natural language inference and question answering using mBERT and XLM-R as network backbones. Our results show that COSY achieves the stateof-the-art performance for both tasks, without using auxiliary dataset. 1 "I love apples .

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2021.acl-long.48")
get_code_for_paper("2021.acl-long.48")
have("2021.acl-long.48")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2021.acl-long.48.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2021.acl-long.48.svg)](https://syntology.ai/paper/2021.acl-long.48)

Connect an agent — have() is free.