ChatPaper.aiChatPaper

Guidare Quando Necessario: Flessibilità nel Controllo dei Modelli Linguistici di Grande Scala con Backtracking

Steering When Necessary: Flexible Steering Large Language Models with Backtracking

August 25, 2025
Autori: Jinwei Gan, Zifeng Cheng, Zhiwei Jiang, Cong Wang, Yafeng Yin, Xiang Luo, Yuchen Fu, Qing Gu
cs.AI

Abstract

I modelli linguistici di grandi dimensioni (LLM) hanno ottenuto prestazioni notevoli in molti compiti di generazione. Tuttavia, allinearli efficacemente ai comportamenti desiderati rimane una sfida significativa. Lo steering delle attivazioni è un approccio efficace ed efficiente in termini di costi che modifica direttamente le attivazioni dei LLM durante la fase di inferenza, allineando le loro risposte ai comportamenti desiderati ed evitando l'elevato costo del fine-tuning. I metodi esistenti tipicamente intervengono indiscriminatamente su tutte le generazioni o si basano esclusivamente sulla domanda per determinare l'intervento, il che limita una valutazione accurata della forza dell'intervento. A tal fine, proponiamo il framework Flexible Activation Steering with Backtracking (FASB), che determina dinamicamente sia la necessità che la forza dell'intervento monitorando gli stati interni dei LLM durante la generazione, considerando sia la domanda che il contenuto generato. Poiché intervenire dopo aver rilevato una deviazione dal comportamento desiderato è spesso troppo tardi, proponiamo ulteriormente il meccanismo di backtracking per correggere i token deviati e orientare i LLM verso il comportamento desiderato. Esperimenti estensivi sul dataset TruthfulQA e su sei dataset a scelta multipla dimostrano che il nostro metodo supera i baseline. Il nostro codice sarà rilasciato su https://github.com/gjw185/FASB.
English
Large language models (LLMs) have achieved remarkable performance across many generation tasks. Nevertheless, effectively aligning them with desired behaviors remains a significant challenge. Activation steering is an effective and cost-efficient approach that directly modifies the activations of LLMs during the inference stage, aligning their responses with the desired behaviors and avoiding the high cost of fine-tuning. Existing methods typically indiscriminately intervene to all generations or rely solely on the question to determine intervention, which limits the accurate assessment of the intervention strength. To this end, we propose the Flexible Activation Steering with Backtracking (FASB) framework, which dynamically determines both the necessity and strength of intervention by tracking the internal states of the LLMs during generation, considering both the question and the generated content. Since intervening after detecting a deviation from the desired behavior is often too late, we further propose the backtracking mechanism to correct the deviated tokens and steer the LLMs toward the desired behavior. Extensive experiments on the TruthfulQA dataset and six multiple-choice datasets demonstrate that our method outperforms baselines. Our code will be released at https://github.com/gjw185/FASB.
PDF22August 27, 2025