The Mechanical Bard: An Interpretable Machine Learning Approach to Shakespearean Sonnet Generation
What it is about
The paper generates Shakespearean sonnets with a small pretrained model (GPT-2, fine-tuned on poems and sonnets) and enforces the sonnet form explicitly rather than hoping training teaches it. About 120 handcrafted part-of-speech templates, taken from real sonnet lines, fix the grammatical shape of each line. A pronunciation dictionary gives syllable counts and stress, so meter is a hard filter during a constrained beam search, and rhyme is checked at the line end. A theme word pulls in related vocabulary, and soft weights reward alliteration and internal rhyme and penalize repetition. Human evaluation, from expert readers and crowd workers, prefers the output to two earlier generators on most criteria, though human sonnets still win on theme. An ablation shows that the templates matter more than the fine-tuning: removing them costs more quality than removing the tuning.
Ideas
- I1. Use the templates as hard order constraints in the linearizer.
en/src/lin.rslearns word order from classes; a small table of class sequences for a clause, checked as a filter, would fix order where the Markov chain is weak. Measure exact order matches with and without the table on dev. - I2. Make agreement a hard filter in the encoder. The paper rejects candidates that break a hard constraint during search. Number and person from the UD features (open problem 5) can do the same for each chunk: thou is accepted only where person and number match the slot.
- I3. Run a proper ablation for each layer of the translator, as the paper does: remove one component, measure, and report. Keep the copy only as a measurement, not as a built-in.
- I4. The fine-tuned GPT-2 is not for Mova. The count form is "pick the most frequent chunk that passes the constraints", which is the encoder rule with a filter.
For Mova
The code is en/src/lin.rs for the templates and tools/translate (profile.rs) for the hard filter. The paper's central claim, that explicit structure does most of the work, fits Mova's design. The ablation is the measure to copy.
Cite
@inproceedings{agnew2023mechanical,
title = {{The Mechanical Bard: An Interpretable Machine Learning Approach to Shakespearean Sonnet Generation}},
author = {Agnew, Edwin and Qiu, Michelle and Zhu, Lily and Wiseman, Sam and Rudin, Cynthia},
booktitle = {Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers)},
year = {2023},
doi = {10.18653/v1/2023.acl-short.140},
url = {https://doi.org/10.18653/v1/2023.acl-short.140}
}References
- John Benhardt, Peter Hase, Liuyi Zhu, and Cynthia Rudin. 2018. Shall I compare thee to a machine-written sonnet? An approach to algorithmic sonnet generation. find
- Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. 2017. Enriching word vectors with subword information. Transactions of the association for computational linguistics, 5:135–146. ↗
- Carnegie Mellon University CMU. 2019. The CMU pronouncing dictionary. http://www.speech.cs.cmu.edu/cgi-bin/cmudict, Internet. ↗
- Pablo Gervás. 2000. Wasp: Evaluation of different strategies for the automatic generation of spanish verse. In Proceedings of the AISB-00 Symposium on Creative & Cultural Aspects of AI, pages 93–100. find
- Marjan Ghazvininejad, Xing Shi, Yejin Choi, and Kevin Knight. 2016. Generating topical poetry. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 1183–1191. find
- Jey Han Lau, Trevor Cohn, Timothy Baldwin, Julian Brooke, and Adam Hammond. 2018. Deep-speare: A joint neural model of poetic language, meter and rhyme. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1948–1958, Melbourne, Australia. Association for Computational Linguistics. find
- Ruli Manurung, Graeme Ritchie, and Henry Thompson. 2000. Towards a computational model of poetry generation. https://era.ed.ac.uk/handle/1842/3460. ↗
- George A Miller. 1998. WordNet: An electronic lexical database. MIT press. find
- Hugo Gonçalo Oliveira. 2012. Poetryme: a versatile platform for poetry generation. Computational Creativity, Concept Invention, and General Intelligence, 1:21. find
- Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019. Language models are unsupervised multitask learners. https://github.com/openai/gpt-2. ↗
- Tim Van de Cruys. 2020. Automatic poetry generation from prosaic text. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 2471–2480, Online. Association for Computational Linguistics. find
- Tony Veale. 2013. Less rhyme, more reason: Knowledge-based poetry generation with feeling, insight and wit. In Proceedings of the Fourth International Conference on Computational Creativity, ICCC 2013, Sidney, Australia, June 12-14, 2013, pages 152–159. computationalcreativity.net. find
- Jianyou Wang, Xiaoxuan Zhang, Yuren Zhou, Christopher Suh, and Cynthia Rudin. 2021. There once was a really bad poet, it was automated but you didn’t know it. find
This page in Markdown → https://md.mova.elamur.ai/free/en/docs/papers/agnew-2023-mechanical-bard-interpretable-machine-learning/