{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/compound-word-transformer-learning-to-compose","title":"Compound Word Transformer: Learning to Compose Full-Song Music over Dynamic Directed Hypergraphs","arxiv_id":"2101.02402","date":"2021-01-07","proceeding":null,"authors":["Wen-Yi Hsiao","Jen-Yu Liu","Yin-Cheng Yeh","Yi-Hsuan Yang"],"abstract":"To apply neural sequence models such as the Transformers to music generation tasks, one has to represent a piece of music by a sequence of tokens drawn from a finite set of pre-defined vocabulary. Such a vocabulary usually involves tokens of various types. For example, to describe a musical note, one needs separate tokens to indicate the note's pitch, duration, velocity (dynamics), and placement (onset time) along the time grid. While different types of tokens may possess different properties, existing models usually treat them equally, in the same way as modeling words in natural languages. In this paper, we present a conceptually different approach that explicitly takes into account the type of the tokens, such as note types and metric types. And, we propose a new Transformer decoder architecture that uses different feed-forward heads to model tokens of different types. With an expansion-compression trick, we convert a piece of music to a sequence of compound words by grouping neighboring tokens, greatly reducing the length of the token sequences. We show that the resulting model can be viewed as a learner over dynamic directed hypergraphs. And, we employ it to learn to compose expressive Pop piano music of full-song length (involving up to 10K individual tokens per song), both conditionally and unconditionally. Our experiment shows that, compared to state-of-the-art models, the proposed model converges 5--10 times faster at training (i.e., within a day on a single GPU with 11 GB memory), and with comparable quality in the generated music.","url_abs":"https://arxiv.org/abs/2101.02402v1","url_pdf":"https://arxiv.org/pdf/2101.02402v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"compound-word-transformer-learning-to-compose","repo_url":"https://github.com/YatingMusic/compound-word-transformer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"unanswered"}},{"paper_slug":"compound-word-transformer-learning-to-compose","repo_url":"https://github.com/Natooz/MidiTok","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"compound-word-transformer-learning-to-compose","repo_url":"https://github.com/yuer867/emo-disentanger","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"compound-word-transformer-learning-to-compose","repo_url":"https://github.com/carlosholivan/musicaiz","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"none","reach":{"status":"unanswered"}},{"paper_slug":"compound-word-transformer-learning-to-compose","repo_url":"https://github.com/s-omranpour/Music-Generation","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"unanswered"}}],"tasks":[{"task_slug":null,"task_name":"GPU"},{"task_slug":"music-generation","task_name":"Music Generation"}],"methods":[{"method_slug":"absolute-position-encodings","method_name":"Absolute Position Encodings"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"label-smoothing","method_name":"Label Smoothing"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"position-wise-feed-forward-layer","method_name":"Position-Wise Feed-Forward Layer"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"transformer","method_name":"Transformer"}],"datasets_introduced":[{"slug":"ailabs1k7","name":"ailabs1k7","full_name":"AIlabs.tw Pop1K7"}],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2101.02402","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2101.02402"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yuer867/emo-disentanger","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/carlosholivan/musicaiz","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/s-omranpour/Music-Generation","reach":{"status":"unanswered"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/YatingMusic/remi","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Natooz/MidiTok","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/YatingMusic/compound-word-transformer","reach":{"status":"unanswered"}}],"summary":{"ran":3,"unverified":6},"by_repo_kind":{"listed":{"samples":9,"ran":3,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"e74a0089372f5f25","entry":"MultiHeadCrossAttn","repo":"yuer867/emo-disentanger","repo_kind":"listed","path":"stage1_compose/model/optimus_txl_decoder.py","file_url":"https://github.com/yuer867/emo-disentanger/blob/HEAD/stage1_compose/model/optimus_txl_decoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e74a0089372f5f25"}},{"code_sha256_prefix":"8a40eebd3f2277dd","entry":"RelPartialLearnableMultiHeadAttn","repo":"yuer867/emo-disentanger","repo_kind":"listed","path":"stage1_compose/model/optimus_txl_decoder.py","file_url":"https://github.com/yuer867/emo-disentanger/blob/HEAD/stage1_compose/model/optimus_txl_decoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8a40eebd3f2277dd"}},{"code_sha256_prefix":"169c0b8a3fa64163","entry":"WordEmbedding","repo":"yuer867/emo-disentanger","repo_kind":"listed","path":"stage1_compose/model/optimus_txl_decoder.py","file_url":"https://github.com/yuer867/emo-disentanger/blob/HEAD/stage1_compose/model/optimus_txl_decoder.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"169c0b8a3fa64163"}},{"code_sha256_prefix":"4e77f33db530a79a","entry":"OptimusTXLDecoder","repo":"yuer867/emo-disentanger","repo_kind":"listed","path":"stage1_compose/model/optimus_txl_decoder.py","file_url":"https://github.com/yuer867/emo-disentanger/blob/HEAD/stage1_compose/model/optimus_txl_decoder.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4e77f33db530a79a"}},{"code_sha256_prefix":"1b3864723e0753c3","entry":"RelLearnableDecoderLayer","repo":"yuer867/emo-disentanger","repo_kind":"listed","path":"stage1_compose/model/optimus_txl_decoder.py","file_url":"https://github.com/yuer867/emo-disentanger/blob/HEAD/stage1_compose/model/optimus_txl_decoder.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1b3864723e0753c3"}},{"code_sha256_prefix":"fa5d0870ee5677a9","entry":"RelLearnableMultiHeadAttn","repo":"yuer867/emo-disentanger","repo_kind":"listed","path":"stage1_compose/model/optimus_txl_decoder.py","file_url":"https://github.com/yuer867/emo-disentanger/blob/HEAD/stage1_compose/model/optimus_txl_decoder.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"fa5d0870ee5677a9"}},{"code_sha256_prefix":"f0aec7eb13b95e92","entry":"RelMultiHeadAttn","repo":"yuer867/emo-disentanger","repo_kind":"listed","path":"stage1_compose/model/optimus_txl_decoder.py","file_url":"https://github.com/yuer867/emo-disentanger/blob/HEAD/stage1_compose/model/optimus_txl_decoder.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f0aec7eb13b95e92"}},{"code_sha256_prefix":"bd98b4c481a677b5","entry":"RelPartialLearnableDecoderLayer","repo":"yuer867/emo-disentanger","repo_kind":"listed","path":"stage1_compose/model/optimus_txl_decoder.py","file_url":"https://github.com/yuer867/emo-disentanger/blob/HEAD/stage1_compose/model/optimus_txl_decoder.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bd98b4c481a677b5"}},{"code_sha256_prefix":"65e3c462206adcba","entry":"SegmentEmbeddingProj","repo":"yuer867/emo-disentanger","repo_kind":"listed","path":"stage1_compose/model/optimus_txl_decoder.py","file_url":"https://github.com/yuer867/emo-disentanger/blob/HEAD/stage1_compose/model/optimus_txl_decoder.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"65e3c462206adcba"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}