SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2404.15159 · 2024

MixLoRA: Enhancing Large Language Models Fine-Tuning with LoRA-based Mixture of Experts

arXiv · PDF · Open in the Atlas

Code that ran

6 of 11 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, 1 violated it and 0 have no contract verdict; 4 failures of our instrument; 5 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/2404.15159.json · badge: /api/ran/2404.15159.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
mikecovlee/mLoRA canonical (classifier label)
classifier basis: census
4 ran · 3 no recorded run
TUDB-Labs/MixLoRA canonical (classifier label)
classifier basis: census
2 ran · 2 no recorded run
FunctionStatusWhere it lives
apply_rotary_pos_emb Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mikecovlee/mLoRA/mlora/models/modeling_chatglm.py
code served (permissive licence) · get_code("0a82ce127c214e4b")
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; 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

torch.manual_seed(0)

# Analyze the function:
# - x: shape (b, np, sq, _) where _ is the last dimension
# - rope_cache: shape (..., rot_dim//2, 2) where rot_dim = rope_cache.shape[-2] * 2
# - The function reshapes x to (b, np, sq, rot_dim//2, 2)
# - rope_cache is reshaped to (-1, 1, sq, rot_dim//2, 2)
# - x_pass = x[..., rot_dim:], so x must have more dims than rot_dim

# Let's construct:
# rot_dim//2 = 2, so rot_dim = 4
# x shape: (b=2, np=3, sq=5, hidden_dim=8)  where first 4 dims are rotated, last 4 pass through
# rope_cache shape: (seq_len, rot_dim//2, 2) = (5, 2, 2)

b = 2
np = 3
sq = 5
rot_dim = 4
hidden_dim = 8

x = torch.randn(b, np, sq, hidden_dim)
rope_cache = torch.randn(sq, rot_dim // 2, 2)

ARGS = {
    "x": x,
    "rope_cache": rope_cache,
}
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 — no output shape is stated: observe_signature.py could not observe it (import:OSError)
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
dequantize_module_weight Ran
ran, honoured the contract we drafted
TUDB-Labs/MixLoRA/mixlora/lora_linear.py
code served (permissive licence) · get_code("5b93021aaf3e8b4c")
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 Parameter, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal module that satisfies the function's usage patterns
class MinimalQuantModule(nn.Module):
    def __init__(self):
        super().__init__()
        # Create a regular parameter (not quantized)
        self.weight = nn.Parameter(torch.randn(4, 3))
    
    def forward(self, x):
        return x @ self.weight.t()

# Create another variant with W_q attribute for the first branch
class ModuleWithWQ(nn.Module):
    def __init__(self):
        super().__init__()
        self.W_q = nn.Parameter(torch.randn(4, 3))
        self.weight = nn.Parameter(torch.randn(4, 3))
    
    def dequantize(self):
        # Return a dequantized version
        return nn.Parameter(torch.randn(4, 3))
    
    def forward(self, x):
        return x @ self.weight.t()

# Test with a simple module
module = MinimalQuantModule()

ARGS = {
    'module': module
}
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 Parameter, ndim 2, dtype family float — no output shape is stated: observe_signature.py recorded Tensor ndim 2, which disagrees with the fixture run
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_package_available Ran
ran, violated the contract we drafted
TUDB-Labs/MixLoRA/mixlora/utils.py
code served (permissive licence) · get_code("45a78242fc74dcd9")
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 importlib.util
import importlib.metadata
import logging
from typing import Optional, Tuple, Union
from packaging import version

# Set up logging to avoid warnings
logging.basicConfig(level=logging.DEBUG)

# Test case 1: Check if a common package exists without version check
ARGS = {
    "pkg_name": "sys",
    "pkg_version": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
packaging — 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
logits_process Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mikecovlee/mLoRA/mlora/generator.py
code served (permissive licence) · get_code("22f4910fcb84030d")
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 1, dtype family int, shape (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 logging

torch.manual_seed(0)

# Create small tensors for testing
batch_size = 2
vocab_size = 4

# probs: logits tensor of shape (batch_size, vocab_size)
probs = torch.randn(batch_size, vocab_size)

# prev_tokens: tensor of previously generated tokens, shape (batch_size, some_context_length)
prev_tokens = torch.tensor([[0, 1], [2, 3]])

ARGS = {
    "probs": probs,
    "prev_tokens": prev_tokens,
    "temperature": 1.0,
    "top_p": 0.9,
    "top_k": 50,
    "do_sample": True,
    "repetition_penalty": 1.1,
    "renormalize_logits": True,
}
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 1, dtype family int, shape (2,) — shape (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
split_tensor_along_last_dim Ran
ran; our contract draft was wrong, not the code
mikecovlee/mLoRA/mlora/models/modeling_chatglm.py
code served (permissive licence) · get_code("9281708eb4cf9161")
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, ndim 4, 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 torch

torch.manual_seed(0)

# Create a small tensor with last dimension divisible by num_partitions
# Shape: (2, 3, 4) - batch=2, seq=3, features=4
tensor = torch.randn(2, 3, 4)

# Number of partitions - must evenly divide the last dimension
num_partitions = 2

# Boolean flag for whether to make chunks contiguous
contiguous_split_chunks = False

ARGS = {
    "tensor": tensor,
    "num_partitions": num_partitions,
    "contiguous_split_chunks": contiguous_split_chunks,
}
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, ndim 4, dtype family float — a tuple 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
swiglu Ran
ran; our contract draft was wrong, not the code
mikecovlee/mLoRA/mlora/models/modeling_chatglm.py
code served (permissive licence) · get_code("7f59a97bd91fdef5")
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, 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 torch.nn.functional as F

torch.manual_seed(0)

# The function swiglu takes a tensor x, chunks it into 2 pieces along the last dimension,
# applies SiLU to the first chunk, and multiplies by the second chunk.
# It expects x to have an even last dimension so it can be split in half.

# Create a small tensor with batch size 2 and last dimension 4 (even number for chunking)
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
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, 2) — shape (2, 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
apply_partial_rotary_emb Not yet run
unverified (harvested, no recorded run)
mikecovlee/mLoRA/mlora/models/modeling_phi.py
code served (permissive licence) · get_code("602bfa722a261a61")
How it ran

no invocation recorded.

dequantize_bnb_weight Not yet run
unverified (harvested, no recorded run)
TUDB-Labs/MixLoRA/mixlora/lora_linear.py
code served (permissive licence) · get_code("3ce1a041a1abc119")
How it ran

no invocation recorded.

load_adapter_weights Not yet run
unverified (harvested, no recorded run)
TUDB-Labs/MixLoRA/mixlora/model.py
code served (permissive licence) · get_code("ae2f069de9355ede")
How it ran

no invocation recorded.

load_dataset Not yet run
unverified (harvested, no recorded run)
mikecovlee/mLoRA/mlora/dispatcher.py
code served (permissive licence) · get_code("949439173c840737")
How it ran

no invocation recorded.

query_yes_no Not yet run
unverified (harvested, no recorded run)
mikecovlee/mLoRA/mlora.py
code served (permissive licence) · get_code("4cd248daacbead2f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 10 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
split_tensor_along_last_dim 8 other papers
4 dated earlier, 4 later
2307.13528 (2023-07)
FacTool: Factuality Detection in Generative AI -- A Tool Augmented Framework for Multi-Task and Multi-Domain Scenarios
2311.18445 (2023-11)
VTimeLLM: Empower LLM to Grasp Video Moments
2401.18058 (2024-01)
LongAlign: A Recipe for Long Context Alignment of Large Language Models
and 5 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-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

Fine-tuning Large Language Models (LLMs) is a common practice to adapt pre-trained models for specific applications. While methods like LoRA have effectively addressed GPU memory constraints during fine-tuning, their performance often falls short, especially in multi-task scenarios. In contrast, Mixture-of-Expert (MoE) models, such as Mixtral 8x7B, demonstrate remarkable performance in multi-task learning scenarios while maintaining a reduced parameter count. However, the resource requirements of these MoEs remain challenging, particularly for consumer-grade GPUs with less than 24GB memory. To tackle these challenges, we propose MixLoRA, an approach to construct a resource-efficient sparse MoE model based on LoRA. MixLoRA inserts multiple LoRA-based experts within the feed-forward network block of a frozen pre-trained dense model and employs a commonly used top-k router. Unlike other LoRA-based MoE methods, MixLoRA enhances model performance by utilizing independent attention-layer LoRA adapters. Additionally, an auxiliary load balance loss is employed to address the imbalance problem of the router. Our evaluations show that MixLoRA improves about 9% accuracy compared to state-of-the-art PEFT methods in multi-task learning scenarios. We also propose a new high-throughput framework to alleviate the computation and memory bottlenecks during the training and inference of MOE models. This framework reduces GPU memory consumption by 40% and token computation latency by 30% during both training and inference.

For agents

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

get_harvested_code_for_paper("2404.15159")
get_code_for_paper("2404.15159")
have("2404.15159")

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

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

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

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

Connect an agent — have() is free.