SLED: Self Logits Evolution Decoding for Improving Factuality in Large Language Model https://arxiv.org/pdf/2411.02433
123
stars
6
commits
Python
primary language
Dec 5, 2024
updated
The official implementation for our NeurIPS 2024 paper "SLED: Self Logits Evolution Decoding for Improving Factuality in Large Language Models"
Jianyi Zhang1 Da-Cheng Juan2 Cyrus Rashtchian2 Chun-Sung Ferng2 Heinrich Jiang2 Yiran Chen1
[2024.11.27] - We released the latest code on Github.
[2024.11.26] - We launched the official project website launched here!
[2024.11.01] - The paper is available at Arxiv.
[2024.09.25] - Our SLED paper accepted for NeurIPS 2024!

We introduce Self Logits Evolution Decoding (SLED), a novel factuality decoding approach that leverages the latent knowledge within LLMs by contrasting the final layer’s logits with early layers' logits. SLED tracks the logits evolution process to unearth the latent knowledge within LLMs, and enables the self-evolution of the output distribution further to align it more closely with real-world facts.
pip3 install torch==2.0.1 --index-url https://download.pytorch.org/whl/cu118
transformers library from the local directory included in the project folder.
pip install -e transformers
pip install -r requirements.txt
Below we provide example scripts for running SLED and other baseline methods such as dola and Greedy Decoding. For SLED and dola, the default setting for --early-exit-layers will include all the earlier layers of the LLM model before the final output layer.
tar -xzvf demo_dataset.tar.gz
python run_factor.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/FACTOR/wiki_factor.csv --output-path output-path.json --num-gpus 1 --decoding_method VanillaGreedy
python run_factor.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/FACTOR/wiki_factor.csv --output-path output-path.json --num-gpus 1 --decoding_method dola
python run_factor.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/FACTOR/wiki_factor.csv --output-path output-path.json --num-gpus 1 --decoding_method SLED --evolution_rate 2 --evolution_scale 10
python run_tfqa.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/TruthfulQA --output-path output-path.json --num-gpus 1 --decoding_method VanillaGreedy
python run_tfqa.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/TruthfulQA --output-path output-path.json --num-gpus 1 --decoding_method dola
python run_tfqa.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/TruthfulQA --output-path output-path.json --num-gpus 1 --decoding_method SLED --evolution_rate 2.5 --evolution_scale 75
python run_strqa.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/StrategyQA --output-path output-path.json --num-gpus 1 --decoding_method VanillaGreedy
python run_strqa.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/StrategyQA --output-path output-path.json --num-gpus 1 --decoding_method dola
python run_strqa.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/StrategyQA --output-path output-path.json --num-gpus 1 --decoding_method SLED --evolution_rate 1.75 --evolution_scale 5
python run_gsm8k.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/gsm8k_test --output-path output-path.json --num-gpus 1 --decoding_method VanillaGreedy
python run_gsm8k.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/gsm8k_test --output-path output-path.json --num-gpus 1 --decoding_method dola
python run_gsm8k.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/gsm8k_test --output-path output-path.json --num-gpus 1 --decoding_method SLED --evolution_rate 2 --evolution_scale 10
Additional experiments involving various models can be found in the scripts folder.
We strongly encourage you to try SLED method on your own open-ended generation tasks and datasets. To ensure good performance and effective outcomes, consider the following recommended parameters:
--evolution_rate within a range of 0.5 to 3.--evolution_scale values of 5, 10, or 20.--repetition_penalty to between 1.01 and 1.05.We hope this will be a good starting point for your experiments!
This codebase is based on the official repo of DoLa. We also highly recommend reading their excellent work.
We would greatly appreciate it if you cite our SLED paper when you find our repository helpful for your research or projects.
@inproceedings{
zhang2024sled,
title={SLED: Self Logits Evolution Decoding for Improving Factuality in Large Language Models},
author={Jianyi Zhang and Da-Cheng Juan and Cyrus Rashtchian and Chun-Sung Ferng and Heinrich Jiang and Yiran Chen},
booktitle={The Thirty-eighth Annual Conference on Neural Information Processing Systems (NeurIPS 2024},
year={2024},
url={https://arxiv.org/abs/2411.02433}
}
6 commits
Python
99.0%
SLED: Self Logits Evolution Decoding for Improving Factuality in Large Language Model https://arxiv.org/pdf/2411.02433
123
stars
6
commits
Python
primary language
Dec 5, 2024
updated
The official implementation for our NeurIPS 2024 paper "SLED: Self Logits Evolution Decoding for Improving Factuality in Large Language Models"
Jianyi Zhang1 Da-Cheng Juan2 Cyrus Rashtchian2 Chun-Sung Ferng2 Heinrich Jiang2 Yiran Chen1
[2024.11.27] - We released the latest code on Github.
[2024.11.26] - We launched the official project website launched here!
[2024.11.01] - The paper is available at Arxiv.
[2024.09.25] - Our SLED paper accepted for NeurIPS 2024!

We introduce Self Logits Evolution Decoding (SLED), a novel factuality decoding approach that leverages the latent knowledge within LLMs by contrasting the final layer’s logits with early layers' logits. SLED tracks the logits evolution process to unearth the latent knowledge within LLMs, and enables the self-evolution of the output distribution further to align it more closely with real-world facts.
pip3 install torch==2.0.1 --index-url https://download.pytorch.org/whl/cu118
transformers library from the local directory included in the project folder.
pip install -e transformers
pip install -r requirements.txt
Below we provide example scripts for running SLED and other baseline methods such as dola and Greedy Decoding. For SLED and dola, the default setting for --early-exit-layers will include all the earlier layers of the LLM model before the final output layer.
tar -xzvf demo_dataset.tar.gz
python run_factor.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/FACTOR/wiki_factor.csv --output-path output-path.json --num-gpus 1 --decoding_method VanillaGreedy
python run_factor.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/FACTOR/wiki_factor.csv --output-path output-path.json --num-gpus 1 --decoding_method dola
python run_factor.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/FACTOR/wiki_factor.csv --output-path output-path.json --num-gpus 1 --decoding_method SLED --evolution_rate 2 --evolution_scale 10
python run_tfqa.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/TruthfulQA --output-path output-path.json --num-gpus 1 --decoding_method VanillaGreedy
python run_tfqa.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/TruthfulQA --output-path output-path.json --num-gpus 1 --decoding_method dola
python run_tfqa.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/TruthfulQA --output-path output-path.json --num-gpus 1 --decoding_method SLED --evolution_rate 2.5 --evolution_scale 75
python run_strqa.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/StrategyQA --output-path output-path.json --num-gpus 1 --decoding_method VanillaGreedy
python run_strqa.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/StrategyQA --output-path output-path.json --num-gpus 1 --decoding_method dola
python run_strqa.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/StrategyQA --output-path output-path.json --num-gpus 1 --decoding_method SLED --evolution_rate 1.75 --evolution_scale 5
python run_gsm8k.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/gsm8k_test --output-path output-path.json --num-gpus 1 --decoding_method VanillaGreedy
python run_gsm8k.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/gsm8k_test --output-path output-path.json --num-gpus 1 --decoding_method dola
python run_gsm8k.py --model-name meta-llama/Llama-2-7b-hf --data-path Data/gsm8k_test --output-path output-path.json --num-gpus 1 --decoding_method SLED --evolution_rate 2 --evolution_scale 10
Additional experiments involving various models can be found in the scripts folder.
We strongly encourage you to try SLED method on your own open-ended generation tasks and datasets. To ensure good performance and effective outcomes, consider the following recommended parameters:
--evolution_rate within a range of 0.5 to 3.--evolution_scale values of 5, 10, or 20.--repetition_penalty to between 1.01 and 1.05.We hope this will be a good starting point for your experiments!
This codebase is based on the official repo of DoLa. We also highly recommend reading their excellent work.
We would greatly appreciate it if you cite our SLED paper when you find our repository helpful for your research or projects.
@inproceedings{
zhang2024sled,
title={SLED: Self Logits Evolution Decoding for Improving Factuality in Large Language Models},
author={Jianyi Zhang and Da-Cheng Juan and Cyrus Rashtchian and Chun-Sung Ferng and Heinrich Jiang and Yiran Chen},
booktitle={The Thirty-eighth Annual Conference on Neural Information Processing Systems (NeurIPS 2024},
year={2024},
url={https://arxiv.org/abs/2411.02433}
}
6 commits
Python
99.0%