SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.14140 · 2022

Contrastive Search Is What You Need For Neural Text Generation

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 9 functions out of this paper's own repositories and ran 9 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
yxuansu/contrastive_search_is_what_you_need canonical 4 of 4
yxuansu/simctg canonical 3 of 3
YecanLee/Adaptive-Contrastive-Search extension 2 of 2
FunctionStatusWhere it lives
eval_one_instance Ran yxuansu/simctg/simctg/evaluation.py
code served (permissive licence) · get_code("754038d51a2f047c")
eval_text Ran yxuansu/simctg/simctg/evaluation.py
code served (permissive licence) · get_code("c46cd761b22ceb5c")
evaluate_batch_coherence Ran YecanLee/Adaptive-Contrastive-Search/measure_coherence.py
code served (permissive licence) · get_code("f2afce396071df98")
generate_one_instance Ran yxuansu/contrastive_search_is_what_you_need/code_generation/inference.py
pointer only (licence: NONE) · get_code("cac40e03d91cfcd2")
inference_one_instance Ran yxuansu/contrastive_search_is_what_you_need/open_ended_generation/english/inference.py
pointer only (licence: NONE) · get_code("bd4a83f85a760a62")
load_result Ran YecanLee/Adaptive-Contrastive-Search/measure_coherence.py
code served (permissive licence) · get_code("65983de78a3eea7d")
measure_repetition_and_diversity Ran yxuansu/simctg/simctg/evaluation.py
code served (permissive licence) · get_code("af1d81324699f0bc")
parse_output Ran yxuansu/contrastive_search_is_what_you_need/code_generation/inference.py
pointer only (licence: NONE) · get_code("a115616e0c6ba1e8")
save_result Ran yxuansu/contrastive_search_is_what_you_need/code_generation/inference.py
pointer only (licence: NONE) · get_code("08a4d22e5a9f3b60")

Repositories linked to this paper

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

Abstract

Generating text with autoregressive language models (LMs) is of great importance to many natural language processing (NLP) applications. Previous solutions for this task often produce text that contains degenerative expressions or lacks semantic consistency. Recently, Su et al. introduced a new decoding method, contrastive search, based on the isotropic representation space of the language model and obtained new state of the art on various benchmarks. Additionally, Su et al. argued that the representations of autoregressive LMs (e.g. GPT-2) are intrinsically anisotropic which is also shared by previous studies. Therefore, to ensure the language model follows an isotropic distribution, Su et al. proposed a contrastive learning scheme, SimCTG, which calibrates the language model's representations through additional training. In this study, we first answer the question: "Are autoregressive LMs really anisotropic?". To this end, we extensively evaluate the isotropy of LMs across 16 major languages. Surprisingly, we find that the anisotropic problem only exists in the two specific English GPT-2-small/medium models. On the other hand, all other evaluated LMs are naturally isotropic which is in contrast to the conclusion drawn by previous studies. Based on our findings, we further assess the contrastive search decoding method using off-the-shelf LMs on four generation tasks across 16 languages. Our experimental results demonstrate that contrastive search significantly outperforms previous decoding methods without any additional training. More notably, on 12 out of the 16 evaluated languages, contrastive search performs comparably with human-level performances as judged by human evaluations. Our code and other related resources are publicly available at https://github.com/yxuansu/Contrastive_Search_Is_What_You_Need.

For agents

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

get_harvested_code_for_paper("2210.14140")
get_code_for_paper("2210.14140")
have("2210.14140")

Connect an agent — have() is free.