{"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/amor-a-recipe-for-building-adaptable-modular","title":"AMOR: A Recipe for Building Adaptable Modular Knowledge Agents Through Process Feedback","arxiv_id":"2402.01469","date":"2024-02-02","proceeding":null,"authors":["Jian Guan","Wei Wu","Zujie Wen","Peng Xu","Hongning Wang","Minlie Huang"],"abstract":"The notable success of large language models (LLMs) has sparked an upsurge in building language agents to complete various complex tasks. We present AMOR, an agent framework based on open-source LLMs, which reasons with external knowledge bases and adapts to specific domains through human supervision to the reasoning process. AMOR builds reasoning logic over a finite state machine (FSM) that solves problems through autonomous executions and transitions over disentangled modules. This allows humans to provide direct feedback to the individual modules, and thus naturally forms process supervision. Based on this reasoning and feedback framework, we develop AMOR through two-stage fine-tuning: warm-up and adaptation. The former fine-tunes the LLM with examples automatically constructed from various public datasets, enabling AMOR to generalize across different knowledge environments, while the latter tailors AMOR to specific domains using process feedback. Extensive experiments across multiple domains demonstrate the advantage of AMOR to strong baselines, thanks to its FSM-based reasoning and process feedback mechanism. The code and data are publicly available at \\url{https://github.com/JianGuanTHU/AMOR}.","url_abs":"https://arxiv.org/abs/2402.01469v2","url_pdf":"https://arxiv.org/pdf/2402.01469v2.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":"amor-a-recipe-for-building-adaptable-modular","repo_url":"https://github.com/jianguanthu/amor","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.01469","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.01469"}},"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":"deterministic:regex_extraction","url":"https://github.com/JianGuanTHU/AMOR","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/jianguanthu/amor","reach":{"status":"ok"}}],"summary":{"ran_fixture":3,"ran":11,"ran_draft_wrong":5,"unverified":5},"by_repo_kind":{"official":{"samples":23,"ran":18,"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":24,"samples":[{"code_sha256_prefix":"30d7eec482ebf6b1","entry":"repeat_kv","repo":"JianGuanTHU/AMOR","repo_kind":"official","path":"code/modeling_llama.py","file_url":"https://github.com/JianGuanTHU/AMOR/blob/HEAD/code/modeling_llama.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":2,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"30d7eec482ebf6b1"}},{"code_sha256_prefix":"3dbe593f2d6f3b4e","entry":"Generator","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3dbe593f2d6f3b4e"}},{"code_sha256_prefix":"6bfe6fa28a5de901","entry":"LlamaAttention","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6bfe6fa28a5de901"}},{"code_sha256_prefix":"572dde6105d00036","entry":"LlamaDynamicNTKScalingRotaryEmbedding","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"572dde6105d00036"}},{"code_sha256_prefix":"06c2cf625cad2b53","entry":"LlamaLinearScalingRotaryEmbedding","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"06c2cf625cad2b53"}},{"code_sha256_prefix":"8e8d8d9e109e9f1e","entry":"LlamaMLP","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8e8d8d9e109e9f1e"}},{"code_sha256_prefix":"50ff7976d78544ac","entry":"LlamaRMSNorm","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"50ff7976d78544ac"}},{"code_sha256_prefix":"88c615c48b7dd37b","entry":"LlamaRotaryEmbedding","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"88c615c48b7dd37b"}},{"code_sha256_prefix":"5fc26624516c1588","entry":"State","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5fc26624516c1588"}},{"code_sha256_prefix":"f725bc2d76076485","entry":"apply_rotary_pos_emb","repo":"JianGuanTHU/AMOR","repo_kind":"official","path":"code/modeling_llama.py","file_url":"https://github.com/JianGuanTHU/AMOR/blob/HEAD/code/modeling_llama.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f725bc2d76076485"}},{"code_sha256_prefix":"9a65a30d006fc96e","entry":"apply_rotary_pos_emb","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"9a65a30d006fc96e"}},{"code_sha256_prefix":"99e4a58eb23854c4","entry":"encode_with_prompt_completion_format","repo":"JianGuanTHU/AMOR","repo_kind":"official","path":"code/finetune.py","file_url":"https://github.com/JianGuanTHU/AMOR/blob/HEAD/code/finetune.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"99e4a58eb23854c4"}},{"code_sha256_prefix":"bd4037a865476156","entry":"get_decompose_prompt","repo":"JianGuanTHU/AMOR","repo_kind":"official","path":"code/prompts.py","file_url":"https://github.com/JianGuanTHU/AMOR/blob/HEAD/code/prompts.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bd4037a865476156"}},{"code_sha256_prefix":"229b36214feed61d","entry":"get_finish_prompt","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"229b36214feed61d"}},{"code_sha256_prefix":"fe65d70569706d67","entry":"get_history_str","repo":"JianGuanTHU/AMOR","repo_kind":"official","path":"code/get_reward.py","file_url":"https://github.com/JianGuanTHU/AMOR/blob/HEAD/code/get_reward.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fe65d70569706d67"}},{"code_sha256_prefix":"5b8b14beaf8deb74","entry":"get_relevance_prompt","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5b8b14beaf8deb74"}},{"code_sha256_prefix":"76fe6fab3919e7d6","entry":"get_solve_prompt","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"76fe6fab3919e7d6"}},{"code_sha256_prefix":"b99eea6376d1e212","entry":"rotate_half","repo":"JianGuanTHU/AMOR","repo_kind":"official","path":"code/modeling_llama.py","file_url":"https://github.com/JianGuanTHU/AMOR/blob/HEAD/code/modeling_llama.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b99eea6376d1e212"}},{"code_sha256_prefix":"8fd91ae45180bf3e","entry":"text_toolkits","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8fd91ae45180bf3e"}},{"code_sha256_prefix":"3df7b70913f4ced7","entry":"LLama","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.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":"3df7b70913f4ced7"}},{"code_sha256_prefix":"358cf499b8ba9ff5","entry":"LlamaDecoderLayer","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.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":"358cf499b8ba9ff5"}},{"code_sha256_prefix":"04e5aaed2ab55a45","entry":"LlamaModel","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.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":"04e5aaed2ab55a45"}},{"code_sha256_prefix":"e1590868abc435b3","entry":"LlamaMoeSparseMoeBlock","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.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":"e1590868abc435b3"}},{"code_sha256_prefix":"0b69caf4cf9368d9","entry":"Manager","repo":"jianguanthu/amor","repo_kind":"official","path":"code/manager.py","file_url":"https://github.com/jianguanthu/amor/blob/HEAD/code/manager.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":"0b69caf4cf9368d9"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}