SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2312.15710 · 2023

Alleviating Hallucinations of Large Language Models through Induced Hallucinations

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 13 functions out of this paper's own repositories and ran 4 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
hillzhang1999/icd canonical 4 of 13
FunctionStatusWhere it lives
build_prompt Ran hillzhang1999/icd/src/benchmark_evaluation/factscore_eval.py
code served (permissive licence) · get_code("db8a8ad434c0dd70")
get_config_class_from_processor_class Ran hillzhang1999/icd/transformers/utils/create_dummy_models.py
code served (permissive licence) · get_code("3d999b95009c7537")
get_processor_types_from_config_class Ran hillzhang1999/icd/transformers/utils/create_dummy_models.py
code served (permissive licence) · get_code("0c0b81b081919d8e")
load_jsonl Ran hillzhang1999/icd/src/benchmark_evaluation/factscore_eval.py
code served (permissive licence) · get_code("e9a7befa1d14a877")
convert_dialog_halueval Not yet run hillzhang1999/icd/src/utils/convert_dataset_for_training.py
code served (permissive licence) · get_code("d8198788b1eeae23")
download_url Not yet run hillzhang1999/icd/src/benchmark_evaluation/factscore_eval.py
code served (permissive licence) · get_code("f4c68c4850723e81")
format_best Not yet run hillzhang1999/icd/src/benchmark_evaluation/truthfulqa_eval.py
code served (permissive licence) · get_code("158b8847881a64b3")
get_architectures_from_config_class Not yet run hillzhang1999/icd/transformers/utils/create_dummy_models.py
code served (permissive licence) · get_code("b176efb26f72e507")
get_bio_res_gpt Not yet run hillzhang1999/icd/src/utils/generate_bio_hallucination.py
code served (permissive licence) · get_code("85f010749bbdf0d3")
get_bio_res_hallu Not yet run hillzhang1999/icd/src/utils/generate_bio_hallucination.py
code served (permissive licence) · get_code("547b922a733a0af5")
get_template_and_fix_tokenizer Not yet run hillzhang1999/icd/src/demo/template.py
code served (permissive licence) · get_code("2680f9029a02c8cc")
load_csv Not yet run hillzhang1999/icd/src/benchmark_evaluation/truthfulqa_eval.py
code served (permissive licence) · get_code("2a4c0ecd291e1795")
split_multi_answer Not yet run hillzhang1999/icd/src/benchmark_evaluation/truthfulqa_eval.py
code served (permissive licence) · get_code("c852bd4d2face0a1")

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Despite their impressive capabilities, large language models (LLMs) have been observed to generate responses that include inaccurate or fabricated information, a phenomenon commonly known as ``hallucination''. In this work, we propose a simple \textit{Induce-then-Contrast} Decoding (ICD) strategy to alleviate hallucinations. We first construct a factually weak LLM by inducing hallucinations from the original LLMs. Then, we penalize these induced hallucinations during decoding to enhance the factuality of the generated content. Concretely, we determine the final next-token predictions by amplifying the predictions from the original model and downplaying the induced untruthful predictions via contrastive decoding. Experimental results on both discrimination-based and generation-based hallucination evaluation benchmarks, such as TruthfulQA and \textsc{FActScore}, demonstrate that our proposed ICD methods can effectively enhance the factuality of LLMs across various model sizes and families. For example, when equipped with ICD, Llama2-7B-Chat and Mistral-7B-Instruct achieve performance comparable to ChatGPT and GPT4 on TruthfulQA, respectively.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2312.15710")
get_code_for_paper("2312.15710")
have("2312.15710")

Connect an agent — have() is free.