Anticipation-RNN
A recurrent network that generates melodies under user-defined positional constraints.
Audio and speech · 319 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Audio and speech
- Parameters
- 2M
- Operations
- 319
- Framework
- PyTorch
- Recurrent
- Yes
- Published
- Neural Computing and Applications (arXiv 2017)
- Cited by
- 22 (as of 30 October 2026)
- Authors
- Gaëtan Hadjeres, Frank Nielsen
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m14694
- Graph hash
- e21f84c11c162491ad3234c48a1a1fd43aa2c1c4298fa01e96d4d4fd55870bfa
- Skeleton hash
- 88d75cf3b4374753918f60fb6bae2b890b1c5804fdae73a687648b2dc8e590eb
- Architecture hash
- 624a66610b0c81e31cc0df9d8a940b09fc6c57648c49b5b032546bec906df6e9
- Diagram SHA-256
- 693a720cd20030d9c81b7c36de4158f4a76f9d4bcc852012b97c86b176c05733
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
Anticipation-RNN is a recurrent architecture for sequence generation that lets a user impose positional constraints on the output. The paper's starting point is that the left-to-right generation of ordinary RNNs gives a user only limited control, which makes them unsuitable for interactive uses such as interactive music generation. The authors demonstrate it by generating melodies that satisfy positional constraints in the style of the soprano parts of Bach's chorale harmonizations. Sampling is reported to be of the same order of complexity as sampling from a traditional RNN.
The code accompanies the later journal article, whose title calls the constraints unary constraints, and it comes with a pretrained model. According to the README, the approach can transform any RNN used for music generation into an interactive generative model with little additional cost, and inference does not require a GPU. It can also take additional metadata, such as the current beat and the current key.
Key idea. The paper introduces an RNN architecture that enforces user-defined positional constraints during generation while keeping sampling at the same order of complexity as a traditional RNN.
- Anticipation-RNN
- anticipation RNN
- interactive music generation
- positional constraints
- unary constraints
- melody generation
- Bach chorales
- constrained sequence generation
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{hadjeres2017interactivemusicgenerationpositional,
title={Interactive Music Generation with Positional Constraints using Anticipation-RNNs},
author={Gaëtan Hadjeres and Frank Nielsen},
year={2017},
eprint={1709.06404},
archivePrefix={arXiv},
primaryClass={cs.AI},
url={https://arxiv.org/abs/1709.06404},
}