SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2401.12973 · 2024

In-Context Language Learning: Architectures and Algorithms

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 20 functions out of this paper's own repositories and ran 12 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
berlino/seq_icl canonical 12 of 20
FunctionStatusWhere it lives
create_flags Ran berlino/seq_icl/sweep.py
code served (permissive licence) · get_code("b7ffd8fb4517d412")
generate Ran berlino/seq_icl/generate.py
code served (permissive licence) · get_code("9e64222cc89cf42d")
get_conditional_prob Ran berlino/seq_icl/ngram.py
code served (permissive licence) · get_code("51b7e5bf992a7ada")
get_config Ran berlino/seq_icl/sweep.py
code served (permissive licence) · get_code("aa4ed806d118746a")
get_dfa_states Ran berlino/seq_icl/samestateprobe.py
code served (permissive licence) · get_code("9a83c3eaaa9c553c")
get_sweep Ran berlino/seq_icl/sweep.py
code served (permissive licence) · get_code("ce9f5b21ad841769")
mask_transition_matrix Ran berlino/seq_icl/batched_baum_welch.py
code served (permissive licence) · get_code("9f129256cb54eace")
normalize Ran berlino/seq_icl/ngram.py
code served (permissive licence) · get_code("e71438a3ed6a9798")
possible_states Ran berlino/seq_icl/batched_baum_welch.py
code served (permissive licence) · get_code("35218296da840eec")
read_hidden_states Ran berlino/seq_icl/samestateprobe.py
code served (permissive licence) · get_code("e13fb3b9ab87c890")
read_one Ran berlino/seq_icl/probe.py
code served (permissive licence) · get_code("dba3844475b7ec75")
train_everygram Ran berlino/seq_icl/ngram.py
code served (permissive licence) · get_code("29c617b8c430aff7")
eval_dfa Not yet run berlino/seq_icl/analyze.py
code served (permissive licence) · get_code("d079b2adb7787354")
forward_backward Not yet run berlino/seq_icl/batched_baum_welch.py
code served (permissive licence) · get_code("7d16fa77eed96638")
get_results Not yet run berlino/seq_icl/samestateprobe.py
code served (permissive licence) · get_code("e4d688cc5cf62263")
get_transition_info Not yet run berlino/seq_icl/analyze.py
code served (permissive licence) · get_code("7ba8c48c6e6661b3")
get_uniform_probs Not yet run berlino/seq_icl/analyze.py
code served (permissive licence) · get_code("5a82f62a07d935e2")
prepare_video Not yet run berlino/seq_icl/make_video.py
code served (permissive licence) · get_code("22b5e068ce364282")
read_hidden_states Not yet run berlino/seq_icl/probe.py
code served (permissive licence) · get_code("544b7de38c79c09c")
read_parallel Not yet run berlino/seq_icl/probe.py
code served (permissive licence) · get_code("e490d66f05b1420b")

Repositories linked to this paper

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

Abstract

Large-scale neural language models exhibit a remarkable capacity for in-context learning (ICL): they can infer novel functions from datasets provided as input. Most of our current understanding of when and how ICL arises comes from LMs trained on extremely simple learning problems like linear regression and associative recall. There remains a significant gap between these model problems and the "real" ICL exhibited by LMs trained on large text corpora, which involves not just retrieval and function approximation but free-form generation of language and other structured outputs. In this paper, we study ICL through the lens of a new family of model problems we term in context language learning (ICLL). In ICLL, LMs are presented with a set of strings from a formal language, and must generate additional strings from the same language. We focus on in-context learning of regular languages generated by random finite automata. We evaluate a diverse set of neural sequence models (including several RNNs, Transformers, and state-space model variants) on regular ICLL tasks, aiming to answer three questions: (1) Which model classes are empirically capable of ICLL? (2) What algorithmic solutions do successful models implement to perform ICLL? (3) What architectural changes can improve ICLL in less performant models? We first show that Transformers significantly outperform neural sequence models with recurrent or convolutional representations on ICLL tasks. Next, we provide evidence that their ability to do so relies on specialized "n-gram heads" (higher-order variants of induction heads) that compute input-conditional next-token distributions. Finally, we show that hard-wiring these heads into neural models improves performance not just on ICLL, but natural language modeling -- improving the perplexity of 340M-parameter models by up to 1.14 points (6.7%) on the SlimPajama dataset.

For agents

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

get_harvested_code_for_paper("2401.12973")
get_code_for_paper("2401.12973")
have("2401.12973")

Connect an agent — have() is free.