PreprintCited by 1Adversarial Robustness in Machine LearningNeural Networks and ApplicationsStochastic Gradient Optimization Techniques

Learning Randomized Algorithms with Transformers

Open access
von Oswald, Johannes, Kobayashi, Seijin, Akram, Yassir, Steger, Angelika·2024·arXiv

Abstract

Randomization is a powerful tool that endows algorithms with remarkable properties. For instance, randomized algorithms excel in adversarial settings, often surpassing the worst-case performance of deterministic algorithms with large margins. Furthermore, their success probability can be amplified by simple strategies such as repetition and majority voting. In this paper, we enhance deep neural networks, in particular transformer models, with randomization. We demonstrate for the first time that randomized algorithms can be instilled in transformers through learning, in a purely data- and objective-driven manner. First, we analyze known adversarial objectives for which randomized algorithms offer a distinct advantage over deterministic ones. We then show that common optimization techniques, such as gradient descent or evolutionary strategies, can effectively learn transformer parameters that make use of the randomness provided to the model. To illustrate the broad applicability of randomization in empowering neural networks, we study three conceptual tasks: associative recall, graph coloring, and agents that explore grid worlds. In addition to demonstrating increased robustness against oblivious adversaries through learned randomization, our experiments reveal remarkable performance improvements due to the inherently random nature of the neural networks' computation and predictions.

Integrity signals

Registry

DataCite · 10.48550/arxiv.2408.10818

Cites

Statistics

Recomputing p-values needs the paper’s full text.

Claims the paper makes

We couldn’t retrieve this paper’s full text, so its claims and self-check weren’t run. The registry and citation checks still apply.

Claims other papers make about this one

Each is checked against this paper’s own text: does it say what the citing paper says it does?

  • Modern RNN models such as DeltaNet, Mamba and xLSTM can be unified by noting that their recurrent layer dynamics can all be derived from an in-context regression objective, approximately optimized through an online learning rule.

    “These models can be unified by noting that their recurrent layer dynamics can all be derived from an in-context regression objective, approximately optimized through an online learning rule.”

    From MesaNet: Sequence Modeling by Locally Optimal Test-Time Training (2025) · cites this paper as von Oswald et al., 2024

  • The Mesa layer introduced in this paper is a numerically stable, chunkwise parallelizable version of the recently proposed Mesa layer.

    “Here, we join this line of work and introduce a numerically stable, chunkwise parallelizable version of the recently proposed Mesa layer (von Oswald et al., 2024), which could only run sequentially in time and was therefore not scalable.”

    From MesaNet: Sequence Modeling by Locally Optimal Test-Time Training (2025) · cites this paper as von Oswald et al., 2024

  • Modern RNNs can be seen from the unifying perspective of test-time training.

    “Such modern RNNs can also be seen from the unifying perspective of test-time training (Schlag et al., 2021a; Liu et al., 2025; von Oswald et al., 2024; Wang et al., 2025; Behrouz et al., 2025b).”

    From MesaNet: Sequence Modeling by Locally Optimal Test-Time Training (2025) · cites this paper as von Oswald et al., 2024

  • We present a chunkwise parallelized, numerically stable version of the Mesa layer and scale it up to 1B parameter language models.

    “We present a chunkwise parallelized, numerically stable version of the Mesa layer (von Oswald et al., 2024), and scale it up to 1B parameter language models.”

    From MesaNet: Sequence Modeling by Locally Optimal Test-Time Training (2025) · cites this paper as von Oswald et al., 2024

Cited by

Sorted by citations

  • MesaNet: Sequence Modeling by Locally Optimal Test-Time Training

    von Oswald, J., Scherrer, N., Kobayashi, S., Versari, L., Yang, S., Mittal, S., Schlegel, M., Maile, K., Schimpf, Y., Sieberling, O., et al. (2025) · arXiv

    “We generally find extending well-known algorithms with the help of deep learning or using them as building blocks of deep neural networks an exciting research direction [104, 106, 103].”
    Self-citation

Authors
von Oswald, J., Kobayashi, S., Akram, Y., & Steger, A.
Affiliations
  • Google (United States) (US)
  • ETH Zurich (CH)
Venue
arXiv
Publisher
arXiv
Published
2024
ISSN
2331-8422 (ISSN-L)
OpenAlex
W4403007399
Cited by
0
References
0
Type
posted content
Language
en
Open access
Locations
  • arXiv (Cornell University) (submittedVersion, cc-by)
  • arXiv (Cornell University) (cc-by)
Topics
  • Physical Sciences › Computer Science › Artificial Intelligence › Adversarial Robustness in Machine Learning
  • Physical Sciences › Computer Science › Artificial Intelligence › Neural Networks and Applications
  • Physical Sciences › Computer Science › Artificial Intelligence › Stochastic Gradient Optimization Techniques
Keywords
randomized algorithms, transformer models, adversarial robustness, oblivious adversary, associative recall, graph coloring, evolution strategies, gradient descent, majority voting, neural network robustness

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review