SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2025.findings-acl.923 · ACL Findings · 2025

On the Generalization vs Fidelity Paradox in Knowledge Distillation

Tanmoy Chakraborty, Ayan Sengupta, S. K. Ramesh

Open in the Atlas

Code that ran

8 of 10 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 6 have no contract verdict; 2 failures of our instrument; 2 no recorded run), 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/2025.findings-acl.923.json · badge: /api/ran/2025.findings-acl.923.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
LCS2-IIITD/KD_generalization canonical (classifier label)
classifier basis: census
8 ran · 2 no recorded run
FunctionStatusWhere it lives
generalized_jsd_loss Ran
ran on a synthesized input
LCS2-IIITD/KD_generalization/generative/kd_trainer.py
code served (permissive licence) · get_code("12812b638b0f24db")
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 Tensor, 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 torch
import torch.nn.functional as F

torch.manual_seed(0)

# Create small tensors for student and teacher logits
batch_size = 2
num_classes = 4

student_logits = torch.randn(batch_size, num_classes)
teacher_logits = torch.randn(batch_size, num_classes)

# Create labels with some valid indices and some -100 (ignored) indices
labels = torch.tensor([0, -100], dtype=torch.long)

# Create the ARGS dictionary with all parameters
ARGS = {
    'student_logits': student_logits,
    'teacher_logits': teacher_logits,
    'labels': labels,
    'beta': 0.5,
    'temperature': 1.0,
    'reduction': 'batchmean'
}
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 Tensor, 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
generate_prompt Ran
ran on a synthesized input
LCS2-IIITD/KD_generalization/generative/finetune.py
code served (permissive licence) · get_code("f8af62839d4dab6d")
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 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 torch

# Construct a valid data_point dict for the generate_prompt function
data_point_with_input = {
    'instruction': 'Translate the following text to French.',
    'input': 'Hello, how are you?',
    'output': 'Bonjour, comment allez-vous?'
}

data_point_without_input = {
    'instruction': 'Write a haiku about nature.',
    'input': '',
    'output': 'Green leaves fall gently\nWind carries them to the earth\nLife cycles onward'
}

# ARGS mapping the parameter to a value
ARGS = {
    'data_point': data_point_with_input
}
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 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
generate_prompt Ran
ran on a synthesized input
LCS2-IIITD/KD_generalization/generative/commonsense_evaluate.py
code served (permissive licence) · get_code("b9ab95fbc9974ce7")
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 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 torch

torch.manual_seed(0)

ARGS = {
    "instruction": "Translate the following English text to French.",
    "input_text": "Hello, how are you today?"
}
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 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
generate_prompt Ran
ran on a synthesized input
LCS2-IIITD/KD_generalization/generative/evaluate.py
code served (permissive licence) · get_code("d4534c9da61c3482")
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 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 torch

torch.manual_seed(0)

# The function generate_prompt takes two parameters:
# 1. instruction (str): required parameter
# 2. input_text (str, optional): defaults to None

ARGS = {
    "instruction": "Write a poem about Python programming",
    "input_text": "Focus on loops and functions"
}
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 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
load_data Ran
ran; our contract draft was wrong, not the code
LCS2-IIITD/KD_generalization/generative/commonsense_evaluate.py
code served (permissive licence) · get_code("56a9466ff35b35bb")
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 1, 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 json
import os
import tempfile

# Create a temporary directory structure with a test dataset file
temp_dir = tempfile.mkdtemp()
dataset_dir = os.path.join(temp_dir, 'dataset', 'example_dataset')
os.makedirs(dataset_dir, exist_ok=True)

# Create a sample test.json file
test_data = [
    {"id": 1, "text": "sample text 1", "label": 0},
    {"id": 2, "text": "sample text 2", "label": 1}
]

test_file_path = os.path.join(dataset_dir, 'test.json')
with open(test_file_path, 'w') as f:
    json.dump(test_data, f)

# Change to the temporary directory so the relative path works
original_cwd = os.getcwd()
os.chdir(temp_dir)

# Create a simple args object
class Args:
    def __init__(self, dataset):
        self.dataset = dataset

ARGS = {
    'args': Args(dataset='example_dataset')
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 list, ndim 1, 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
read_json Ran
ran; our contract draft was wrong, not the code
LCS2-IIITD/KD_generalization/generative/dataset/mawps/data_process.py
code served (permissive licence) · get_code("1266012e186b82e8")
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 json
import tempfile
import os

# Create a temporary JSON file with sample data
temp_dir = tempfile.mkdtemp()
json_file_path = os.path.join(temp_dir, "test_data.json")

sample_data = {
    "key1": "value1",
    "key2": [1, 2, 3],
    "key3": {"nested": "object"}
}

with open(json_file_path, 'w') as f:
    json.dump(sample_data, f)

ARGS = {
    "file_path": json_file_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 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
sequence_kl_divergence Ran
ran on a synthesized input
LCS2-IIITD/KD_generalization/generative/kd_trainer.py
code served (permissive licence) · get_code("4269d0243bc60d31")
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 Tensor, 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 torch
import torch.nn.functional as F

torch.manual_seed(0)

# Create small tensors for student and teacher logits
# batch_size=2, sequence_length=3, vocab_size=4
batch_size = 2
sequence_length = 3
vocab_size = 4

student_logits = torch.randn(batch_size, sequence_length, vocab_size)
teacher_logits = torch.randn(batch_size, sequence_length, vocab_size)

# Create a pad mask (batch_size, sequence_length) with 1s for valid tokens and 0s for padding
pad_mask = torch.ones(batch_size, sequence_length)
pad_mask[0, 2] = 0  # Mark last token in first sequence as padding

# Set up the ARGS dictionary with all parameters
ARGS = {
    'student_logits': student_logits,
    'teacher_logits': teacher_logits,
    'temperature': 2.0,
    'epsilon': 1e-09,
    'pad_mask': pad_mask,
}
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 Tensor, 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
sequence_reverse_kl_divergence Ran
ran on a synthesized input
LCS2-IIITD/KD_generalization/generative/kd_trainer.py
code served (permissive licence) · get_code("39d89c1bc967043d")
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 Tensor, 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 torch
import torch.nn.functional as F

torch.manual_seed(0)

# Define dimensions
batch_size = 2
block_size = 5
vocab_size = 4

# Create student logits: [batch_size, block_size, vocab_size]
student_logits = torch.randn(batch_size, block_size, vocab_size)

# Create teacher logits: [batch_size, block_size, vocab_size]
teacher_logits = torch.randn(batch_size, block_size, vocab_size)

# Create pad_mask: [batch_size, block_size]
# True for valid tokens, False for padded tokens
pad_mask = torch.tensor([
    [True, True, True, False, False],
    [True, True, True, True, False]
], dtype=torch.bool)

ARGS = {
    "student_logits": student_logits,
    "teacher_logits": teacher_logits,
    "temperature": 1.0,
    "epsilon": 1e-09,
    "pad_mask": pad_mask
}
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 Tensor, 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
main Not yet run
unverified (harvested, no recorded run)
LCS2-IIITD/KD_generalization/generative/commonsense_evaluate.py
code served (permissive licence) · get_code("cb4d70fedfc6772d")
How it ran

no invocation recorded.

main Not yet run
unverified (harvested, no recorded run)
LCS2-IIITD/KD_generalization/generative/evaluate.py
code served (permissive licence) · get_code("0aee73d46e6a7509")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 2 later) and 8 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
load_data 10 other papers
8 dated earlier, 1 later, 1 same year, order not determinable
2304.01933 (2023-04)
LLM-Adapters: An Adapter Family for Parameter-Efficient Fine-Tuning of Large Language Models
2401.00788 (2024-01)
Astraios: Parameter-Efficient Instruction Tuning Code Large Language Models
2402.09353 (2024-02)
DoRA: Weight-Decomposed Low-Rank Adaptation
and 7 more not named here
read_json 2 other papers
1 dated earlier, 1 later
2406.05761 (2024-06)
The BiGGen Bench: A Principled Benchmark for Fine-grained Evaluation of Language Models with Language Models
2605.08110 (2026-05)
BaLoRA: Bayesian Low-Rank Adaptation of Large Scale Models

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

Knowledge distillation (KD) is a key technique for compressing large language models into smaller ones while preserving performance. Despite the recent traction of KD research, its effectiveness for smaller language models (LMs) and the mechanisms driving knowledge transfer remain underexplored. In this work, we present the first large-scale empirical and statistical analysis of KD across models ranging from 0.5B to 7B parameters on 19 complex reasoning and instruction following tasks in a zeroshot setting. Our findings reveal that KD can improve the average performance of smaller models by up to 10%, with a peak task specific gain of 22%, while providing only marginal benefits (∼ 1.3%) for larger models. Surprisingly, teacher performance has a minimal impact on student outcomes, while teacher task expertise impacts KD effectiveness. A correlation study indicates that smaller LMs benefit more from KD, whereas larger LMs show diminished gains. Additionally, we uncover a misalignment between improvements in student performance and reasoning fidelity, suggesting that while KD enhances accuracy, it does not always maintain the structured decision-making processes of the teacher. Our ablation study further highlights the importance of teacher signals and logit smoothing in influencing students' performance after distillation. Overall, our study offers a comprehensive empirical and statistical assessment of KD, highlighting both its benefits and trade-offs when distilling knowledge from larger to smaller LMs.

For agents

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

get_harvested_code_for_paper("2025.findings-acl.923")
get_code_for_paper("2025.findings-acl.923")
have("2025.findings-acl.923")

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

curl https://syntology.ai/api/ran/2025.findings-acl.923.json

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

[![Syntology run record](https://syntology.ai/api/ran/2025.findings-acl.923.svg)](https://syntology.ai/paper/2025.findings-acl.923)

Connect an agent — have() is free.