SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.15268 · 2024

Awakening Augmented Generation: Learning to Awaken Internal Knowledge of Large Language Models for Question Answering

arXiv · PDF · Open in the Atlas

Code that ran

9 of 12 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, 2 violated it and 0 have no contract verdict; 6 failures of our instrument; 3 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/2403.15268.json · badge: /api/ran/2403.15268.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
xnhyacinth/iag canonical (classifier label)
classifier basis: census
9 ran · 3 no recorded run
FunctionStatusWhere it lives
att_mse_loss Ran
ran; our contract draft was wrong, not the code
xnhyacinth/iag/model/losses.py
code served (permissive licence) · get_code("eb1bd9941fe77289")
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 attention tensors with shape (batch_size, num_heads, length, length)
batch_size = 2
num_heads = 3
length = 4

attention_S = torch.randn(batch_size, num_heads, length, length)
attention_T = torch.randn(batch_size, num_heads, length, length)

# Create a mask tensor with shape (batch_size, length)
mask = torch.ones(batch_size, length)
mask[0, 2:] = 0  # mask some positions in first batch
mask[1, 3:] = 0  # mask some positions in second batch

ARGS = {
    "attention_S": attention_S,
    "attention_T": attention_T,
    "mask": 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
best_subspan_em Ran
ran, honoured the contract we drafted
xnhyacinth/iag/src/metrics.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from voidism/lookback-lens, is pointer only (licence: NONE) · get_code("10af7cdbc53df7e5")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from voidism/lookback-lens, 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.

check_answer Ran
ran, violated the contract we drafted
xnhyacinth/iag/model/evaluation.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from facebookresearch/contriever, is pointer only (licence: NOASSERTION) · get_code("637b51b8df78832a")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from facebookresearch/contriever, 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.

cross_attention_forward Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
xnhyacinth/iag/ft_llama/model.py
code served (permissive licence) · get_code("6bef6bdd6eb44070")
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 tuple. 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 torch.nn.functional as F

torch.manual_seed(0)

# Define a minimal self object that has all the required attributes and methods
class CrossAttentionModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.n_heads = 2
        self.d_kv = 3
        self.inner_dim = self.n_heads * self.d_kv  # 6
        self.dropout = 0.1
        self.has_relative_attention_bias = True
        self.score_storage = None
        
        # Linear layers
        input_dim = 8
        kv_dim = 10
        self.q = nn.Linear(input_dim, self.inner_dim, bias=False)
        self.k = nn.Linear(kv_dim, self.inner_dim, bias=False)
        self.v = nn.Linear(kv_dim, self.inner_dim, bias=False)
        self.o = nn.Linear(self.inner_dim, input_dim, bias=False)
        
    def compute_bias(self, qlen, klen):
        # Return a position bias tensor of shape (1, n_heads, qlen, klen)
        return torch.randn(1, self.n_heads, qlen, klen)
    
    def forward(self, input, mask=None, kv=None, position_bias=None, past_key_value_state=None, head_mask=None, query_length=None, use_cache=False, output_attentions=False):
        return cross_attention_forward(self, input, mask, kv, position_bias, past_key_value_state, head_mask, query_length, use_cache, output_attentions)

def cross_attention_forward(self, input, mask=None, kv=None, position_bias=None, past_key_value_state=None, head_mask=None, query_length=None, use_cache=False, output_attentions=False):
    """
    This only works for computing cross attention over the input
    """
    assert kv != None
    assert head_mask == None
    assert position_bias != None or self.has_relative_attention_bias
    bsz, qlen, dim = input.size()
    n_heads, d_heads = (self.n_heads, self.d_kv)
    klen = kv.size(1)
    q = self.q(input).view(bsz, -1, n_heads, d_heads).transpose(1, 2)
    if past_key_value_state == None:
        k = self.k(kv).view(bsz, -1, n_heads, d_heads).transpose(1, 2)
        v = self.v(kv).view(bsz, -1, n_heads, d_heads).transpose(1, 2)
    else:
        k, v = past_key_value_state
    scores = torch.einsum('bnqd,bnkd->bnqk', q, k)
    if mask is not None:
        scores += mask
    if position_bias is None:
        position_bias = self.compute_bias(qlen, klen)
    scores += position_bias
    if self.score_storage is None:
        self.score_storage = scores
    attn = F.softmax(scores.float(), dim=-1).type_as(scores)
    attn = F.dropout(attn, p=self.dropout, training=self.training)
    output = torch.matmul(attn, v)
    output = output.transpose(1, 2).contiguous().view(bsz, -1, self.inner_dim)
    output = self.o(output)
    if use_cache:
        output = (output,) + ((k, v),)
    else:
        output = (output,) + (None,)
    if output_attentions:
        output = output + (attn,)
    if self.has_relative_attention_bias:
        output = output + (position_bias,)
    return output

# Create the module instance
self_module = CrossAttentionModule()

# Create input tensors
bsz = 2
qlen = 5
input_dim = 8
klen = 7
kv_dim = 10

input_tensor = torch.randn(bsz, qlen, input_dim)
kv_tensor = torch.randn(bsz, klen, kv_dim)

# Create position_bias (1, n_heads, qlen, klen)
position_bias_tensor = torch.randn(1, self_module.n_heads, qlen, klen)

# Create mask (broadcastable to scores shape: bsz, n_heads, qlen, klen)
mask_tensor = torch.randn(1, 1, qlen, klen)

ARGS = {
    'self': self_module,
    'input': input_tensor,
    'mask': mask_tensor,
    'kv': kv_tensor,
    'position_bias': position_bias_tensor,
    'past_key_value_state': None,
    'head_mask': None,
    'query_length': None,
    'use_cache': False,
    'output_attentions': False
}
Setup block drafted by
a language model, Claude Sonnet 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 tuple — a tuple output has no array shape of its own; none is 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
find_number_sequences Ran
ran; our contract draft was wrong, not the code
xnhyacinth/iag/pred.py
code served (permissive licence) · get_code("f6311afebc735eee")
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 re

def find_number_sequences(string):
    pattern = '\\d+'
    matches = re.findall(pattern, string)
    return matches if len(matches) > 0 else None

# Setup code
ARGS = {
    'string': 'The numbers are 123 and 456 and 789'
}
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
has_answer Ran
ran, violated the contract we drafted
xnhyacinth/iag/model/evaluation.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from facebookresearch/contriever, is pointer only (licence: NOASSERTION) · get_code("fa4ecbff4b9a354b")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from facebookresearch/contriever, 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.

kd_ce_loss Ran
ran; our contract draft was wrong, not the code
xnhyacinth/iag/model/losses.py
code served (permissive licence) · get_code("40443594fb77d42a")
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 student logits tensor
# Shape: (batch_size=2, num_labels=4) for 2D case
logits_S = torch.randn(2, 4)

# Create teacher logits tensor with same shape
logits_T = torch.randn(2, 4)

# Temperature as a scalar float
temperature = 3.0

ARGS = {
    "logits_S": logits_S,
    "logits_T": logits_T,
    "temperature": temperature,
}
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
kd_mse_loss Ran
ran; our contract draft was wrong, not the code
xnhyacinth/iag/model/losses.py
code served (permissive licence) · get_code("a6de986aee092cb5")
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 logits_S and logits_T
# Shape: (batch_size=2, length=3, num_labels=4)
logits_S = torch.randn(2, 3, 4)
logits_T = torch.randn(2, 3, 4)

# Temperature as a scalar float
temperature = 1.0

ARGS = {
    "logits_S": logits_S,
    "logits_T": logits_T,
    "temperature": temperature,
}
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
normalize_answer Ran
ran; our contract draft was wrong, not the code
xnhyacinth/iag/src/metrics.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from zmzhang2000/trustworthy-alignment, is pointer only (licence: NONE) · get_code("9706a9a0b961096b")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from zmzhang2000/trustworthy-alignment, 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.

calculate_matches Not yet run
unverified (harvested, no recorded run)
xnhyacinth/iag/model/evaluation.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from facebookresearch/contriever, is pointer only (licence: NOASSERTION) · get_code("7a4988952dd3a127")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from facebookresearch/contriever, 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. No invocation recorded.

download_model_retry Not yet run
unverified (harvested, no recorded run)
xnhyacinth/iag/ft_llama/model_download.py
code served (permissive licence) · get_code("29e31466888b16c0")
How it ran

no invocation recorded.

parse_args Not yet run
unverified (harvested, no recorded run)
xnhyacinth/iag/pred.py
code served (permissive licence) · get_code("3cd7263c50c21a23")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 10 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 2 the same month, 10 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
calculate_matches 13 other papers
7 dated earlier, 6 later
2112.08688 (2021-12)
Evidentiality-guided Generation for Knowledge-Intensive NLP Tasks
2401.03568 (2024-01)
Agent AI: Surveying the Horizons of Multimodal Interaction
2401.16979 (2024-01)
Re3val: Reinforced and Reranked Generative Retrieval
and 10 more not named here
check_answer 13 other papers
7 dated earlier, 6 later
2112.08688 (2021-12)
Evidentiality-guided Generation for Knowledge-Intensive NLP Tasks
2401.03568 (2024-01)
Agent AI: Surveying the Horizons of Multimodal Interaction
2401.16979 (2024-01)
Re3val: Reinforced and Reranked Generative Retrieval
and 10 more not named here
has_answer 11 other papers
6 dated earlier, 5 later
2112.08688 (2021-12)
Evidentiality-guided Generation for Knowledge-Intensive NLP Tasks
2401.03568 (2024-01)
Agent AI: Surveying the Horizons of Multimodal Interaction
2401.16979 (2024-01)
Re3val: Reinforced and Reranked Generative Retrieval
and 8 more not named here
normalize_answer 11 other papers
1 dated earlier, 1 the same month, 9 later
2308.07922 (2023-08)
RAVEN: In-Context Learning with Retrieval-Augmented Encoder-Decoder Language Models
2403.04797 (2024-03)
Found in the Middle: How Language Models Use Long Contexts Better via Plug-and-Play Positional Encoding
2406.02536 (2024-06)
Mitigate Position Bias in Large Language Models via Scaling a Single Dimension
and 8 more not named here
cross_attention_forward 10 other papers
8 dated earlier, 2 later · 1 only as an assembly brick
2108.06314 (2021-08)
A Dataset for Answering Time-Sensitive Questions
2112.08688 (2021-12)
Evidentiality-guided Generation for Knowledge-Intensive NLP Tasks
2206.15474 (2022-06)
Forecasting Future World Events with Neural Networks
and 7 more not named here
best_subspan_em 5 other papers
1 the same month, 4 later
2403.04797 (2024-03)
Found in the Middle: How Language Models Use Long Contexts Better via Plug-and-Play Positional Encoding
2406.02536 (2024-06)
Mitigate Position Bias in Large Language Models via Scaling a Single Dimension
2407.07071 (2024-07)
Lookback Lens: Detecting and Mitigating Contextual Hallucinations in Large Language Models Using Only Attention Maps
and 2 more not named here
att_mse_loss 1 other paper
1 later
2406.12382 (2024-06)
From Instance Training to Instruction Learning: Task Adapters Generation from Instructions
download_model_retry 1 other paper
1 later
2409.17515 (2024-09)
From News to Forecast: Integrating Event Analysis in LLM-Based Time Series Forecasting with Reflection
kd_ce_loss 1 other paper
1 later
2406.12382 (2024-06)
From Instance Training to Instruction Learning: Task Adapters Generation from Instructions
kd_mse_loss 1 other paper
1 later
2406.12382 (2024-06)
From Instance Training to Instruction Learning: Task Adapters Generation from Instructions

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

Retrieval-Augmented-Generation and Generation-Augmented-Generation have been proposed to enhance the knowledge required for question answering with Large Language Models (LLMs) by leveraging richer context. However, the former relies on external resources, and both require incorporating explicit documents into the context, which increases execution costs and susceptibility to noise data during inference. Recent works indicate that LLMs model rich knowledge, but it is often not effectively activated and awakened. Inspired by this, we propose a novel knowledge-augmented framework, $\textbf{Awakening-Augmented-Generation}$ (AAG), which mimics the human ability to answer questions using only thinking and recalling to compensate for knowledge gaps, thereby awaking relevant knowledge in LLMs without relying on external resources. AAG consists of two key components for awakening richer context. Explicit awakening fine-tunes a context generator to create a synthetic, compressed document that functions as symbolic context. Implicit awakening utilizes a hypernetwork to generate adapters based on the question and synthetic document, which are inserted into LLMs to serve as parameter context. Experimental results on three datasets demonstrate that AAG exhibits significant advantages in both open-domain and closed-book settings, as well as in out-of-distribution generalization. Our code will be available at \url{https://github.com/Xnhyacinth/IAG}.

For agents

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

get_harvested_code_for_paper("2403.15268")
get_code_for_paper("2403.15268")
have("2403.15268")

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

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

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

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

Connect an agent — have() is free.