When Long Helps Short: How Context Length in Supervised Fine-tuning Affects Behavior of Large Language Models

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Zheng, Yingming, Li, Hanqi, Yu, Kai, Chen, Lu
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916986775142400
author Zheng, Yingming
Li, Hanqi
Yu, Kai
Chen, Lu
author_facet Zheng, Yingming
Li, Hanqi
Yu, Kai
Chen, Lu
contents Large language models (LLMs) have achieved impressive performance across natural language processing (NLP) tasks. As real-world applications increasingly demand longer context windows, continued pretraining and supervised fine-tuning (SFT) on long-context data has become a common approach. While the effects of data length in continued pretraining have been extensively studied, their implications for SFT remain unclear. In this work, we systematically investigate how SFT data length influences LLM behavior on short-context tasks. Counterintuitively, we find that long-context SFT improves short-context performance, contrary to the commonly observed degradation from long-context pretraining. To uncover the underlying mechanisms of this phenomenon, we first decouple and analyze two key components, Multi-Head Attention (MHA) and Feed-Forward Network (FFN), and show that both independently benefit from long-context SFT. We further study their interaction and reveal a knowledge preference bias: long-context SFT promotes contextual knowledge, while short-context SFT favors parametric knowledge, making exclusive reliance on long-context SFT suboptimal. Finally, we demonstrate that hybrid training mitigates this bias, offering explainable guidance for fine-tuning LLMs.
format Preprint
id arxiv_https___arxiv_org_abs_2509_18762
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle When Long Helps Short: How Context Length in Supervised Fine-tuning Affects Behavior of Large Language Models
Zheng, Yingming
Li, Hanqi
Yu, Kai
Chen, Lu
Computation and Language
Artificial Intelligence
Large language models (LLMs) have achieved impressive performance across natural language processing (NLP) tasks. As real-world applications increasingly demand longer context windows, continued pretraining and supervised fine-tuning (SFT) on long-context data has become a common approach. While the effects of data length in continued pretraining have been extensively studied, their implications for SFT remain unclear. In this work, we systematically investigate how SFT data length influences LLM behavior on short-context tasks. Counterintuitively, we find that long-context SFT improves short-context performance, contrary to the commonly observed degradation from long-context pretraining. To uncover the underlying mechanisms of this phenomenon, we first decouple and analyze two key components, Multi-Head Attention (MHA) and Feed-Forward Network (FFN), and show that both independently benefit from long-context SFT. We further study their interaction and reveal a knowledge preference bias: long-context SFT promotes contextual knowledge, while short-context SFT favors parametric knowledge, making exclusive reliance on long-context SFT suboptimal. Finally, we demonstrate that hybrid training mitigates this bias, offering explainable guidance for fine-tuning LLMs.
title When Long Helps Short: How Context Length in Supervised Fine-tuning Affects Behavior of Large Language Models
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2509.18762