HarmonyTok: Comparing Methods for Harmony Tokenization for Machine Learning
This paper explores different approaches to harmony tokenization in symbolic music for transformer-based models, focusing on two tasks: masked language modeling (MLM) and melodic harmonization generation. Four tokenization strategies are compared, each varying in how chord information is encoded: (1) as full chord symbols, (2) separated into root and quality, (3) as sets of pitch classes, and (4) as sets of pitch classes where one is designated as a root. A dataset of over 17,000 lead sheet charts is used to train and evaluate RoBERTa for MLM and GPT-2/BART for harmonization. The results show that chord spelling methods—those breaking chords into pitch-class tokens—achieve higher accuracy and lower perplexity, indicating more confident predictions. These methods also produce fewer token-level errors. In harmonization tasks, chunkier tokenizations (with more information per token) generate chords more similar to the original data, while spelling-based methods better preserve structural aspects such as harmonic rhythm and melody–harmony alignment. Audio evaluations reveal that spelling-based models tend toward more generic pop-like harmonizations, while chunkier tokenizations more faithfully reflect the dataset’s style. Overall, while no single tokenization method dominates across all tasks, different strategies may be preferable for specific applications, such as classification or generative style transfer.
Authors
- Μάξιμος Καλιακάτσος-Παπακώστας (ORCID: https://orcid.org/0000-0002-9062-9915)
- Dimos Makris (ORCID: https://orcid.org/0000-0002-4556-4227)
- Vassilis Katsouros (ORCID: https://orcid.org/0000-0002-4185-2344)
- Emilios Cambouropoulos (ORCID: https://orcid.org/0000-0002-6887-4287)
- Konstantinos Soiledis
- Konstantinos-Theodoros Tsamis
Institutions
- Aristotle University of Thessaloniki (GR)
- Mediterranean University (ME)
- Institute for Language and Speech Processing (GR)
- Athena Research and Innovation Center In Information Communication & Knowledge Technologies (GR)
Publication Details
- Journal
- Information
- Published
- 2025-09-01
- DOI
- https://doi.org/10.3390/info16090759
- Primary Topic
- Natural Language Processing Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- European Commission