E pi C o D e: Boosting Model Performance Beyond Training with Extrapolation and Contrastive Decoding (2025)

Abstract: The remarkable performance of Large language models (LLMs) relies heavily on the availability of abundant high-quality training data. However, the high cost of acquiring annotated data often prevents models from obtaining capabilities to tackle downstream tasks. In this paper, we introduce a novel method, EpiCoDe that boosts model performance in data-scarcity scenarios without extra training. We first employ model extrapolation to enhance a finetuned model with its inferior version, and then adopt contrastive decoding to further reduce predicted errors, by comparing the logit scores given by the extrapolated and the vanilla finetuned model. Experiments across three domains over four different LLMs show that EpiCoDe consistently outperforms existing methods with significant and robust improvement. We also propose a new theoretical framework to reveal the mechanism behind contrastive decoding in data-scarcity scenarios, which further helps better understand the effectiveness of our EpiCoDe.

## introduction large language models (llms) have demonstrated superior performance across a wide range of downstream tasks, making them an indispensable application in natural language processing @xcite @xcite . their impressive capabilities, however, are primarily dependent on the availability of large-scale, high-quality training data. the scarcity of such data, especially in specific domains, has become a major barrier to further advancing llms. this challenge is particularly pronounced in fields such as law and health @xcite , where access to domain-specific data is often limited due to privacy concerns, copyright restrictions, and the high cost of data collection. furthermore, the expense of high-quality annotations may also remain a bottleneck, restricting the consistent development of model abilities. therefore, there has been a growing need to develop methods that can make the most use of limited data without extra training to enhance model performance in such data-scarcity scenarios. existing efforts include two types of methods, model extrapolation @xcite and contrastive @xcite , which are developed from the perspectives of parameters and inference, respectively. model extrapolation collects two checkpoints from different training stages. it obtains a stronger model by comparing the parameters of two checkpoints without extra training. beyond directly editing model parameters, there is another thread of research focusing on improving the probability to output correct next tokens during inference. @xcite hypothesize the llms trained on the same datasets can have similar patterns to make mistakes. meanwhile, models of different sizes exhibit different capabilities. thus, by comparing the logit scores predicted by a small llm and a large llm in the same family, contrastive decoding can narrow the performance gap and reduce their shared errors. previous work @xcite also proposes to improve the quality of generated images by comparing the prediction of a model and its bad version trained with noisy data. these two techniques are both good practice to enhance llms without extra training. however, they sometimes fail to bring improvement (o' @xcite . furthermore, existing works have not explored whether they are effective in the context of data scarcity. in this paper, we introduce epicode, a novel method that leverages model extrapolationand contrastive decoding to improve the performance of a finetuned model without further training in data-scarcity scenarios. we first obtain an extrapolated model of a finetuned llm by employing its weakened version at early training stage as the anchor. the resulting models as well as the vanilla finetuned model learn from the same dataset, exhibiting similar capabilities and error patterns. we then compare their logit scores and employ contrastive decoding to further optimize the prediction of next tokens. this frustratingly easy method can take the strengths of both methods to further improve model performance. previous efforts mainly provide empirical evidence to explain the success of contrastive decoding, without a proper analyzing tool to help us understand how contrastive decoding contributes to the improvement.in this work, we further introduce a theoretical framework to explain the mechanisms behind contrastive decoding and investigate strategies for model selection in epicode. our key insight is that model extrapolation helps maintain model locality across finetuned models and extrapolated models, which can ensure further improvement during the contrastive decoding stage. specifically, we argue that epicode brings more stable improvement when selecting the weak models that are closer to the extrapolated model in the parameter space. we evaluate our method across three distinct tasks (law, math, and logical reasoning) using four llms from different families and with various scales. experimental results show that epi-code consistently outperforms baseline models, which employ either model extrapolation or contrastive decoding, with significant performance gains across all tasks. furthermore, our experiments also demonstrate the validity of our theoretical framework, highlighting the importance of model locality in the context of epicode. our main contributions are threefold: ## related works the scarcity of high-quality annotated training data often prevents us from effectively finetuning llms, necessitating the development of approaches that go beyond conventional training paradigms. among others, model extrapolation and contrastive decoding are two representative threads of research falling to this type. ## methodology in this paper, we propose epicode, which leverages model extrapolation and contrastive decoding in data-scarcity scenarios, to boost model performance without additional training. ## why can epicode work? previous analysis @xcite explains that contrastive decoding may play a role similar to reduce the loss. however, a theoretical framework for understanding the underlying mechanisms still remains absent. different from previous work @xcite , in the contrastive decoding of epicode, we use models from different stages based on the same llm, rather than models of different sizes. our models vary in capabilities due to the quantity of finetuning data or whether they are obtained through model extrapolation. in the context of epicode, we are uncertain whether using the extrapolated model θ ep and its inferior version for contrastive decoding can be effective. with θ ep serving as the strong model, we also aim to study which other model should be employed as the weak model. thus, we develop a theoretical toolkit to explain the role of contrastive decoding in epicode and how to select the weak model yielding optimal performance. ## experimental settings datasets we evaluate our proposed method in three different tasks that usually lack finetuning data: law, mathematics, and logical reasoning. in the legal domain, we employ jec-qa @xcite as the training set and disc-law-eval @xcite as the test set. following previous work @xcite , we convert these multiple-choice legal questions into true-orfalse questions. for mathematics and logical reasoning, we use gsm8k_zh @xcite and logiqa @xcite for finetuning and evaluation, respectively. for the legal question answering (qa) and logical reasoning tasks, which require multiple reasoning steps to handle, we collect chain-ofthought (cot, @xcite data to finetune llms. for the mathematical task, we utilize the intermediate solution steps from gsm8k_zh for training, despite their brevity. ## main results we adopt the models finetuned for two epochs as baseline. as comparative experiments, we also study the improvements when using only model extrapolation @xcite or contrastive decoding (o' @xcite . for model extrapolation, we directly evaluate the performance of θ ep . and for contrastive decoding, we employ θ early and θ f t as the weak and the strong model, respectively. we repeat to train the llms on each dataset for 10 times with different random seeds and report the average accuracy. we find that the effects of model extrapolation and contrastive decoding vary on different llms. for instance, contrastive decoding can bring signif- ## conclusion in this paper, we propose an easy yet effective method, epicode, to enhance finetuned llms in data scarcity scenarios. benefiting from both model extrapolation and contrastive decoding, epicode can operate without additional training. extensive experiments across different tasks show that epi-code can bring consistent improvement, significantly outperforming baseline models. we also propose a theoretical framework from the perspective of logit errors to analyze the mechanisms of how epicode can work better. we find that model extrapolation naturally ensures the locality between the finetuned llm and the extrapolated llm. during inference, their locality further fulfills the prerequisite that enables contrastive decoding to be effective.