SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2309.14717 · 2023

QA-LoRA: Quantization-Aware Low-Rank Adaptation of Large Language Models

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; 0 honoured the contract we drafted, 0 violated it and 5 have no contract verdict; 4 failures of our instrument; 3 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/2309.14717.json · badge: /api/ran/2309.14717.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
intel-analytics/BigDL community (classifier label)
classifier basis not recorded on the link
5 ran · 3 no recorded run
intel/ipex-llm community (classifier label)
classifier basis not recorded on the link
4 ran · 0 no recorded run
FunctionStatusWhere it lives
format_prompt_with_history Ran
ran on a synthesized input
intel-analytics/BigDL/python/llm/portable-zip/chat.py
code served (permissive licence) · get_code("559f1c3fe0502b84")
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 = {
    'input_str': 'What is the capital of France?',
    'chat_history': [
        ('Hello, how are you?', 'I am doing well, thank you for asking!'),
        ('Tell me a joke', 'Why did the scarecrow win an award? Because he was outstanding in his field!'),
    ]
}
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
get_package_version Ran
ran on a synthesized input
intel/ipex-llm/python/llm/src/ipex_llm/transformers/convert.py
code served (permissive licence) · get_code("482c7e5ca6778460")
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 subprocess

def get_package_version(package_name):
    result = subprocess.run(['pip', 'list'], capture_output=True, text=True)
    for line in result.stdout.splitlines():
        if line.startswith(package_name):
            return line.split()[1]
    return None

ARGS = {
    'package_name': 'torch'
}
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 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
get_stop_words_ids Ran
ran on a synthesized input
intel-analytics/BigDL/python/llm/portable-zip/chat.py
code served (permissive licence) · get_code("6bc05af3167f1f75")
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 2, dtype family int; 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 torch

class MockTokenizer:
    def __init__(self, chat_format='Qwen'):
        self.chat_format = chat_format
        if chat_format == 'Qwen':
            self.im_end_id = 151645
            self.im_start_id = 151644
            self.eod_id = 151643
        elif chat_format == 'Yi':
            self.vocab = {'<|im_end|>': [1, 2, 3]}
    
    def encode(self, text):
        if text == '<|im_end|>':
            return [1, 2, 3]
        return []

# Test with Qwen format
tokenizer_qwen = MockTokenizer('Qwen')

ARGS = {
    'chat_format': 'Qwen',
    'tokenizer': tokenizer_qwen
}
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 list, ndim 2, dtype family int — 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
is_lm_head Ran
ran on a synthesized input
intel/ipex-llm/python/llm/src/ipex_llm/transformers/convert.py
code served (permissive licence) · get_code("9c5cfec3eb2fe2b1")
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 bool, 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 as nn

class MockModelConfig:
    def __init__(self, vocab_size=None):
        self.vocab_size = vocab_size

ARGS = {
    'name': 'lm_head',
    'model_config': MockModelConfig(vocab_size=50257),
    'out_features': 50257
}
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 bool, 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
is_module_in_classes Ran
ran on a synthesized input
intel/ipex-llm/python/llm/src/ipex_llm/transformers/convert.py
code served (permissive licence) · get_code("4558cb77c58b03d2")
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 bool, 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 as nn

torch.manual_seed(0)

# Create a simple module to test
class SimpleModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

class AnotherModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = nn.Conv1d(4, 3, kernel_size=1)
    
    def forward(self, x):
        return self.conv(x)

# Create instances
module = SimpleModule()
classes = (nn.Linear, nn.Module)

ARGS = {
    "module": module,
    "classes": classes
}
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 bool, 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
repeat_kv Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
intel/ipex-llm/python/llm/src/ipex_llm/transformers/kv.py
code served (permissive licence) · get_code("d9150efc59718cbf")
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 4, dtype family float, shape (2, 6, 4, 5) 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)

# Construct arguments for repeat_kv function
# Parameters: hidden_states (torch.Tensor), n_rep (int)

# Create a small tensor with shape (batch, num_key_value_heads, seqlen, head_dim)
# Using distinct sizes: batch=2, num_key_value_heads=3, seqlen=4, head_dim=5
hidden_states = torch.randn(2, 3, 4, 5)

# n_rep is the number of times to repeat
n_rep = 2

ARGS = {
    "hidden_states": hidden_states,
    "n_rep": n_rep
}
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 4, dtype family float, shape (2, 6, 4, 5) — shape (2, 6, 4, 5) 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
slice1d Ran
ran; our contract draft was wrong, not the code
intel-analytics/BigDL/python/llm/portable-zip/kv_cache.py
code served (permissive licence) · get_code("2564045c0e65006b")
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 3, dtype family float, shape (2, 2, 3) 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 as nn

torch.manual_seed(0)

# The function slices a tensor along dimension 1
# x is indexed with [:, start:end, ...] so it should be a tensor
# start and end are integers for slicing

x = torch.randn(2, 4, 3)  # batch=2, dim1=4, dim2=3
start = 1
end = 3

ARGS = {
    "x": x,
    "start": start,
    "end": end,
}
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 3, dtype family float, shape (2, 2, 3) — shape (2, 2, 3) 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
slice2d Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
intel-analytics/BigDL/python/llm/portable-zip/kv_cache.py
code served (permissive licence) · get_code("19c86edfcb34276c")
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 4, dtype family float, shape (2, 4, 4, 6) 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 a 4D tensor: (batch=2, channels=4, height=8, width=6)
x = torch.randn(2, 4, 8, 6)

# Define start and end indices for slicing along dimension 2 (height)
start = 2
end = 6

ARGS = {
    "x": x,
    "start": start,
    "end": end,
}
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 4, dtype family float, shape (2, 4, 4, 6) — shape (2, 4, 4, 6) 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
slice3d Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
intel-analytics/BigDL/python/llm/portable-zip/kv_cache.py
code served (permissive licence) · get_code("8884022644d5af82")
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 5, dtype family float, shape (2, 4, 3, 3, 6) 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 as nn

torch.manual_seed(0)

# The function slices a tensor along dimension 3 (the 4th dimension)
# It expects x to be a multi-dimensional tensor
# start and end are integer indices for slicing

# Create a 5D tensor (batch, channels, depth, height, width)
# Using distinct sizes: batch=2, channels=4, depth=3, height=5, width=6
x = torch.randn(2, 4, 3, 5, 6)

# Define start and end indices for slicing dimension 3
start = 1
end = 4

ARGS = {
    "x": x,
    "start": start,
    "end": end
}
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 5, dtype family float, shape (2, 4, 3, 3, 6) — shape (2, 4, 3, 3, 6) 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
greedy_generate Not yet run
unverified (harvested, no recorded run)
intel-analytics/BigDL/python/llm/portable-zip/chat.py
code served (permissive licence) · get_code("20c7e7fb2d9f76a2")
How it ran

no invocation recorded.

load_model_base Not yet run
unverified (harvested, no recorded run)
intel-analytics/BigDL/python/llm/src/ipex_llm/serving/fastchat/bigdl_llm_model.py
code served (permissive licence) · get_code("af66d016e3041df1")
How it ran

no invocation recorded.

load_model_chatglm Not yet run
unverified (harvested, no recorded run)
intel-analytics/BigDL/python/llm/src/ipex_llm/serving/fastchat/bigdl_llm_model.py
code served (permissive licence) · get_code("a87af6ee0d3f977b")
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, 4 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 4 the same month, 4 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
repeat_kv 243 other papers
8 dated earlier, 3 the same month, 230 later, 2 undated · 22 only as an assembly brick
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
2203.08913 (2022-03)
Memorizing Transformers
2305.17888 (2023-05)
LLM-QAT: Data-Free Quantization Aware Training for Large Language Models
and 240 more not named here
slice1d 4 other papers
1 the same month, 3 later · 1 only as an assembly brick
2309.17453 (2023-09)
Efficient Streaming Language Models with Attention Sinks
2407.18121 (2024-07)
Efficient Inference of Vision Instruction-Following Models with Elastic Cache
2412.03409 (2024-12)
PrefixKV: Adaptive Prefix KV Cache is What Vision Instruction-Following Models Need for Efficient Generation
and 1 more not named here
slice2d 4 other papers
1 the same month, 3 later · 1 only as an assembly brick
2309.17453 (2023-09)
Efficient Streaming Language Models with Attention Sinks
2407.18121 (2024-07)
Efficient Inference of Vision Instruction-Following Models with Elastic Cache
2412.03409 (2024-12)
PrefixKV: Adaptive Prefix KV Cache is What Vision Instruction-Following Models Need for Efficient Generation
and 1 more not named here
slice3d 4 other papers
1 the same month, 3 later · 1 only as an assembly brick
2309.17453 (2023-09)
Efficient Streaming Language Models with Attention Sinks
2407.18121 (2024-07)
Efficient Inference of Vision Instruction-Following Models with Elastic Cache
2412.03409 (2024-12)
PrefixKV: Adaptive Prefix KV Cache is What Vision Instruction-Following Models Need for Efficient Generation
and 1 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

Recently years have witnessed a rapid development of large language models (LLMs). Despite the strong ability in many language-understanding tasks, the heavy computational burden largely restricts the application of LLMs especially when one needs to deploy them onto edge devices. In this paper, we propose a quantization-aware low-rank adaptation (QA-LoRA) algorithm. The motivation lies in the imbalanced degrees of freedom of quantization and adaptation, and the solution is to use group-wise operators which increase the degree of freedom of quantization meanwhile decreasing that of adaptation. QA-LoRA is easily implemented with a few lines of code, and it equips the original LoRA with two-fold abilities: (i) during fine-tuning, the LLM's weights are quantized (e.g., into INT4) to reduce time and memory usage; (ii) after fine-tuning, the LLM and auxiliary weights are naturally integrated into a quantized model without loss of accuracy. We apply QA-LoRA to the LLaMA and LLaMA2 model families and validate its effectiveness in different fine-tuning datasets and downstream scenarios. Code will be made available at https://github.com/yuhuixu1993/qa-lora.

For agents

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

get_harvested_code_for_paper("2309.14717")
get_code_for_paper("2309.14717")
have("2309.14717")

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

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

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

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

Connect an agent — have() is free.