SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2310.11670 · EMNLP · 2023

Prototype-based HyperAdapter for Sample-Efficient Multi-task Tuning

Jie Fu, Hao Zhao, Zhaofeng He

arXiv · PDF · Open in the Atlas

Code that ran

2 of 4 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 0 failures of our instrument; 2 no recorded run), measured 2026-11-23; 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/2310.11670.json · badge: /api/ran/2310.11670.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
Bumble666/PHA community
Papers with Code archive
2 ran · 2 no recorded run
FunctionStatusWhere it lives
ParameterGenerator Ran
ran on a synthesized input · constructed an object; no result was computed
Bumble666/PHA/modeling/adapter_generators.py
code served (permissive licence) · get_code("d65a8bab6e7a7726")
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 an instance of its own class, ParameterGenerator: the run constructed the object and did not call it, so no result was computed. 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
import math

torch.manual_seed(0)

class Config:
    def __init__(self):
        self.encoder_adapter_dim = 3
        self.decoder_adapter_dim = 5
        self.hypernetwork_bottleneck = 8
        self.num_hidden_layers = 2

def hyperfanin_init_bias(linear_layer, hypernet_in):
    bound = 0.001 * math.sqrt(3 / hypernet_in)
    nn.init.uniform_(linear_layer.weight, -bound, bound)
    nn.init.constant_(linear_layer.bias, 0.0)

def hyperfanin_init_weight(linear_layer, hypernet_in, mainnet_in):
    bound = 0.001 * math.sqrt(3 / (hypernet_in * mainnet_in))
    nn.init.uniform_(linear_layer.weight, -bound, bound)
    nn.init.constant_(linear_layer.bias, 0.0)

class SimpleGenerator(nn.Module):
    def __init__(self, config, input_dim, hidden_size, is_encoder=False):
        super().__init__()
        adapter_dim = config.encoder_adapter_dim if is_encoder else config.decoder_adapter_dim
        self.input_dim = input_dim
        self.hidden_dim = config.hypernetwork_bottleneck
        self.linear1 = nn.Linear(self.input_dim, 128)
        self.activation_fn = nn.ReLU()
        self.linear2 = nn.Linear(128, 64)
        self.LayerNorm = nn.LayerNorm(64, eps=1e-06)
        self.weight_up = nn.Linear(64, hidden_size * adapter_dim)
        self.weight_down = nn.Linear(64, hidden_size * adapter_dim)
        self.bias_up = nn.Linear(64, hidden_size)
        self.bias_down = nn.Linear(64, adapter_dim)
        hyperfanin_init_weight(self.weight_up, 64, adapter_dim)
        hyperfanin_init_weight(self.weight_down, 64, hidden_size)
        hyperfanin_init_bias(self.bias_up, 64)
        hyperfanin_init_bias(self.bias_down, 64)

    def forward(self, x):
        x = self.linear1(x)
        x = self.activation_fn(x)
        x = self.linear2(x)
        x = self.LayerNorm(x)
        return (self.weight_up(x), self.weight_down(x), self.bias_up(x), self.bias_down(x))

class ParameterGenerator(nn.Module):
    def __init__(self, config, hidden_size, is_encoder=False):
        super().__init__()
        self.config = config
        self.layer_embed = nn.Embedding(config.num_hidden_layers, 64)
        self.decoder = SimpleGenerator(config, 64 + 64, hidden_size, is_encoder=is_encoder)

    def forward(self, hidden_inputs):
        layers = []
        layers_idxs = torch.arange(0, self.config.num_hidden_layers, dtype=torch.long, device=hidden_inputs.device)
        layers_idxs = layers_idxs.repeat(hidden_inputs.size(0), 1)
        for i in range(self.config.num_hidden_layers):
            layer_embed = self.layer_embed(layers_idxs[:, i])
            hidden_input = torch.cat([hidden_inputs, layer_embed], dim=1)
            layers.append(self.decoder(hidden_input))
        return layers

config = Config()
hidden_size = 6
is_encoder = False

ARGS = {
    "config": config,
    "hidden_size": hidden_size,
    "is_encoder": is_encoder,
}
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 ParameterGenerator — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ParameterGenerator 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
SimpleGenerator Ran
ran on a synthesized input · constructed an object; no result was computed
Bumble666/PHA/modeling/adapter_generators.py
code served (permissive licence) · get_code("c6d0ff6c86a01ed4")
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 an instance of its own class, SimpleGenerator: the run constructed the object and did not call it, so no result was computed. 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
import math

torch.manual_seed(0)

class Config:
    def __init__(self):
        self.encoder_adapter_dim = 3
        self.decoder_adapter_dim = 5
        self.hypernetwork_bottleneck = 8

config = Config()
input_dim = 7
hidden_size = 4
is_encoder = False

ARGS = {
    "config": config,
    "input_dim": input_dim,
    "hidden_size": hidden_size,
    "is_encoder": is_encoder
}
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 SimpleGenerator — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SimpleGenerator 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
hyperfanin_init_bias Not yet run
unverified (harvested, no recorded run)
Bumble666/PHA/modeling/adapter_generators.py
code served (permissive licence) · get_code("c4435802d55c94f6")
How it ran

no invocation recorded.

hyperfanin_init_weight Not yet run
unverified (harvested, no recorded run)
Bumble666/PHA/modeling/adapter_generators.py
code served (permissive licence) · get_code("613ed2a977afd2c4")
How it ran

no invocation recorded.

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 4 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.

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

Repositories linked to this paper

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

Abstract

Parameter-efficient fine-tuning (PEFT) has shown its effectiveness in adapting the pretrained language models to downstream tasks while only updating a small number of parameters. Despite the success, most existing methods independently adapt to each task without considering knowledge transfer between tasks and are limited to low-data regimes. To overcome this issue, we propose Prototype-based HyperAdapter (PHA), a novel framework built on the adapter-tuning and hypernetwork. It introduces an instance-dense retriever and a prototypical hypernetwork to generate the conditional modules in a sample-efficient manner. This leads to comparable performance improvements against existing PEFT methods on multi-task learning and few-shot transfer learning. More importantly, when the available data size gets smaller, our method outperforms other strong baselines by a large margin. Based on our extensive empirical experiments across various datasets, we demonstrate that PHA strikes a better trade-off between trainable parameters, accuracy on stream tasks, and sample efficiency. Our code is publicly available at https://github.com/Bumble666/PHA

For agents

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

get_harvested_code_for_paper("2310.11670")
get_code_for_paper("2310.11670")
have("2310.11670")

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

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

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

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

Connect an agent — have() is free.