SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2510.27527 · ICML · 2025

TetraJet-v2: Accurate NVFP4 Training for Large Language Models with Oscillation Suppression and Outlier Control

Jun Zhu, Jianfei Chen, Yifan Liu, Martin Rapp, Pengle Zhang, Michael Beyer, Yuxiang Chen, Xiaoming Xu

arXiv · PDF · Open in the Atlas

Code that ran

6 of 15 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (6 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 0 failures of our instrument; 9 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/2510.27527.json · badge: /api/ran/2510.27527.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
thu-ml/TetraJet-v2-NVFP4Training community
Papers with Code archive
6 ran · 9 no recorded run
FunctionStatusWhere it lives
NVFP4_Outlier_Selection_Config Ran
ran on a synthesized input · constructed an object; no result was computed
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("fb15d600c2b76528")
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, NVFP4_Outlier_Selection_Config: 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.

from dataclasses import dataclass

@dataclass
class NVFP4_Outlier_Selection_Config:
    outlier_fp8_matmul: bool = True
    X_chan_select: bool = False
    X_chan_select_bwd: bool = False
    X_top_channels_ratio: float = 0.02
    X_chan_select_mode: str = 'norm2_record'
    X_chan_record_start_iter: int = 1
    X_chan_record_iters: int = 10

ARGS = {
    'outlier_fp8_matmul': True,
    'X_chan_select': False,
    'X_chan_select_bwd': False,
    'X_top_channels_ratio': 0.02,
    'X_chan_select_mode': 'norm2_record',
    'X_chan_record_start_iter': 1,
    'X_chan_record_iters': 10,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
omegaconf — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NVFP4_Outlier_Selection_Config — 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 NVFP4_Outlier_Selection_Config 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
NVFP4_QuantizerConfig Ran
ran on a synthesized input · constructed an object; no result was computed
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("1f2a77a5e466301a")
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, NVFP4_QuantizerConfig: 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 numpy as np
from dataclasses import dataclass, field
from typing import Optional

torch.manual_seed(0)

# Define ARGS dict mapping every parameter of NVFP4_QuantizerConfig
ARGS = {
    "enable_nvfp4_training": True,
    "enable_qweight_buffer_when_real_quantize": False,
    "inner_blocksize": 16,
    "outer_blocksize": 128,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, omegaconf, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type NVFP4_QuantizerConfig — 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 NVFP4_QuantizerConfig 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
NVFP4_TetraJetv2_MatMulFunc_BwdAllRHT16SQ_Padding128 Ran
ran on a synthesized input · constructed an object; no result was computed
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("8eb1e855106805d6")
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, NVFP4_TetraJetv2_MatMulFunc_BwdAllRHT16SQ_Padding128: the run constructed the object and did not call it, so no result was computed. 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 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 types as _types

torch.manual_seed(0)

# Mock tetrajetv2 module with required functions
def mock_quant_fp4_dequant_trans_rh_requant_fused(tensor):
    """Mock quantization function returning (q, os, is, dq_t_rh, dq_t_rh_os, dq_t_rh_is)"""
    batch_size = tensor.shape[0]
    feat_size = tensor.shape[1]
    q = torch.randint(0, 256, (batch_size, feat_size), dtype=torch.uint8)
    os = torch.randn(batch_size, 1)
    is_val = torch.randn(1, feat_size)
    dq_t_rh = torch.randn(feat_size, batch_size)
    dq_t_rh_os = torch.randn(feat_size, 1)
    dq_t_rh_is = torch.randn(1, batch_size)
    return q, os, is_val, dq_t_rh, dq_t_rh_os, dq_t_rh_is

def mock_fp4_gemm(x_q, w_q, x_is, w_is, x_os, w_os):
    """Mock GEMM returning result tensor"""
    batch_size = x_q.shape[0]
    out_features = w_q.shape[0]
    return torch.randn(batch_size, out_features)

def mock_rh_quant_fp4_trans_rh_requant_fused(dy, seed_dx, seed_dw):
    """Mock quantization for gradient returning (rhq3, rhq3_os, rhq3_is, dy_t_rhq5, dy_t_rhq5_os, dy_t_rhq5_is)"""
    batch_size = dy.shape[0]
    feat_size = dy.shape[1]
    dy_rhq3 = torch.randint(0, 256, (batch_size, feat_size), dtype=torch.uint8)
    dy_rhq3_os = torch.randn(batch_size, 1)
    dy_rhq3_is = torch.randn(1, feat_size)
    dy_t_rhq5 = torch.randn(feat_size, batch_size)
    dy_t_rhq5_os = torch.randn(feat_size, 1)
    dy_t_rhq5_is = torch.randn(1, batch_size)
    return dy_rhq3, dy_rhq3_os, dy_rhq3_is, dy_t_rhq5, dy_t_rhq5_os, dy_t_rhq5_is

# Helper functions
def validate_and_pad(x, w, alignment=128):
    """Validate and pad tensors"""
    batch_size = x.shape[0]
    in_features = x.shape[1]
    x_shape = x.shape
    padded_size = ((in_features + alignment - 1) // alignment) * alignment
    pad_len = padded_size - in_features
    if pad_len > 0:
        x = torch.nn.functional.pad(x, (0, pad_len))
    return x, pad_len, x_shape

def unpad_and_reshape(tensor, pad_len, x_shape, out_features=None):
    """Remove padding and reshape tensor"""
    if pad_len > 0:
        tensor = tensor[:, :-pad_len] if tensor.shape[1] > pad_len else tensor
    if out_features is not None:
        return tensor.view(x_shape[0], out_features)
    return tensor.view(x_shape[0], -1)

def pad_gradient(dy, pad_len):
    """Pad gradient tensor"""
    if pad_len > 0:
        dy = torch.nn.functional.pad(dy, (0, pad_len))
    return dy

# Create tetrajetv2 mock module
tetrajetv2 = _types.SimpleNamespace(
    quant_fp4_dequant_trans_rh_requant_fused=mock_quant_fp4_dequant_trans_rh_requant_fused,
    fp4_gemm=mock_fp4_gemm,
    rh_quant_fp4_trans_rh_requant_fused=mock_rh_quant_fp4_trans_rh_requant_fused,
)

# Create input tensors
x = torch.randn(2, 4, dtype=torch.float32)  # batch=2, features=4
w = torch.randn(3, 4, dtype=torch.float32)  # out_features=3, in_features=4

# Create ARGS dict with context object for forward
ARGS = {
    'x': x,
    'w': w,
}
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 NVFP4_TetraJetv2_MatMulFunc_BwdAllRHT16SQ_Padding128 — 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 NVFP4_TetraJetv2_MatMulFunc_BwdAllRHT16SQ_Padding128 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
OLMoConfigurationError Ran
ran on a synthesized input · constructed an object; no result was computed
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("65ce9d1406995870")
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, OLMoConfigurationError: 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

torch.manual_seed(0)

class OLMoError(Exception):
    """
    Base class for all custom OLMo exceptions.
    """
    pass

class OLMoConfigurationError(OLMoError):
    """
    An error with a configuration file.
    """
    pass

ARGS = {}
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 OLMoConfigurationError — 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 OLMoConfigurationError 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
OLMoError Ran
ran on a synthesized input · constructed an object; no result was computed
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("cc2604f080112c77")
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, OLMoError: 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

# OLMoError is a custom Exception class
# The __init__ method is inherited from Exception
# Exception can take optional arguments (typically a message)

# Since this is just an Exception subclass with no additional parameters,
# we construct it with minimal valid arguments

ARGS = {
    # Exception accepts an optional message as its first positional argument
    # We can pass nothing (uses default) or pass a message string
}
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 OLMoError — 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 OLMoError 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
OscillationPerturb_Config Ran
ran on a synthesized input · constructed an object; no result was computed
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("99ef28b8606875c6")
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, OscillationPerturb_Config: 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
from torch import nn
from omegaconf import OmegaConf as om

torch.manual_seed(0)

ARGS = {
    'apply_perturb': True,
    'perturb_start_iter': 100,
    'perturb_period': 500,
    'detect_type': 'distance_ratio',
    'detect_BinEdge_thrd': 0.5,
    'detect_DistRatio_iters': 25,
    'detect_DistRatio_thrd': 8.0,
    'detect_DistRatio_sample_percent': 5.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
omegaconf, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OscillationPerturb_Config — 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 OscillationPerturb_Config 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
BaseConfig Not yet run
unverified (harvested, no recorded run)
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("60cc4ff441d3ab2c")
How it ran

no invocation recorded.

NVFP4_Linear_RealQuant_WeightQuantOnline Not yet run
unverified (harvested, no recorded run)
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("ff027b8d502fb52d")
How it ran

no invocation recorded.

NVFP4_mix_MXFP8_Linear_RealQuant_WeightQuantOnline Not yet run
unverified (harvested, no recorded run)
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("c5d24254996b4107")
How it ran

no invocation recorded.

NVFP4_mix_MXFP8_TetraJetv2_MatMulFunc_BwdAllRHT16SQ_Padding128 Not yet run
unverified (harvested, no recorded run)
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("8d426745e6c66d1c")
How it ran

no invocation recorded.

check_mix_channel_done Not yet run
unverified (harvested, no recorded run)
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("eacce6861a053fd0")
How it ran

no invocation recorded.

check_quant_linear Not yet run
unverified (harvested, no recorded run)
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("1717205ffec8f0af")
How it ran

no invocation recorded.

check_quant_mix_linear Not yet run
unverified (harvested, no recorded run)
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("1fa4156825dcda41")
How it ran

no invocation recorded.

fp4_elements_centralize_DistRatio Not yet run
unverified (harvested, no recorded run)
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("0f1fb3f207b264a2")
How it ran

no invocation recorded.

query_quant_risk_ratio Not yet run
unverified (harvested, no recorded run)
thu-ml/TetraJet-v2-NVFP4Training/olmo2-training/olmo/quantization_real/oscillation_reset.py
code served (permissive licence) · get_code("5f980dcdfadd500b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 15 samples lifted from this paper's linked repositories, 15 carry a function identity and 0 do not. Of the 15 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 0 later) and 13 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
OLMoConfigurationError
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2410.21676 (2024-10)
How Does Critical Batch Size Scale in Pre-training?
OLMoError
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2410.21676 (2024-10)
How Does Critical Batch Size Scale in Pre-training?

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 Language Models (LLMs) training is prohibitively expensive, driving interest in lowprecision fully-quantized training (FQT). While novel 4-bit formats like NVFP4 offer substantial efficiency gains, achieving near-lossless training at such low precision remains challenging. We introduce TetraJet-v2, an end-to-end 4-bit FQT method that leverages NVFP4 for activations, weights and gradients in all linear layers. We identify two critical issues hindering low-precision LLM training: weight oscillation and outliers. To address them, we propose: 1) an unbiased double-block quantization method for NVFP4 linear layers with practically optimal convergence in LLM training, 2) OsciReset, the first effective algorithm to suppress LLMs' weight oscillation bottleneck, and 3) OutControl, a mix-precision algorithm to retain outlier accuracy. TetraJet-v2 outperforms prior methods on FP4 pre-training for LLMs across models up to 370M parameters trained up to 212B tokens, reducing the performance gap to BF16 by an average of 51.3% while enabling 1.67× end-to-end speedup over FP8. 1

For agents

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

get_harvested_code_for_paper("2510.27527")
get_code_for_paper("2510.27527")
have("2510.27527")

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

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

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

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

Connect an agent — have() is free.