Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

anonymous update #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ Activation_Decoding: Decoding by sharpness inside Large Language Models

![](figure/ad.png)

This is the code implementation of the paper: [In-Context Sharpness as Alerts: An Inner Representation Perspective for Hallucination Mitigation
](https://arxiv.org/abs/2403.01548)
This is the code implementation of the paper: In-Context Sharpness as Alerts: An Inner Representation Perspective for Hallucination Mitigation

We discover a pattern associated with hallucinations: correct generations tend to have *sharper* context activations in the hidden states of the in-context tokens, compared to that of the incorrect generations. Leveraging this signal, we propose an entropy-based metric to quantify the "*sharpness* " among the in-context hidden states and incorporate it into the decoding process, i.e, use the entropy value to adjust the next token prediction distribution to improve the factuality and overall quality of the generated text.

Expand Down Expand Up @@ -38,15 +37,6 @@ pip install -r requirements.txt
| `--num-gpus` | `1` | Number of GPUs to use, `1/1/2` for `7B/13B/70B` model sizes respectively if you are using 80G GPU cards. |
| `--do-rating` | | Add this to output evaluation results |

#### In-domain Hyperparameter choice

In the table below, we present the `alpha` with the `info_layer` choices for each knowledge-seeking dataset, formatted as `alpha/info_layer`.

| | TriviaQA | HotpotQA | NQ |
|---| --- | --- | --- |
|`LLaMa2-7B-chat`| `1/32`| `0.8/32` |`0.2/32` |
|`LLaMa2-13B-chat`| `0.6/32` |`1/28` | `0.8/34`|
|`LLaMa2-70B-chat`| `1/70`| `0.6/66` | `1/68` |

### TriviaQA, HotpotQA and Natural Questions

Expand Down Expand Up @@ -94,20 +84,4 @@ bash run_tqa.sh # refer to this script for more details

- Dola: https://github.com/voidism/DoLa

## Citation

Please cite our paper if it's helpful to your work!

```bibtex
@inproceedings{
chen2024incontext,
title={In-Context Sharpness as Alerts: An Inner Representation Perspective for Hallucination Mitigation},
author={Chen, Shiqi and Xiong, Miao and Liu, Junteng and Wu, Zhengxuan and Xiao, Teng and Gao, Siyang and He, Junxian},
booktitle={Arxiv},
year={2024},
url={https://arxiv.org/abs/2403.01548}
}

```


128 changes: 0 additions & 128 deletions environment.yml

This file was deleted.