{"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/nl2tl-transforming-natural-languages-to","title":"NL2TL: Transforming Natural Languages to Temporal Logics using Large Language Models","arxiv_id":"2305.07766","date":"2023-05-12","proceeding":null,"authors":["Yongchao Chen","Rujul Gandhi","Yang Zhang","Chuchu Fan"],"abstract":"Temporal Logic (TL) can be used to rigorously specify complex high-level specification for systems in many engineering applications. The translation between natural language (NL) and TL has been under-explored due to the lack of dataset and generalizable model across different application domains. In this paper, we propose an accurate and generalizable transformation framework of English instructions from NL to TL, exploring the use of Large Language Models (LLMs) at multiple stages. Our contributions are twofold. First, we develop a framework to create a dataset of NL-TL pairs combining LLMs and human annotation. We publish a dataset with 28K NL-TL pairs. Then, we finetune T5 models on the lifted versions (i.e., the specific Atomic Propositions (AP) are hidden) of the NL and TL. The enhanced generalizability originates from two aspects: 1) Usage of lifted NL-TL characterizes common logical structures, without constraints of specific domains. 2) Application of LLMs in dataset creation largely enhances corpus richness. We test the generalization of trained models on five varied domains. To achieve full NL-TL transformation, we either combine the lifted model with AP recognition task or do the further finetuning on each specific domain. During the further finetuning, our model achieves higher accuracy (>95%) using only <10% training data, compared with the baseline sequence to sequence (Seq2Seq) model.","url_abs":"https://arxiv.org/abs/2305.07766v2","url_pdf":"https://arxiv.org/pdf/2305.07766v2.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":"nl2tl-transforming-natural-languages-to","repo_url":"https://github.com/yongchao98/nl2tl","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"nl2tl-transforming-natural-languages-to","repo_url":"https://github.com/yongchao98/autotamp","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":null},{"paper_slug":"nl2tl-transforming-natural-languages-to","repo_url":"https://github.com/yongchao98/multi-agent-framework","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":null}],"tasks":[],"methods":[{"method_slug":"adafactor","method_name":"Adafactor"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"glu","method_name":"Gated Linear Unit"},{"method_slug":"inverse-square-root-schedule","method_name":"Inverse Square Root Schedule"},{"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":"residual-connection","method_name":"Residual Connection"},{"method_slug":"sentencepiece","method_name":"SentencePiece"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"t5","method_name":"T5"},{"method_slug":"test","method_name":"Test"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2305.07766","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2305.07766"}},"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/yongchao98/multi-agent-framework","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yongchao98/nl2tl","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yongchao98/autotamp","reach":null}],"summary":{"ran_draft_wrong":3,"ran_honours":2,"unverified":4},"by_repo_kind":{"official":{"samples":6,"ran":3,"repositories":1},"listed":{"samples":1,"ran":0,"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":8,"samples":[{"code_sha256_prefix":"324537dd7c7ee111","entry":"asMinutes","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"324537dd7c7ee111"}},{"code_sha256_prefix":"a10e0524abb72afc","entry":"indexesFromSentence","repo":"yongchao98/nl2tl","repo_kind":"official","path":"Seq2seq_lifted_all.py","file_url":"https://github.com/yongchao98/nl2tl/blob/HEAD/Seq2seq_lifted_all.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a10e0524abb72afc"}},{"code_sha256_prefix":"2f8ba8dd578384f7","entry":"tensorFromSentence","repo":"yongchao98/nl2tl","repo_kind":"official","path":"Seq2seq_lifted_all.py","file_url":"https://github.com/yongchao98/nl2tl/blob/HEAD/Seq2seq_lifted_all.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2f8ba8dd578384f7"}},{"code_sha256_prefix":"fa494e62b36f2905","entry":"tensorsFromPair","repo":"yongchao98/nl2tl","repo_kind":"official","path":"Seq2seq_lifted_all.py","file_url":"https://github.com/yongchao98/nl2tl/blob/HEAD/Seq2seq_lifted_all.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fa494e62b36f2905"}},{"code_sha256_prefix":"c0a5b7ee10788222","entry":"timeSince","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"c0a5b7ee10788222"}},{"code_sha256_prefix":"f0ae9cdb9d876012","entry":"GPT_NL2TL","repo":"yongchao98/autotamp","repo_kind":"listed","path":"openai_func.py","file_url":"https://github.com/yongchao98/autotamp/blob/HEAD/openai_func.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":"f0ae9cdb9d876012"}},{"code_sha256_prefix":"68852ccced579e14","entry":"showPlot","repo":"yongchao98/nl2tl","repo_kind":"official","path":"Seq2seq_lifted_all.py","file_url":"https://github.com/yongchao98/nl2tl/blob/HEAD/Seq2seq_lifted_all.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"68852ccced579e14"}},{"code_sha256_prefix":"9387acc0db57213e","entry":"train","repo":"yongchao98/nl2tl","repo_kind":"official","path":"Seq2seq_lifted_all.py","file_url":"https://github.com/yongchao98/nl2tl/blob/HEAD/Seq2seq_lifted_all.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9387acc0db57213e"}},{"code_sha256_prefix":"b335324a1ce33652","entry":"trainIters","repo":"yongchao98/nl2tl","repo_kind":"official","path":"Seq2seq_lifted_all.py","file_url":"https://github.com/yongchao98/nl2tl/blob/HEAD/Seq2seq_lifted_all.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b335324a1ce33652"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}