LPCD (Layer-Projected Coordinate Descent)

April 23, 2026 ยท View on GitHub

LPCD is a unified framework that extends post-training quantization beyond individual linear layers to larger Transformer submodules.

!!! abstract "Reference" Yuma Ichikawa, Yudai Fujimoto, and Akira Sakai, "LPCD: Unified Framework from Layer-Wise to Submodule Quantization," 2025. arXiv:2512.01546

Motivation

Standard layer-wise PTQ methods such as GPTQ optimize one linear layer at a time. QEP improves this by compensating for error propagation across layers, but the optimization target is still fundamentally layer-wise.

LPCD lifts the optimization target from a single layer to a submodule. This lets OneComp refine interactions inside attention and MLP blocks while keeping compatibility with existing layer-wise quantizers.

How LPCD Works

For each Transformer block, LPCD:

  1. Builds a baseline quantized block using the chosen quantizer, optionally with QEP
  2. Selects refineable submodules such as Q/K, V/O, up/down, or residual paths
  3. Optimizes a relaxed objective on the selected submodule group
  4. Projects the refined solution back through the underlying layer-wise quantizer

In OneComp, some residual-path refinements can use closed-form solvers, while larger submodule groups are refined with an iterative gradient-based solver.

Supported Targets

LPCDConfig enables the following submodule groups:

FlagTarget modulesTypical purpose
enable_qkq_proj, k_projRefine attention score computation
enable_vov_proj, o_projRefine value/output projection path
enable_udup_proj, down_projRefine MLP transformation
enable_residualo_proj, down_projFast residual-only refinement

By default, LPCDConfig() enables only enable_residual=True, which is the fastest and most practical starting point.

Usage

Basic LPCD with GPTQ + QEP

from onecomp import (
    CalibrationConfig,
    GPTQ,
    LPCDConfig,
    ModelConfig,
    Runner,
    setup_logger,
)

setup_logger()

model_config = ModelConfig(
    model_id="TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T",
    device="cuda:0",
)
gptq = GPTQ(wbits=3, groupsize=128)

lpcd_config = LPCDConfig(
    enable_residual=True,
    perccorr=0.5,
    percdamp=0.01,
    use_closed_form=True,
    device="cuda:0",
)

runner = Runner(
    model_config=model_config,
    quantizer=gptq,
    calibration_config=CalibrationConfig(max_length=512, num_calibration_samples=128),
    qep=True,
    lpcd=True,
    lpcd_config=lpcd_config,
)
runner.run()

Stronger LPCD Refinement

Enable more submodule groups when you want higher-quality refinement and can accept longer runtime:

lpcd_config = LPCDConfig(
    enable_qk=True,
    enable_vo=True,
    enable_ud=True,
    enable_residual=True,
    alt_steps=1,
    gd_steps=20,
    gd_base_lr=1e-4,
)

Relationship to QEP

LPCD and QEP are complementary:

  • QEP compensates for error propagation across sequential layers
  • LPCD refines the objective inside a submodule after moving beyond a purely layer-wise view

You can use LPCD without QEP, but the common setup in OneComp is GPTQ + QEP + LPCD.

!!! note When combining LPCD with QEP, use the architecture-aware QEP path (QEPConfig(general=False), which is also the default). The current LPCD implementation does not support QEPConfig(general=True).

Parameters

ParameterTypeDescriptionDefault
enable_qkboolJointly refine q_proj / k_projFalse
enable_voboolJointly refine v_proj / o_projFalse
enable_udboolJointly refine up_proj / down_projFalse
enable_residualboolRefine residual-path modules (o_proj, down_proj)True
alt_stepsintNumber of alternating coordinate-descent steps1
perccorrfloatCorrection strength for relaxed weights0.5
percdampfloatHessian damping ratio0.01
use_closed_formboolUse closed-form solvers where availableTrue
gd_stepsintGradient-descent steps per sub-problem20
gd_batch_sizeintEffective batch size for gradient accumulation16
gd_base_lrfloatBase learning rate for gradient solver1e-4
devicestrDevice for LPCD optimization"cuda:0"

Current Support

  • Supported architectures: Llama and Qwen3
  • LPCD runs through Runner(..., lpcd=True, lpcd_config=...)
  • LPCD is a refinement framework, not a standalone quantizer
  • The current examples and tests focus on GPTQ-based workflows

See also the examples guide and API reference for LPCDConfig.