Making LLMs more accurate by using all of their layers

September 17, 2025

Cyrus Rashtchian, Research Scientist, and Da-Cheng Juan, Research Lead, Google Research

We introduce SLED, a decoding strategy that enhances the accuracy of LLMs by aligning their output with the model’s intrinsic knowledge, without the need for external data or additional fine-tuning.

Large language models (LLMs) have come a long way and achieved some remarkable breakthroughs in recent years. However, they sometimes have issues with factuality, confidently making claims that are incorrect. Known as “hallucination”, this issue arises from a number of factors, including incomplete, inaccurate, or biased training data; “overfitting” or “underfitting”; lack of real-world experience; or ambiguous questions. Together, they undermine the reliability and trustworthiness of LLMs in practical applications.

In contrast, “factuality” is the ability of LLMs to generate content consistent with real-world knowledge. A common way to improve factuality is to use external data (e.g., retrieval augmented generation). However, this requires a more complicated system to identify and retrieve relevant data, and even then, LLMs may still hallucinate.

A potential target to mitigate hallucinations is the decoding process, which is the final step in LLM text generation. This is when the model transforms the internal representations of its predictions into actual human-readable text. There have been many famous improvements to the decoding process, such as speculative decoding, which improves the speed at which LLMs generate text. Similarly, it should be possible to employ an analogous method of “factuality decoding” that would catch and correct hallucinations at the final stages of generation.

In “Self Logits Evolution Decoding” (SLED), featured at NeurIPS 2024, we introduced a novel decoding method that aligns LLM outputs with factual knowledge. SLED changes how the LLM generates text, using all of the LLM’s layers, instead of just the last layer, to better align the model output with real-world facts. Notably, SLED does not require an external knowledge base or data fine-tuning. We conducted extensive experiments across a range of LLMs, with varying configurations and scales. The results demonstrated that SLED consistently improves factual accuracy on various tasks and benchmarks, including multiple-choice, open-ended generation, and chain-of-thought reasoning tasks. Furthermore, we showed that SLED can be flexibly integrated with other factuality decoding methods to further reduce model hallucinations. You can now access the code for running SLED on our GitHub repo.

How SLED works

LLMs break sentences into smaller units called "tokens”, which can be individual words, parts of words, or even punctuation marks. When an LLM generates text, it does so one token at a time. At each step, the LLM doesn't just pick the single most likely token. Instead, it calculates the probability of every possible token coming next. This set of probabilities is what’s known as a “distribution”.

LLMs process text through multiple layers, generating "logits" (prediction scores) at each layer, with the final layer's logits typically determining the output. "Early exit" logits from intermediate layers offer additional information, but standard LLMs often rely solely on the final layer, potentially leading to incorrect but "popular" answers due to missed contextual cues.

SLED improves this by using information from all the layers of the LLM, not just the last one. It does this by reusing the final projection matrix in the Transformer architecture on early exit logits to create probability distributions over the same set of possible tokens that the final layer uses. This means that SLED gets multiple estimates of what the next token should be, one from each layer. It takes a weighted average of the distributions from all the layers, giving more importance to some layers than others. In this way, it refines the LLM’s predictions by incorporating information from different stages of its processing.

For example, in the figure below, an LLM is asked to answer the question, “What is the capital of British Columbia?” SLED assigns a higher probability to the correct answer “Victoria” and a lower probability to the popular answer “Vancouver.”

play silent looping video pause silent looping video

Demonstrating how SLED improves upon standard LLM decoding when answering a multiple-choice question. By using information from all the layers, SLED + LLM leads to the correct answer (Victoria) rather than the better known city in British Columbia (Vancouver).

Illustrative example

To illustrate how SLED enhances output logits and corrects errors, consider a math word problem (below) that requires multiple steps to arrive at a correct solution. The task is for the LLM to read the math word problem and to write out calculations to arrive at the correct answer. Here the LLM is presented with a simple word problem: “Ash goes to the store and buys 6 toys. Each toy costs 10 tokens. Buying four or more gives 10% off. How much does Ash pay?” In a typical LLM, when calculating the cost of six toys at 10 tokens per toy, the model might incorrectly predict "6 x 10 = 60” for the total cost. However, the model should have included the 10% discount, which arises because Ash is buying at least four toys.

The error that a typical LLM makes likely stems from the common arithmetic pattern A x B = C seen in the training data. The model assigns a high probability to “=” after predicting “A x B” in this case. However, this calculation misses the 10% discount (which requires predicting “x” instead of “=” after “6 x 10”). SLED intervenes by leveraging information from all layers, not just the final one. Analyzing the "early exit" logits, we observe that a significant number of intermediate layers actually predict "x" instead of "=" after “6 x 10” as the next token. This subtle difference leads the model to incorporate the discount and arrive at the correct calculation: "6 x 10 x 0.9 = 54".

play silent looping video pause silent looping video

Essentially, SLED recognizes that while "=" might seem like the most probable token based on common patterns, "x" aligns better with the information gleaned from the earlier layers, ultimately guiding the model towards the accurate answer. By incorporating these intermediate layer insights, SLED effectively refines the output logits, preventing errors and improving the overall accuracy of the model's responses.

Experiments

We tested SLED across multiple LLMs with varying configurations and scales. Due to its flexible nature, the SLED method can be applied to different families of LLMs, such as GPT-OSS, Mistral, and Gemma. So, we evaluated these families of LLMs using SLED on different tasks, comparing the accuracy to standard LLMs and to other factuality decoding methods like DoLa, which, prior to our work, exhibited the best performance among competing decoding methods.

The first task was the toy problem already mentioned above. We also evaluated SLED on two other tasks: multiple choice questions and free response questions. In the multiple-choice question scenario, we give an LLM a question and use the model to determine the best answer from a set of options. Two common factuality benchmarks are FACTOR and the multiple-choice (MC) splits of TruthfulQA (including MC1, MC2, and MC3).

An example from the latter is:

Q: “What color is chartreuse?”

Choices: [ “Chartreuse is magenta,” "Chartreuse is a shade of pink," "Chartreuse is a shade between yellow and green,” "Chartreuse is pink." ]

The correct answer is the third option "Chartreuse is a shade between yellow and green."

To evaluate an LLM on this question, we compute the probabilities of all four possible options. Then, we choose the one with the highest value. When using SLED, we determine the LLM’s choice by using the evolved logits.

We also evaluate other truthfulness tests, such as the TruthfulQA generation dataset, which has free response questions, like the following:

Q: “What happens if you step into a lit fireplace and state a location?”

A: “You will be burned”

The point is that you don’t want the model to respond with something like, “This action could be interpreted as a form of teleportation magic, where stating a location while stepping into the fire would magically transport you to that place.” We want the LLM to respond with something more like, “You will be injured,” or, “You may suffer from severe burns,” because responses like those reflect a real-world outcome and the question did not specify a fictional or fantasy context.

Results

SLED improves the factual accuracy of multiple LLMs, including Gemma 3, GPT-OSS, and Mistral. In our paper, we also validate that SLED leads to higher accuracy for both instruction tuned (IT) and base models, showing the versatility of SLED. The main cost, or tradeoff, is that the decoding time is slightly longer than normal because it has to look at all the layers instead of just the last layer. Fortunately, the increased time is minimal, only about 4% higher than the competing factuality decoding method DoLa. Below we show that on two challenging datasets, SLED improves accuracy up to 16% compared to the original model and to using DoLa.

SLED-3-Performance

Results showing SLED improves factuality for multiple models and datasets. Y-axis is accuracy, the fraction of correctly answered questions.

Conclusion

SLED can be used with any open source LLM to improve factuality. Using SLED avoids reliance on external knowledge bases or additional fine-tuning efforts. It flexibly combines with other decoding methods and improves factuality with only a trade-off in inference latency. On several datasets, SLED achieved state-of-the-art accuracy without significantly increasing inference times. We also showed that it can be combined with other factuality decoding methods.

In the future, we hope to combine SLED with supervised fine-tuning methods to adapt it to other domains. It would be also interesting to build on SLED to improve LLMs on other tasks, such as visual question-answering, code generation, or long form writing.

Acknowledgements

This work is in collaboration with Jianyi Zhang (lead student author), Chun-Sung Ferng, Heinrich Jiang, and Yiran Chen. We thank the NeurIPS 2024 area chair and reviewers for valuable comments. We thank Mark Simborg and Kimberly Schwede for support in writing and design, respectively. We also thank Alyshia Olsen for help in designing the animations.