Table of Contents
Fetching ...

Transformer Copilot: Learning from The Mistake Log in LLM Fine-tuning

Jiaru Zou, Yikun Ban, Zihao Li, Yunzhe Qi, Ruizhong Qiu, Ling Yang, Jingrui He

TL;DR

This work introduces Transformer Copilot, a Pilot-Copilot framework that records a Mistake Log during fine-tuning to capture where a Transformer Pilot errs. The Copilot, initialized from the Pilot's decoder, learns from the Mistake Log to produce logits corrections that are fused with the Pilot's outputs during generation using a rectified distribution $\tilde{p}_{t,i}=\hat{p}_{t,i}+\lambda f^C_{t,i}$. The authors provide a theoretical guarantee showing that, under mild assumptions, this correction reduces the expected error, and they demonstrate empirical gains across 12 commonsense, arithmetic, and recommendation benchmarks, with modest overhead and strong transferability. The approach scales across encoder-decoder and decoder-only architectures, showing improved performance with few additional parameters and applicable to diverse tasks. This reflective learning mechanism offers a novel, efficient way to exploit internal training signals to bridge training-time and inference-time behavior.

Abstract

Large language models are typically adapted to downstream tasks through supervised fine-tuning on domain-specific data. While standard fine-tuning focuses on minimizing generation loss to optimize model parameters, we take a deeper step by retaining and leveraging the model's own learning signals, analogous to how human learners reflect on past mistakes to improve future performance. We first introduce the concept of Mistake Log to systematically track the model's learning behavior and recurring errors throughout fine-tuning. Treating the original transformer-based model as the Pilot, we correspondingly design a Copilot model to refine the Pilot's inference performance via logits rectification. We name the overall Pilot-Copilot framework the Transformer Copilot, which introduces (i) a novel Copilot model design, (ii) a joint training paradigm where the Copilot continuously learns from the evolving Mistake Log alongside the Pilot, and (iii) a fused inference paradigm where the Copilot rectifies the Pilot's logits for enhanced generation. We provide both theoretical and empirical analyses on our new learning framework. Experiments on 12 benchmarks spanning commonsense, arithmetic, and recommendation tasks demonstrate that Transformer Copilot consistently improves performance by up to 34.5%, while introducing marginal computational overhead to Pilot models and exhibiting strong scalability and transferability. Our code is released at https://github.com/jiaruzouu/TransformerCopilot.

Transformer Copilot: Learning from The Mistake Log in LLM Fine-tuning

TL;DR

This work introduces Transformer Copilot, a Pilot-Copilot framework that records a Mistake Log during fine-tuning to capture where a Transformer Pilot errs. The Copilot, initialized from the Pilot's decoder, learns from the Mistake Log to produce logits corrections that are fused with the Pilot's outputs during generation using a rectified distribution . The authors provide a theoretical guarantee showing that, under mild assumptions, this correction reduces the expected error, and they demonstrate empirical gains across 12 commonsense, arithmetic, and recommendation benchmarks, with modest overhead and strong transferability. The approach scales across encoder-decoder and decoder-only architectures, showing improved performance with few additional parameters and applicable to diverse tasks. This reflective learning mechanism offers a novel, efficient way to exploit internal training signals to bridge training-time and inference-time behavior.

Abstract

Large language models are typically adapted to downstream tasks through supervised fine-tuning on domain-specific data. While standard fine-tuning focuses on minimizing generation loss to optimize model parameters, we take a deeper step by retaining and leveraging the model's own learning signals, analogous to how human learners reflect on past mistakes to improve future performance. We first introduce the concept of Mistake Log to systematically track the model's learning behavior and recurring errors throughout fine-tuning. Treating the original transformer-based model as the Pilot, we correspondingly design a Copilot model to refine the Pilot's inference performance via logits rectification. We name the overall Pilot-Copilot framework the Transformer Copilot, which introduces (i) a novel Copilot model design, (ii) a joint training paradigm where the Copilot continuously learns from the evolving Mistake Log alongside the Pilot, and (iii) a fused inference paradigm where the Copilot rectifies the Pilot's logits for enhanced generation. We provide both theoretical and empirical analyses on our new learning framework. Experiments on 12 benchmarks spanning commonsense, arithmetic, and recommendation tasks demonstrate that Transformer Copilot consistently improves performance by up to 34.5%, while introducing marginal computational overhead to Pilot models and exhibiting strong scalability and transferability. Our code is released at https://github.com/jiaruzouu/TransformerCopilot.

Paper Structure

This paper contains 45 sections, 2 theorems, 19 equations, 8 figures, 20 tables, 1 algorithm.

Key Result

Theorem 4.1

For any $k \in [|V|]$, suppose that $\epsilon_P^2 >0$ and $\epsilon_C<\sqrt{\epsilon_P^2+\sigma_P^2}$. Then there exists $\lambda_0>0$ such that for any $0<\lambda<\lambda_0$, the rectified prediction $\Tilde{p}_{t,i} =\hat{p}_{t,i} + \lambda f^C_{t,i}$ yields a strictly closer approximation to the

Figures (8)

  • Figure 1: Illustration of the Mistake Log. We use the encoder-decoder architecture as an example here.
  • Figure 2: Transformer Copilot Framework. The overall framework comprises three key components: (1) Copilot Model Design, (2) Training Paradigm, and (3) Inference Paradigm.
  • Figure 3: Logits Correction by Copilot. We visualize the logits correction introduced by a 1B Copilot model (computed as $|$Fused logits$-$Pilot logits$|$) to highlight the shift by the Copilot's rectification. Left: Percentage of logits correction over original Pilot's output logits range for three LLaMA-3 Pilot models. Right: Distribution of logits correction magnitudes across reasoning types.
  • Figure 4: Example of Copilot’s Token-level Rectification on SIQA. The token-level formatting error ('forgot') originates during the Pilot's mid-way generation and is corrected ('answer') by incorporating the Copilot.
  • Figure 5: Efficiency Analysis on T-Copilot during fine-tuning and inference. (a) Inference model throughput. (b) Fine-tuning running speeds. (c) Overall training and inference time overhead.
  • ...and 3 more figures

Theorems & Definitions (4)

  • Theorem 4.1
  • Remark 4.2
  • Theorem B.1: Restate
  • proof