SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2023.acl-long.182 · ACL · 2023

HyPe: Better Pre-trained Language Model Fine-tuning with Hidden Representation Perturbation

Chuanqi Tan, Fei Huang, Zheng Yuan, Hongyi Yuan, Songfang Huang

Code that ran

4 of 7 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 3 have no contract verdict; 1 failure of our instrument; 3 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/2023.acl-long.182.json · badge: /api/ran/2023.acl-long.182.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
Yuanhy1997/HyPe canonical (classifier label)
classifier basis: census
4 ran · 3 no recorded run
FunctionStatusWhere it lives
acc_and_f1 Ran
ran on a synthesized input
Yuanhy1997/HyPe/metric.py
code served (permissive licence) · get_code("7877ae725c2cba07")
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 numpy as np

# Create small numpy arrays for predictions and labels
# The function uses these to compute accuracy and f1 score
preds = np.array([0, 1, 1, 0, 1])
labels = np.array([0, 1, 0, 0, 1])

ARGS = {
    'preds': preds,
    'labels': labels
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — 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
build_tf_xlnet_to_pytorch_map Ran
ran on a synthesized input
Yuanhy1997/HyPe/hype_modeling_xlnet.py
code served (permissive licence) · get_code("4d70a9fe6d0c7c7c")
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 torch.nn as nn

torch.manual_seed(0)

# Create attention head components
class RelAttn(nn.Module):
    def __init__(self, d_model=4, num_layers=2):
        super().__init__()
        self.layer_norm = nn.LayerNorm(d_model)
        self.o = nn.Linear(d_model, d_model)
        self.q = nn.Linear(d_model, d_model)
        self.k = nn.Linear(d_model, d_model)
        self.r = nn.Linear(d_model, d_model)
        self.v = nn.Linear(d_model, d_model)
        self.r_r_bias = torch.randn(d_model)
        self.r_w_bias = torch.randn(d_model)
        self.r_s_bias = torch.randn(d_model)
        self.seg_embed = nn.Embedding(2, d_model)

# Create feed-forward components
class FFN(nn.Module):
    def __init__(self, d_model=4, d_ff=8):
        super().__init__()
        self.layer_norm = nn.LayerNorm(d_model)
        self.layer_1 = nn.Linear(d_model, d_ff)
        self.layer_2 = nn.Linear(d_ff, d_model)

# Create transformer layer
class TransformerLayer(nn.Module):
    def __init__(self, d_model=4, d_ff=8):
        super().__init__()
        self.rel_attn = RelAttn(d_model=d_model)
        self.ff = FFN(d_model=d_model, d_ff=d_ff)

# Create transformer with layers
class Transformer(nn.Module):
    def __init__(self, d_model=4, d_ff=8, num_layers=2):
        super().__init__()
        self.word_embedding = nn.Embedding(100, d_model)
        self.mask_emb = torch.randn(d_model)
        self.layer = nn.ModuleList([TransformerLayer(d_model=d_model, d_ff=d_ff) for _ in range(num_layers)])
        self.r_r_bias = torch.randn(d_model)
        self.r_w_bias = torch.randn(d_model)
        self.r_s_bias = torch.randn(d_model)
        self.seg_embed = nn.Embedding(2, d_model)

# Create full model with optional components
class XLNetModel(nn.Module):
    def __init__(self, d_model=4, d_ff=8, num_layers=2, include_lm_loss=True, include_sequence_summary=True, include_logits_proj=True):
        super().__init__()
        self.transformer = Transformer(d_model=d_model, d_ff=d_ff, num_layers=num_layers)
        if include_lm_loss:
            self.lm_loss = nn.Linear(d_model, 100)
        if include_sequence_summary:
            self.sequence_summary = nn.Module()
            self.sequence_summary.summary = nn.Linear(d_model, d_model)
        if include_logits_proj:
            self.logits_proj = nn.Linear(d_model, 1)

# Create config
class Config:
    def __init__(self, untie_r=False, finetuning_task=None):
        self.untie_r = untie_r
        self.finetuning_task = finetuning_task

# Create tf_weights dictionary
tf_weights = {
    'model/sequnece_summary/summary/kernel': torch.randn(4, 4),
    'model/regression_test/logit/kernel': torch.randn(1, 4),
}

model = XLNetModel(d_model=4, d_ff=8, num_layers=2, include_lm_loss=True, include_sequence_summary=True, include_logits_proj=True)
config = Config(untie_r=False, finetuning_task='test')

ARGS = {
    'model': model,
    'config': config,
    'tf_weights': tf_weights
}
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 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
create_position_ids_from_input_ids Ran
ran; our contract draft was wrong, not the code
Yuanhy1997/HyPe/hype_modeling_roberta.py
pointer only (licence: MIT); the stored copy get_code serves, from Kowsher/Propulsion, is pointer only (licence: NONE) · get_code("38f46ef4e03fee1c")
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 Kowsher/Propulsion, 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.

pearson_and_spearman Ran
ran on a synthesized input
Yuanhy1997/HyPe/metric.py
code served (permissive licence) · get_code("04926b8f59ec8600")
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 scipy.stats import pearsonr, spearmanr

torch.manual_seed(0)

# Create small prediction and label arrays
# The function expects array-like inputs that can be passed to scipy.stats functions
preds = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6])
labels = np.array([0.15, 0.25, 0.35, 0.38, 0.52, 0.58])

ARGS = {
    'preds': preds,
    'labels': labels
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — 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
load_tf_weights_in_bert Not yet run
unverified (harvested, no recorded run)
Yuanhy1997/HyPe/hype_modeling_bert.py
pointer only (licence: MIT); the stored copy get_code serves, from CSU-NLP-Group/MARE, is pointer only (licence: NONE) · get_code("efbb0f3903b5f779")
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 CSU-NLP-Group/MARE, 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. No invocation recorded.

load_tf_weights_in_xlnet Not yet run
unverified (harvested, no recorded run)
Yuanhy1997/HyPe/hype_modeling_xlnet.py
code served (permissive licence) · get_code("cb918af2e103f656")
How it ran

no invocation recorded.

simple_accuracy Not yet run
unverified (harvested, no recorded run)
Yuanhy1997/HyPe/metric.py
code served (permissive licence) · get_code("3c241ecfe3749a6d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 3 later) and 2 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
simple_accuracy 59 other papers
45 dated earlier, 4 later, 10 same year, order not determinable
1506.05865 (2015-06)
LCSTS: A Large Scale Chinese Short Text Summarization Dataset
1509.01626 (2015-09)
Character-level Convolutional Networks for Text Classification *
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
and 56 more not named here
create_position_ids_from_input_ids 28 other papers
12 dated earlier, 10 later, 6 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
load_tf_weights_in_bert 8 other papers
2 dated earlier, 6 later
Dou_An_Empirical_Study_of_Training_End-to-End_Vision-and-Language_Transformers_CVPR_2022_paper (2022 (year only))
An Empirical Study of Training End-to-End Vision-and-Language Transformers
2210.10678 (2022-10)
Towards Realistic Low-resource Relation Extraction: A Benchmark with Empirical Baseline Study
2024.findings-acl.164 (2024 (year only))
Selective Prefix Tuning for Pre-trained Language Models
and 5 more not named here
acc_and_f1 2 other papers
2 dated earlier
2109.05687 (2021-09)
Raise a Child in Large Language Model: Towards Effective and Generalizable Fine-tuning
2111.04130 (2021-11)
NLP From Scratch Without Large-Scale Pretraining: A Simple and Efficient Framework
pearson_and_spearman 1 other paper
1 dated earlier
2109.05687 (2021-09)
Raise a Child in Large Language Model: Towards Effective and Generalizable Fine-tuning

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

Language models with the Transformers structure have shown great performance in natural language processing. However, there still poses problems when fine-tuning pre-trained language models on downstream tasks, such as over-fitting or representation collapse. In this work, we propose HyPe, a simple yet effective fine-tuning technique to alleviate such problems by perturbing hidden representations of Transformers layers. Unlike previous works that only add noise to inputs or parameters, we argue that the hidden representations of Transformers layers convey more diverse and meaningful language information. Therefore, making the Transformers layers more robust to hidden representation perturbations can further benefit the fine-tuning of PLMs en bloc. We conduct extensive experiments and analyses on GLUE and other natural language inference datasets. Results demonstrate that HyPe outperforms vanilla fine-tuning and enhances generalization of hidden representations from different layers. In addition, HyPe acquires negligible computational overheads, and is better than and compatible with previous state-of-theart fine-tuning techniques. Codes are released at https://github.com/Yuanhy1997/HyPe.

For agents

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

get_harvested_code_for_paper("2023.acl-long.182")
get_code_for_paper("2023.acl-long.182")
have("2023.acl-long.182")

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

curl https://syntology.ai/api/ran/2023.acl-long.182.json

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

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

Connect an agent — have() is free.