arXiv Science⌕ Search

arXiv · 2611.39144

ZenMargin: Margin-Refined Two-Limb FP4 Attention for Long-Context Language Models

Abstract

Long-context LLM serving faces a frustrating trade-off on 4-bit tensor cores: uniform 4-bit attention degrades long-range retrieval, while selective FP16 fallback forces systems to keep a full-precision KV cache and leaves decoding unaccelerated. We show that no FP16 backup is needed. Analyzing why 4-bit retrieval fails reveals two root causes: quantization error concentrates along a few dominant key directions, creating strongly correlated score errors, and retrieval heads operate with narrow score margins where modest 4-bit noise flips the winning key. ZenMargin resolves both directly in 4-bit precision. It smooths keys with causal centering and a lightweight Hadamard transform, then splits every KV pair into a primary 4-bit tensor and a residual 4-bit tensor under a shared scale (two-limb NVFP4). During prefill, an online margin gate reads only the primary 4-bit limb for 95-99% of blocks and refines the remaining 1-5% of near-peak blocks natively on FP4 tensor cores; during decoding, ZenMargin-Cache reuses the exact same split layout with zero repacking. Across six open LLMs on a single RTX 5090 (up to 128K context), ZenMargin is simultaneously fast, compact, and faithful. It reaches 867-967 TFLOPS on real activations (4.0-4.4x FlashAttention-2, 1.5-1.6x SageAttention2++, and faster than FlashInfer NVFP4), holds flat throughput across diffuse and code workloads with zero degradation cliff, and speeds up 64K time-to-first-token by up to 1.9x. By cutting KV-cache memory 44% below BF16 while reading mostly the primary 4-bit limb, ZenMargin-Cache lifts 32-layer single-GPU serving throughput 2.1-2.9x over FlashInfer BF16, and outperforms FlashInfer FP8, across both long-input and incremental-flush Long-CoT workloads. Without retraining, it matches BF16 accuracy across full 13-task RULER (up to 67.6K) and LongBench.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Yingwei Song, Tony Zhu, Kelly Peng, Yuan Gao, Huanrui Yang. 2026-11-28. ZenMargin: Margin-Refined Two-Limb FP4 Attention for Long-Context Language Models. https://arxiv.science/abs/2611.39144

Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite arXiv Science by Indiciae: BibTeX · RIS.

KEEP EXPLORING

Related papers

Conformal Meta-learners for Predictive Inference of Individual Treatment Effects

We investigate the problem of machine learning-based (ML) predictive inference on individual treatment effects (ITEs). Previous work has focused primarily on developing ML-based meta-learners that can provide point estimates of the conditional average treatment effect (CATE)---these are model-agnostic approaches for combining intermediate nuisance estimates to produce estimates of CATE. In this paper, we develop conformal meta-learners, a general framework for issuing predictive intervals for ITEs by applying the standard conformal prediction (CP) procedure on top of CATE meta-learners. We focus on a broad class of meta-learners based on two-stage pseudo-outcome regression and develop a stochastic ordering framework to study their validity. We show that inference with conformal meta-learners is marginally valid if their (pseudo-outcome) conformity scores stochastically dominate oracle conformity scores evaluated on the unobserved ITEs. Additionally, we prove that commonly used CATE meta-learners, such as the doubly-robust learner, satisfy a model- and distribution-free stochastic (or convex) dominance condition, making their inferences valid above a distribution-dependent coverage threshold, up to an exponentially small slack term. Whereas existing procedures conduct inference on nuisance parameters (i.e., potential outcomes) via weighted CP [1], conformal meta-learners enable direct inference on the target parameter (ITE). Experiments show that conformal meta-learners provide valid intervals with competitive efficiency while retaining the point estimation accuracy of CATE meta-learners.

cs.LG↗

Time Weaver: A Conditional Time Series Generation Model

Imagine generating a city's electricity demand pattern based on weather, the presence of an electric vehicle, and location, which could be used for capacity planning during a winter freeze. Such real-world time series are often enriched with paired heterogeneous contextual metadata (e.g., weather and location). Current approaches to time series generation often ignore this paired metadata. Additionally, the heterogeneity in metadata poses several practical challenges in adapting existing conditional generation approaches from the image, audio, and video domains to the time series domain. To address this gap, we introduce TIME WEAVER, a novel diffusion-based model that leverages the heterogeneous metadata in the form of categorical, continuous, and even time-variant variables to significantly improve time series generation. Additionally, we show that naive extensions of standard evaluation metrics from the image to the time series domain are insufficient. These metrics do not penalize conditional generation approaches for their poor specificity in reproducing the metadata-specific features in the generated time series. Thus, we innovate a novel evaluation metric that accurately captures the specificity of conditional generation and the realism of the generated time series. We show that TIME WEAVER outperforms state-of-the-art benchmarks, such as Generative Adversarial Networks (GANs), by up to 30% in downstream classification tasks on real-world energy, medical, air quality, and traffic datasets.

cs.LG↗

Energy-based Epistemic Uncertainty for Graph Neural Networks

In domains with interdependent data, such as graphs, quantifying the epistemic uncertainty of a Graph Neural Network (GNN) is challenging as uncertainty can arise at different structural scales. Existing techniques neglect this issue or only distinguish between structure-aware and structure-agnostic uncertainty without combining them into a single measure. We propose GEBM, an energy-based model (EBM) that provides high-quality uncertainty estimates by aggregating energy at different structural levels that naturally arise from graph diffusion. In contrast to logit-based EBMs, we provably induce an integrable density in the model's latent space by regularizing the energy function. We introduce an evidential interpretation of our EBM that significantly improves the predictive robustness of the GNN. Our framework is a simple and effective post hoc method applicable to any pre-trained GNN that is sensitive to various distribution shifts. It consistently achieves the best separation of in-distribution and out-of-distribution data on 6 out of 7 anomaly types while having the best average rank over shifts on \emph{all} datasets.

cs.LG↗