Large language models (LLMs) have demonstrated remarkable capabilities, but their outputs can sometimes be unreliable or factually incorrect. To address this, we introduce Self Logits Evolution Decoding (SLED), a novel decoding framework that enhances the truthfulness of LLMs without relying on external knowledge bases or requiring further fine-tuning. From an optimization perspective, our SLED framework leverages the latent knowledge embedded within the LLM by contrasting the output logits from the final layer with those from early layers. It then utilizes an approximate gradient approach to enable latent knowledge to guide the self-refinement of outputs, thereby effectively improving factual accuracy. Extensive experiments have been conducted on established benchmarks across a diverse range of model families (LLaMA 2, LLaMA 3, Gemma) and scales (from 2B to 70B), including more advanced architectural configurations such as the mixture of experts (MoE). Our evaluation spans a wide variety of tasks, including multi-choice, open-generation, and adaptations to chain-of-thought reasoning tasks. The results demonstrate that SLED consistently improves factual accuracy by up to 20\% compared to existing decoding methods while maintaining natural language fluency and negligible latency overhead. Furthermore, it can be flexibly combined with other decoding methods to further enhance their performance.
翻译:大语言模型(LLMs)已展现出卓越的能力,但其输出有时可能不可靠或存在事实性错误。为解决这一问题,我们提出了自对数演化解码(SLED),这是一种新颖的解码框架,可在不依赖外部知识库或进行额外微调的情况下,提升LLMs输出内容的真实性。从优化视角出发,SLED框架通过对比模型最终层与早期层的输出对数,利用LLM内部嵌入的潜在知识。随后,它采用一种近似梯度方法,使潜在知识能够引导输出的自我精炼,从而有效提升事实准确性。我们在多种模型系列(LLaMA 2、LLaMA 3、Gemma)和规模(从2B到70B)上,包括更先进的架构配置如混合专家模型(MoE),基于现有基准进行了大量实验。评估涵盖了多种任务类型,包括多项选择、开放生成以及思维链推理任务的适配。结果表明,与现有解码方法相比,SLED能持续将事实准确性提升高达20%,同时保持自然语言的流畅性,并带来可忽略的延迟开销。此外,SLED可灵活与其他解码方法结合,以进一步提升其性能。