SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.21289 · ICLR · 2025

LoFT: Low-Rank Adaptation That Behaves Like Full Fine-Tuning

Samuel Horváth, Stefanos Laskaridis, Martin Takáč, Nurbek Tastan, Karthik Nandakumar

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 1 violated it and 1 has no contract verdict; 5 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/2505.21289.json · badge: /api/ran/2505.21289.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
tnurbek/loft community
Papers with Code archive
7 ran · 2 no recorded run
FunctionStatusWhere it lives
LoFTAdamW Ran
ran on a synthesized input · constructed an object; no result was computed
tnurbek/loft/loft_optim/optimizer.py
code served (permissive licence) · get_code("c6158005ab8589b5")
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, LoFTAdamW: 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
from torch.optim import Optimizer
from collections import defaultdict

torch.manual_seed(0)

# Create a minimal model with LoRA parameters
class SimpleLoRAModel(nn.Module):
    def __init__(self):
        super().__init__()
        # Create LoRA A and B parameters
        self.lora_A_weight = nn.Parameter(torch.randn(3, 4))
        self.lora_B_weight = nn.Parameter(torch.randn(4, 3))
        # Regular parameter
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

# Instantiate the model
model = SimpleLoRAModel()

# Create parameter list for optimizer
params = list(model.parameters())

# Create ARGS dictionary with all required parameters
ARGS = {
    'params': params,
    'lr': 0.001,
    'betas': (0.9, 0.999),
    'eps': 0.0001,
    'weight_decay': 0.01,
    'amsgrad': False,
    'lora_A_name': 'lora_A',
    'lora_B_name': 'lora_B',
    'alternate_update': True,
    'rescale_grads': True,
    'reproject_momentum': True,
    'reproject_second_moment': True,
    'model': model,
}
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 LoFTAdamW — 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 LoFTAdamW 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
compute_full_grad_from_proj Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tnurbek/loft/loft_optim/optimizer.py
code served (permissive licence) · get_code("9a2ec6a670678efb")
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 2, dtype family float, shape (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 numpy as np

torch.manual_seed(0)

# The function performs matrix multiplication with proj_grad and other_p
# When lora_A is True: other_p @ proj_grad
# When lora_A is False: proj_grad @ other_p
# So proj_grad and other_p need to be matrices compatible for these operations

# Let's use distinct dimensions:
# proj_grad: (4, 3) - projection gradient
# other_p: (5, 4) - other parameter
# This way when lora_A=True: (5, 4) @ (4, 3) = (5, 3)
# When lora_A=False: (4, 3) @ (5, 4) would fail, so let's adjust

# Better approach:
# proj_grad: (4, 3)
# other_p: (3, 5)
# When lora_A=True: other_p @ proj_grad = (3, 5) @ (4, 3) would fail
# When lora_A=False: proj_grad @ other_p = (4, 3) @ (3, 5) = (4, 5)

# Let me reconsider:
# proj_grad: (4, 3)
# other_p: (3, 5)
# When lora_A=True: other_p @ proj_grad = (3, 5) @ (4, 3) - incompatible dims
# When lora_A=False: proj_grad @ other_p = (4, 3) @ (3, 5) = (4, 5) - works

# For lora_A=True case to work:
# other_p @ proj_grad requires other_p shape (m, n) and proj_grad shape (n, k)
# Let's use:
# proj_grad: (3, 4)
# other_p: (5, 3)
# When lora_A=True: (5, 3) @ (3, 4) = (5, 4) ✓
# When lora_A=False: (3, 4) @ (5, 3) - incompatible

# To make both work with the same setup:
# proj_grad: (3, 4)
# other_p: (4, 5)
# When lora_A=True: (4, 5) @ (3, 4) - incompatible
# When lora_A=False: (3, 4) @ (4, 5) = (3, 5) ✓

# Use case 1: lora_A=False
proj_grad = torch.randn(2, 4)
other_p = torch.randn(4, 3)
lora_A = False

ARGS = {
    "proj_grad": proj_grad,
    "other_p": other_p,
    "lora_A": lora_A,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 3) — shape (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
compute_mom_sq_from_row_prod_and_transformation Ran
ran; our contract draft was wrong, not the code
tnurbek/loft/loft_optim/optimizer.py
code served (permissive licence) · get_code("3eb4c0c3fbdc880d")
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 2, dtype family float, shape (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

torch.manual_seed(0)

# Parameters for the function
n = 2  # batch size
r = 4  # intermediate dimension
d = 3  # output dimension

# row_prod: Tensor of shape (n, r, r)
row_prod = torch.randn(n, r, r)

# transformation: Tensor of shape (r, d)
transformation = torch.randn(r, d)

ARGS = {
    "row_prod": row_prod,
    "transformation": transformation,
}
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 2, dtype family float, shape (2, 3) — shape (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
do_update_ Ran
ran, violated the contract we drafted
tnurbek/loft/loft_optim/optimizer.py
code served (permissive licence) · get_code("8a7a0a901ee57322")
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

torch.manual_seed(0)

class MockOptimizer:
    def __init__(self, lora_A_name, lora_B_name, alternate_update, update_A):
        self.lora_A_name = lora_A_name
        self.lora_B_name = lora_B_name
        self.alternate_update = alternate_update
        self.update_A = update_A

optimizer = MockOptimizer(
    lora_A_name="lora_A",
    lora_B_name="lora_B",
    alternate_update=True,
    update_A=True
)

p_name = "module.lora_B.weight"

ARGS = {
    "optimizer": optimizer,
    "p_name": p_name
}
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
get_reprojected_momentum Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tnurbek/loft/loft_optim/optimizer.py
code served (permissive licence) · get_code("a5311761d3c05643")
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 2, dtype family float, shape (4, 2) 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 numpy as np

torch.manual_seed(0)

# R is used in matrix multiplication with exp_avg
# exp_avg is used in matrix multiplication with R
# lora_A is a boolean flag that determines the order of multiplication

# Create small matrices with distinct dimensions for clarity
# R will be 4x3, exp_avg will be 3x2 so we can distinguish dimensions
R = torch.randn(4, 3)
exp_avg = torch.randn(3, 2)
lora_A = True

ARGS = {
    "R": R,
    "exp_avg": exp_avg,
    "lora_A": lora_A
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (4, 2) — shape (4, 2) 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
get_reprojected_second_moment Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tnurbek/loft/loft_optim/optimizer.py
code served (permissive licence) · get_code("26e5fc043cc0c851")
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, 3, 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 numpy as np

torch.manual_seed(0)

# Analyze the function:
# - R: used with .T (transpose) and indexing [None, :, :] (add batch dim)
# - row_prod: used in matrix multiplication
# - lora_A: boolean flag

# R needs to be a 2D tensor (matrix) that can be transposed
# row_prod needs to be a 3D tensor (batch, height, width) for @ operations
# lora_A is a boolean

# Construct tensors with distinct dimensions for clarity:
# R: 4x3 matrix
# row_prod: batch of 4x4 matrices (batch=2, spatial dims=4x4)

R = torch.randn(4, 3)
row_prod = torch.randn(2, 4, 4)
lora_A = True

ARGS = {
    "R": R,
    "row_prod": row_prod,
    "lora_A": lora_A
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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, 3, 3) — shape (2, 3, 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
rescale_gradients Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tnurbek/loft/loft_optim/optimizer.py
code served (permissive licence) · get_code("5193d9d48000c46b")
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 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

torch.manual_seed(0)

# Create small test tensors
# grad: gradient tensor, shape should work with matrix operations
# other_p: parameter tensor used in @ operations
# For lora_A=True case: other_p.T @ other_p, so other_p should be (m, n)
# For lora_A=False case: other_p @ other_p.T, so other_p should be (m, n)

grad = torch.randn(3, 4)  # gradient matrix
other_p = torch.randn(5, 3)  # parameter matrix - distinct dimensions
lora_A = True  # boolean flag

ARGS = {
    "grad": grad,
    "other_p": other_p,
    "lora_A": lora_A
}
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 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
compute_proj_update Not yet run
unverified (harvested, no recorded run)
tnurbek/loft/loft_optim/optimizer.py
code served (permissive licence) · get_code("4c04bcf45359e67c")
How it ran

no invocation recorded.

get_mom_reprojection Not yet run
unverified (harvested, no recorded run)
tnurbek/loft/loft_optim/optimizer.py
code served (permissive licence) · get_code("9a8d4f5881387ef2")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 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 9 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-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

Large pre-trained models are commonly adapted to downstream tasks using parameter-efficient fine-tuning methods such as Low-Rank Adaptation (LoRA), which injects small trainable low-rank matrices instead of updating all weights. While LoRA dramatically reduces trainable parameters with little overhead, it can still underperform full fine-tuning in accuracy and often converges more slowly. We introduce LoFT, a novel low-rank adaptation method that behaves like full fine-tuning by aligning the optimizer's internal dynamics with those of updating all model weights. LoFT not only learns weight updates in a low-rank subspace (like LoRA) but also properly projects the optimizer's first and second moments (Adam's momentum and variance) into the same subspace, mirroring full-model updates. By aligning the low-rank update itself with the full update, LoFT eliminates the need for tuning extra hyperparameters, e.g., the LoRA scaling factor α. Empirically, this approach substantially narrows the performance gap between adapter-based tuning and full fine-tuning and consistently outperforms standard LoRA-style methods, all without increasing inference cost. The code is available at https://github.com/tnurbek/loft.

For agents

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

get_harvested_code_for_paper("2505.21289")
get_code_for_paper("2505.21289")
have("2505.21289")

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

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

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

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

Connect an agent — have() is free.