SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.16307 · 2023

IndicTrans2: Towards High-Quality and Accessible Machine Translation Models for all 22 Scheduled Indian Languages

arXiv · PDF · Open in the Atlas

Code that ran

6 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; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 2 failures of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; 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/2305.16307.json · badge: /api/ran/2305.16307.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
ai4bharat/indictrans2 canonical (classifier label)
classifier basis: census
6 ran · 2 no recorded run
FunctionStatusWhere it lives
compute_metrics_factory Ran
ran on a synthesized input
ai4bharat/indictrans2/huggingface_interface/train_lora.py
code served (permissive licence) · get_code("a29de23a02373ce2")
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 function. 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 torch
import numpy as np
import pandas as pd

torch.manual_seed(0)

# Stand-in tokenizer class that implements the required methods
class StandInTokenizer:
    def __init__(self):
        self.pad_token_id = 0
        self._target_tokenizer_mode = False
    
    def batch_decode(self, token_ids, skip_special_tokens=False, clean_up_tokenization_spaces=False):
        # Convert token ids to strings
        # Simulate decoding by converting each token id to a word
        batch_size = token_ids.shape[0] if len(token_ids.shape) > 1 else len(token_ids)
        return [f"decoded text {i}" for i in range(batch_size)]
    
    def as_target_tokenizer(self):
        # Return a context manager
        return self
    
    def __enter__(self):
        self._target_tokenizer_mode = True
        return self
    
    def __exit__(self, *args):
        self._target_tokenizer_mode = False


# Stand-in metric class that implements the required methods
class StandInMetric:
    def corpus_score(self, predictions, references):
        # predictions: list of strings
        # references: list of list of strings
        result = type('obj', (object,), {'score': 0.85})()
        return result


# Create tokenizer
tokenizer = StandInTokenizer()

# Create metric dict
metric_dict = {
    'bleu': StandInMetric(),
    'rouge': StandInMetric(),
}

# Create eval_preds: (predictions, labels) tuple with small tensors
batch_size = 2
seq_length = 4
preds = np.random.randint(1, 100, size=(batch_size, seq_length), dtype=np.int32)
labels = np.random.randint(1, 100, size=(batch_size, seq_length), dtype=np.int32)

# Add some -100 values to test the replacement logic
preds[0, 1] = -100
labels[1, 2] = -100

eval_preds = (preds, labels)

ARGS = {
    'tokenizer': tokenizer,
    'metric_dict': metric_dict,
    'print_samples': False,
    'n_samples': 2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
create_position_ids_from_input_ids Ran
ran; our contract draft was wrong, not the code
ai4bharat/indictrans2/huggingface_interface/modeling_indictrans.py
code served (permissive licence) · get_code("336749dd7d699ef6")
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 Tensor, ndim 2, dtype family int, shape (2, 4) 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 torch

torch.manual_seed(0)

# Create input_ids tensor with shape (batch_size=2, seq_length=4)
# Values should include some padding tokens and some non-padding tokens
input_ids = torch.tensor([
    [0, 1, 2, 0],      # batch 1: padding_idx=0 at positions 0 and 3
    [1, 2, 0, 1]       # batch 2: padding_idx=0 at position 2
])

# padding_idx is the token ID used for padding (typically 0)
padding_idx = 0

# past_key_values_length represents how many tokens were processed before
# (used in autoregressive generation to offset position indices)
past_key_values_length = 0

ARGS = {
    "input_ids": input_ids,
    "padding_idx": padding_idx,
    "past_key_values_length": past_key_values_length
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family int, shape (2, 4) — shape (2, 4) 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
load_and_process_translation_dataset Ran
ran on a synthesized input
ai4bharat/indictrans2/huggingface_interface/train_lora.py
code served (permissive licence) · get_code("4345abd3e91fa2b1")
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 Dataset. 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 os
import tempfile
from datasets import Dataset
from unittest.mock import Mock

torch_imported = False
try:
    import torch
    torch_imported = True
except ImportError:
    pass

# Create a temporary directory structure with mock translation files
temp_dir = tempfile.mkdtemp()
os.makedirs(os.path.join(temp_dir, 'train', 'en-fr'), exist_ok=True)

# Create mock translation files
src_file_path = os.path.join(temp_dir, 'train', 'en-fr', 'train.en')
tgt_file_path = os.path.join(temp_dir, 'train', 'en-fr', 'train.fr')

with open(src_file_path, 'w', encoding='utf-8') as f:
    f.write("Hello world\n")
    f.write("How are you\n")

with open(tgt_file_path, 'w', encoding='utf-8') as f:
    f.write("Bonjour le monde\n")
    f.write("Comment allez-vous\n")

# Create a mock tokenizer
class MockTokenizer:
    def __init__(self):
        self.model_max_length = 256
        
    def __call__(self, text, truncation=False, padding=False, max_length=256):
        # Simple mock: return input_ids and attention_mask
        if isinstance(text, list):
            return {
                'input_ids': [[1, 2, 3] for _ in text],
                'attention_mask': [[1, 1, 1] for _ in text]
            }
        else:
            return {
                'input_ids': [1, 2, 3],
                'attention_mask': [1, 1, 1]
            }
    
    def as_target_tokenizer(self):
        return self

    def __enter__(self):
        return self
    
    def __exit__(self, *args):
        pass

# Create a mock processor
class MockProcessor:
    def preprocess_batch(self, lines, src_lang=None, tgt_lang=None, is_target=False):
        # Simple mock: just strip newlines
        return [line.strip() for line in lines]

tokenizer = MockTokenizer()
processor = MockProcessor()

ARGS = {
    'data_dir': temp_dir,
    'split': 'train',
    'tokenizer': tokenizer,
    'processor': processor,
    'src_lang_list': ['en'],
    'tgt_lang_list': ['fr'],
    'num_proc': 1,
    'seed': 42
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
datasets, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Dataset — a Dataset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Dataset output the recorded ndim 1 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
make_linear_from_emb Ran
ran on a synthesized input
ai4bharat/indictrans2/huggingface_interface/convert_indictrans_checkpoint_to_pytorch.py
code served (permissive licence) · get_code("e7e94d76c8167997")
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 Linear. 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a small embedding tensor
# Shape: (vocab_size=5, emb_size=3)
emb = torch.randn(5, 3)

ARGS = {
    "emb": emb
}
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 Linear — a Linear output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Linear 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
preprocess_fn Ran
ran on a synthesized input
ai4bharat/indictrans2/huggingface_interface/train_lora.py
code served (permissive licence) · get_code("60615acd2c44cb5d")
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 dict. 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 torch
import numpy as np
from transformers import AutoTokenizer

torch.manual_seed(0)

# Create a minimal tokenizer stand-in class that implements the required interface
class MinimalTokenizer:
    def __init__(self):
        self.vocab_size = 100
        self.pad_token_id = 0
        self.eos_token_id = 2
        
    def __call__(self, text, truncation=False, padding=False, max_length=None):
        # Simulate tokenization by creating fake token ids
        if isinstance(text, str):
            tokens = text.split()
        else:
            tokens = text
        
        token_ids = [hash(t) % self.vocab_size for t in tokens]
        
        if truncation and max_length:
            token_ids = token_ids[:max_length]
        
        return {
            'input_ids': token_ids,
            'attention_mask': [1] * len(token_ids)
        }
    
    def as_target_tokenizer(self):
        # Return a context manager that does nothing
        return _TargetTokenizerContext(self)

class _TargetTokenizerContext:
    def __init__(self, tokenizer):
        self.tokenizer = tokenizer
    
    def __enter__(self):
        return self.tokenizer
    
    def __exit__(self, *args):
        pass

# Create example data
example = {
    'sentence_SRC': 'hello world test',
    'sentence_TGT': 'bonjour monde test'
}

# Create tokenizer
tokenizer = MinimalTokenizer()

# Define ARGS
ARGS = {
    'example': example,
    'tokenizer': tokenizer
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
shift_tokens_right Ran
ran; our contract draft was wrong, not the code
ai4bharat/indictrans2/huggingface_interface/modeling_indictrans.py
pointer only (licence: MIT); the stored copy get_code serves, from facebookresearch/ssvp_slt, is pointer only (licence: NOASSERTION) · get_code("9dfcf8b13847c65f")
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/ssvp_slt, 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.

initialize_model_and_tokenizer Not yet run
unverified (harvested, no recorded run)
ai4bharat/indictrans2/huggingface_interface/example.py
code served (permissive licence) · get_code("f0c8343794ef8b5f")
How it ran

no invocation recorded.

predict Not yet run
unverified (harvested, no recorded run)
ai4bharat/indictrans2/baseline_eval/m2m100_inference.py
code served (permissive licence) · get_code("71b64e8cc27d0701")
How it ran

no invocation 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, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 2 the same month, 2 later) and 6 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
create_position_ids_from_input_ids 28 other papers
12 dated earlier, 1 the same month, 13 later, 2 same year, order not determinable
2107.00910 (2021-07)
Learned Token Pruning for Transformers
2107.14035 (2021-07)
ProtoTransformer: A Meta-Learning Approach to Providing Student Feedback
2201.11732 (2022-01)
IGLUE: A Benchmark for Transfer Learning across Modalities, Tasks, and Languages
and 25 more not named here
shift_tokens_right 18 other papers
5 dated earlier, 1 the same month, 11 later, 1 same year, order not determinable · 1 only as an assembly brick
2021.acl-demo.21 (2021 (year only))
KuiLeiXi: a Chinese Open-Ended Text Adventure Game
2203.07836 (2022-03)
Graph Pre-training for AMR Parsing and Generation
2203.11239 (2022-03)
DQ-BART: Efficient Sequence-to-Sequence Model via Joint Distillation and Quantization
and 15 more not named here

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-22.

Repositories linked to this paper

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

Abstract

India has a rich linguistic landscape with languages from 4 major language families spoken by over a billion people. 22 of these languages are listed in the Constitution of India (referred to as scheduled languages) are the focus of this work. Given the linguistic diversity, high-quality and accessible Machine Translation (MT) systems are essential in a country like India. Prior to this work, there was (i) no parallel training data spanning all 22 languages, (ii) no robust benchmarks covering all these languages and containing content relevant to India, and (iii) no existing translation models which support all the 22 scheduled languages of India. In this work, we aim to address this gap by focusing on the missing pieces required for enabling wide, easy, and open access to good machine translation systems for all 22 scheduled Indian languages. We identify four key areas of improvement: curating and creating larger training datasets, creating diverse and high-quality benchmarks, training multilingual models, and releasing models with open access. Our first contribution is the release of the Bharat Parallel Corpus Collection (BPCC), the largest publicly available parallel corpora for Indic languages. BPCC contains a total of 230M bitext pairs, of which a total of 126M were newly added, including 644K manually translated sentence pairs created as part of this work. Our second contribution is the release of the first n-way parallel benchmark covering all 22 Indian languages, featuring diverse domains, Indian-origin content, and source-original test sets. Next, we present IndicTrans2, the first model to support all 22 languages, surpassing existing models on multiple existing and new benchmarks created as a part of this work. Lastly, to promote accessibility and collaboration, we release our models and associated data with permissive licenses at https://github.com/AI4Bharat/IndicTrans2.

For agents

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

get_harvested_code_for_paper("2305.16307")
get_code_for_paper("2305.16307")
have("2305.16307")

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

curl https://syntology.ai/api/ran/2305.16307.json

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

[![Syntology run record](https://syntology.ai/api/ran/2305.16307.svg)](https://syntology.ai/paper/2305.16307)

Connect an agent — have() is free.