| 研究生: |
王彥婷 Wang, Yan-Ting |
|---|---|
| 論文名稱: |
基於檢索增強生成與大型語言模型之住宅租賃契約條款層級法律風險分析系統 A Clause-Level Legal Risk Analysis System for Residential Lease Agreements Based on Large Language Models and Retrieval-Augmented Generation |
| 指導教授: |
李怡志
蔡炎龍 |
| 口試委員: | 謝吉隆 |
| 學位類別: |
碩士
Master |
| 系所名稱: |
傳播學院 - 數位內容碩士學位學程 Digital Content and Technologies |
| 論文出版年: | 2026 |
| 畢業學年度: | 114 |
| 語文別: | 中文 |
| 論文頁數: | 70 |
| 中文關鍵詞: | 住宅租賃契約 、契約風險辨識 、生成式AI 、大型語言模型 、檢索增強生成 、可解釋人工智慧 、法律科技 |
| 外文關鍵詞: | Residential Lease Agreement, Contract Risk Detection, Generative AI, Large Language Model (LLM), Retrieval-Augmented Generation (RAG), Explainable AI (XAI), Legal Technology (LegalTech) |
| 相關次數: | 點閱:48 下載:0 |
| 分享至: |
| 查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報 |
本研究目標開發並初步驗證一套承租人導向之住宅租賃契約風險辨識系統。住宅租賃契約常由出租人或仲介方預先擬定,承租人於簽約前通常面臨時間壓力、法律知識不足與契約文字難以理解等問題,因而不易即時辨識契約中之不利條款。為回應簽約前之風險辨識需求,本研究結合大型語言模型與檢索增強生成技術,建立條款層級之租屋契約風險偵測流程。
本研究所開發之系統以《住宅租賃定型化契約應記載及不得記載事項》為主要法規知識基礎,先將契約文字切分為可獨立分析之條款單位,再針對每一條款進行向量檢索,取得候選法規,並由大型語言模型依條款文字、候選法規與風險規則輸出結構化判斷。系統將條款分為違法、高風險、須注意與無明顯違法四級,並提供白話說明、採用法規與檢索證據,以提升輸出結果之可理解性與可追溯性。
研究資料來自 52 份真實租屋契約,經去識別化與排除重複或高度重複文本後,正式驗證資料包含 30 份契約、共 1,663 筆條款。實驗結果顯示,系統在最關鍵之違法條款偵測上,13 筆人工標註為違法之條款全數檢出,召回率(Recall)達 1.0000、偽陰性率(FNR)為 0.0000,未發生任何漏判;第一層風險偵測之召回率亦達 0.8372,錯誤型態以高召回、低漏判為主,符合簽約前風險篩檢工具「寧可多提醒、不可漏警示」之設計定位。四級條款分類之整體準確率達 0.9327;總體平均 F1 分數(Macro F1)為 0.5730,主要反映真實契約中安全條款本即占絕大多數之資料特性。違法偵測之 Precision 為 0.2955,係高敏感度設計於類別不平衡下之預期成本。
法規依據檢索與採用方面,在 13 筆具人工標註法規(expected_law)之違法案例中,Hit@1、Hit@2 與平均倒數排名(MRR)均為 1.0000,正確法規皆於檢索第一順位命中;RAG 輔助風險判定之法規採用正確率(Law Selection Accuracy)與風險等級正確率(Severity Accuracy)亦均為 1.0000,使每一項風險判斷皆可回溯至具體法規依據。此部分因案例數量較少且法源類型集中,定位為小規模初步驗證。
就目前資料範圍而言,本研究提出之逐條款 RAG 架構已可作為住宅租賃契約簽約前之審閱輔助工具。其主要貢獻在於將租賃契約審閱任務轉化為逐條可查證、可追溯之條款層級分析流程,並建立分類、階層式風險區辨、法規檢索、法規採用與錯誤歸因等多層次評估方式。惟本研究仍受限於法規知識庫範圍、標註資料規模與類別分布、外部 OCR 與 LLM 服務依賴,以及尚未進行使用者研究等因素。未來可擴充法規知識庫、增加專家複核資料、細化違法與高風險判準,並透過使用者研究檢驗系統在真實簽約情境中的理解與決策輔助效果。
This study aims to develop and preliminarily validate a tenant-oriented risk detection system for residential lease agreements. In Taiwan's rental housing market, lease contracts are often drafted in advance by landlords or intermediaries, while tenants usually face time pressure, limited legal knowledge, and difficulty understanding legal language before signing. As a result, tenants may fail to identify disadvantageous clauses in time. To address this pre-signing review need, this study integrates large language models and retrieval-augmented generation to build a clause-level rental contract risk detection workflow.
The proposed system uses Taiwan's “Mandatory and Prohibitory Provisions of Standard Residential Lease Contracts” as its primary legal knowledge base. Contract text is first segmented into analyzable clause units. Each clause is then used to retrieve candidate legal provisions through vector search, and a large language model produces structured judgments based on the clause text, retrieved legal provisions, and predefined risk rules. The system classifies clauses into four levels: ILLEGAL, HIGH-RISK, NOTICE, and SAFE. It also provides plain-language explanations, selected legal bases, and retrieval evidence to improve interpretability and traceability.
The dataset was collected from 52 real rental agreements. After de-identification and removal of duplicate or highly similar documents, the formal evaluation set contained 30 contracts and 1,663 clauses. On the most critical task of illegal clause detection, the system identified all 13 manually labeled illegal clauses, achieving a recall of 1.0000 and a false negative rate of 0.0000; no illegal clause was missed. First-level risk screening likewise achieved a recall of 0.8372, an error profile of high recall and few misses that matches the intended role of a pre-signing risk screening tool. The overall four-class classification accuracy reached 0.9327, while the Macro F1 of 0.5730 mainly reflects the naturally dominant share of safe clauses in real contracts. The precision of 0.2955 for illegal detection is an expected cost of the high-sensitivity design under class imbalance. For legal provision retrieval, Hit@1, Hit@2, and MRR all reached 1.0000 among the 13 cases with expected_law annotations, meaning the correct legal provision was always ranked first; Law Selection Accuracy and Severity Accuracy in the RAG-assisted evaluation also reached 1.0000, so every risk judgment can be traced back to a concrete legal basis. Given the limited number and concentrated types of annotated cases, these retrieval results should be read as a small-scale preliminary validation.
Within the scope of the current dataset, the proposed clause-level RAG architecture can serve as a pre-signing review support tool for residential lease agreements. Its main contribution is to transform lease contract review into a traceable clause-level analysis workflow and to establish a multi-level evaluation framework covering classification, hierarchical risk distinction, legal provision retrieval, law selection, and error attribution. The study remains limited by the scope of the legal knowledge base, the size, representativeness, and class distribution of annotated data, reliance on external OCR and LLM services, and the absence of user studies. Future work may expand the legal knowledge base, increase expert-reviewed annotations, refine the boundary between illegal and high-risk clauses, and evaluate the system's effect on tenant understanding and decision-making in real signing contexts.
謝辭 i
摘要 iii
Abstract v
目次 vii
表次 xi
圖次 xiii
第一章 緒論 1
第一節 研究背景與動機 1
第二節 問題陳述 2
第三節 大型語言模型與檢索增強生成介入之必要性 3
第四節 研究目的與研究問題 3
第五節 研究範圍與限制 5
第六節 論文架構 5
第二章 文獻探討 7
第一節 台灣租屋市場結構與承租人特性 7
一、 租屋市場之非典型特徵 7
二、 承租人特性 8
第二節 住宅租賃法律規範架構 8
一、 《租賃管理條例》與《消費者保護法》之適用演變 8
二、 《住宅租賃定型化契約應記載及不得記載事項》 9
第三節 常見租屋糾紛之類型學分析 10
一、 租屋糾紛之實務數據分析 11
二、 契約文字陷阱之類型 11
三、 非契約性行為風險與研究範圍 12
第四節 承租人決策行為之理論分析 12
一、 有限理性(Bounded Rationality) 12
二、 認知負荷理論(Cognitive Load Theory) 13
三、 資訊處理理論(Information Processing Theory) 13
四、 樂觀偏誤與現狀偏差(Optimism Bias and Status Quo Bias) 13
第五節 契約文件分析與條款層級自然語言處理 14
第六節 大型語言模型與檢索增強生成技術應用 14
一、 大型語言模型之發展與能力 14
二、 法律科技應用之挑戰 15
三、 檢索增強生成技術(Retrieval-Augmented Generation, RAG) 15
第七節 人工智慧契約審閱之概況 16
一、 Lawsnote DocPie 16
二、 LegalSign.ai 17
三、 現有產品設計思維之侷限 17
第八節 小結 17
第三章 系統設計與研究方法 18
第一節 系統需求分析 18
一、 功能需求 18
二、 非功能需求 19
第二節 系統架構概述 21
第三節 法規向量知識庫建置與 RAG 檢索流程 23
第四節 契約風險分析流程 24
第五節 四級風險分級架構 26
第六節 前端呈現設計 27
一、 前端介面截圖 28
第七節 研究資料與人工標註 32
第八節 實驗設計 33
第九節 評估指標 34
第四章 系統實作、驗證結果與分析 38
第一節 評估資料集之風險分布與初步觀察 38
第二節 條款層級風險分類結果 39
第三節 四級風險分類混淆矩陣 41
第四節 階層式風險區辨結果 42
一、 第一層:SAFE vs RISK 42
二、 第二層:風險嚴重程度分類 44
三、 第三層:違法條款偵測 45
第五節 法規依據檢索結果 46
第六節 RAG 輔助風險等級判定結果 47
第七節 錯誤分析 48
一、 SAFE 被誤判為風險 48
二、 NOTICE 類別判斷不穩 49
三、 HIGH-RISK 與 ILLEGAL 的邊界混淆 50
四、 法源引用與 RAG 使用行為觀察 51
第八節 不同技術方法之架構特性比較 51
第九節 綜合討論 53
第十節 小結 54
第五章 結論與未來研究 55
第一節 研究結論 55
第二節 研究問題回應 57
一、 對研究問題一之回應:如何將格式不一之住宅租賃契約,轉換為可進行條款層級風險分析的結構化單位? 57
二、 對研究問題二之回應:如何建置住宅租賃法規知識庫,並透過 RAG 檢索為契約條款提供可追溯之外部法規依據? 58
三、 對研究問題三之回應:如何結合 RAG、LLM 與後端規則,將租賃契約條款分類為違法、高風險、須注意或無明顯違法? 58
四、 對研究問題四之回應:如何設計系統輸出,使風險判斷同時具備白話可理解性與法規依據可追溯性? 59
五、 對研究問題五之回應:在真實租賃契約資料上,本研究系統於風險分類、法規檢索、法規採用與錯誤型態上呈現何種表現與限制? 60
第三節 研究貢獻 61
一、 實務貢獻 61
二、 系統設計貢獻 61
三、 評估方法貢獻 62
第四節 實務意涵 63
第五節 研究限制 63
第六節 未來研究方向 65
第七節 結語 67
參考文獻 68
中文文獻
七法股份有限公司. (n.d.). Lawsnote DocPie:契約自動生成 × AI 審閱. Lawsnote DocPie. https://docpie.lawsnote.com/
內政部. (2025年4月18日). 住宅租賃定型化契約應記載及不得記載事項. 內政部主管法規查詢系統. https://glrs.moi.gov.tw/LawContent.aspx?id=GL000907
內政部地政司. (n.d.). 內政部教您破解網傳惡房東詐騙坑殺房客手法 [宣導文件]. 內政部全球資訊網.
內政部統計處. (2024年11月16日). 113年第46週內政統計通報. 內政部全球資訊網. https://ws.moi.gov.tw/Download.ashx?u=LzAwMS9VcGxvYWQvNDAwL3JlbGZpbGUvMC8yMTA5NS9kOWI1ODNhNS0xNDU4LTQ0MjMtOTM3Yy02YWNmNGU0MjBkMjQucGRm&n=MTEz5bm056ysNDbpgLHlhafmlL%2fntbHoqIjpgJrloLFf56ef6YeR57Wx6KiILnBkZg%3d%3d&icon=.pdf
內政部營建署. (2017). 104年住宅狀況抽樣調查報告. https://pip.moi.gov.tw/Upload/sys/study/869.pdf
民法. (2021年1月20日修正). 全國法規資料庫. https://law.moj.gov.tw/LawClass/LawParaDeatil.aspx?pcode=B0000001&bp=52
行政院主計總處. (2021年8月31日). 109年人口及住宅普查初步統計結果. https://www.stat.gov.tw/public/Attachment/1831151816OM26MHO7.pdf
行政院消費者保護處. (2016). 個人房東適用消保法與否之疑義(院臺消保字第1050165274號函)[行政函釋].
律果科技. (n.d.). LegalSign.ai. https://legalsign.ai/
消費者保護法. (2015年6月17日修正). 全國法規資料庫. https://law.moj.gov.tw/LawClass/LawAll.aspx?pcode=J0170001
租賃住宅市場發展及管理條例. (2023年2月8日修正). 全國法規資料庫. https://law.moj.gov.tw/LawClass/LawAll.aspx?pcode=D0060125
財團法人崔媽媽基金會. (2025). 歷年租屋糾紛案件統計數據[未出版原始資料].
郭曜逵. (2003). 台灣大專生住宿問題:從租賃住宅市場與學校宿舍供應探討其政策含意 [碩士論文,國立臺灣大學]. 臺灣博碩士論文知識加值系統. https://hdl.handle.net/11296/2sgq5v
廖慶安. (2024年11月25日). 台灣租屋市場的蛻變 [投影片]. 臺北市政府地政局臺北地政講堂. https://www-ws.gov.taipei/001/Upload/305/relfile/11455/4360/71f21365-8c89-41db-9d7f-2e5e4968caa1.pdf
審計部. (2023). 111年度中央政府總決算審核報告:第2冊. https://auditreport.audit.gov.tw/Book/Chapter/63825704915934420373e84d2baa784a468b74d267da716fa4
謝蕎卉. (2014). 租賃之爭:以東吳大學校外租賃糾紛問題為例 [碩士論文,東吳大學]. 臺灣博碩士論文知識加值系統. https://hdl.handle.net/11296/dp3799
英文文獻
Atkinson, R. C., & Shiffrin, R. M. (1968). Human memory: A proposed system and its control processes. In K. W. Spence & J. T. Spence (Eds.), The psychology of learning and motivation (Vol. 2, pp. 89–195). Academic Press. https://doi.org/10.1016/S0079-7421(08)60422-3
Chalkidis, I., Jana, A., Hartung, D., Bommarito, M., Androutsopoulos, I., Katz, D. M., & Aletras, N. (2022). LexGLUE: A benchmark dataset for legal language understanding in English. In S. Muresan, P. Nakov, & A. Villavicencio (Eds.), Proceedings of the 60th annual meeting of the Association for Computational Linguistics (Volume 1: Long papers) (pp. 4310–4330). Association for Computational Linguistics. https://doi.org/10.18653/v1/2022.acl-long.297
Guha, N., Nyarko, J., Ho, D. E., Ré, C., Chilton, A., Narayana, A., Chohlas-Wood, A., Peters, A., Waldon, B., Rockmore, D. N., Zambrano, D., Talisman, D., Hoque, E., Surani, F., Fagan, F., Sarfaty, G., Dickinson, G. M., Porat, H., Hegland, J., … Li, Z. (2023). LegalBench: A collaboratively built benchmark for measuring legal reasoning in large language models. Advances in Neural Information Processing Systems, 36, 44123–44279. https://proceedings.neurips.cc/paper_files/paper/2023/hash/89e44582fd28ddfea1ea4dcb0ebbf4b0-Abstract-Datasets_and_Benchmarks.html
Hendrycks, D., Burns, C., Chen, A., & Ball, S. (2021). CUAD: An expert-annotated NLP dataset for legal contract review. arXiv. https://doi.org/10.48550/arXiv.2103.06268
Kahneman, D. (2011). Thinking, fast and slow. Farrar, Straus and Giroux.
Koreeda, Y., & Manning, C. D. (2021). ContractNLI: A dataset for document-level natural language inference for contracts. In M.-F. Moens, X. Huang, L. Specia, & S. W.-t. Yih (Eds.), Findings of the Association for Computational Linguistics: EMNLP 2021 (pp. 1907–1919). Association for Computational Linguistics. https://doi.org/10.18653/v1/2021.findings-emnlp.164
Lewis, P., Perez, E., Piktus, A., Petroni, F., Karpukhin, V., Goyal, N., Küttler, H., Lewis, M., Yih, W.-t., Rocktäschel, T., Riedel, S., & Kiela, D. (2020). Retrieval-augmented generation for knowledge-intensive NLP tasks. Advances in Neural Information Processing Systems, 33, 9459–9474. https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html
Llama Team. (2024, July 23). The Llama 3 herd of models. AI at Meta. https://ai.meta.com/research/publications/the-llama-3-herd-of-models/
Marotta-Wurgler, F. (2011). Will increased disclosure help? Evaluating the recommendations of the ALI’s Principles of the Law of Software Contracts. The University of Chicago Law Review, 78(1), 165–186.
OpenAI. (2023). GPT-4 technical report. arXiv. https://doi.org/10.48550/arXiv.2303.08774
Pipitone, N., & Alami, G. H. (2024). LegalBench-RAG: A benchmark for retrieval-augmented generation in the legal domain. arXiv. https://doi.org/10.48550/arXiv.2408.10343
Simon, H. A. (1978). Rationality as process and as product of thought. American Economic Review, 68(2), 1–16.
Sweller, J. (1988). Cognitive load during problem solving: Effects on learning. Cognitive Science, 12(2), 257–285. https://doi.org/10.1016/0364-0213(88)90023-7
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., & Polosukhin, I. (2017). Attention is all you need. Advances in Neural Information Processing Systems, 30, 5998–6008. https://papers.nips.cc/paper_files/paper/2017/hash/3f5ee243547dee91fbd053c1c4a845aa-Abstract.html
全文公開日期 2028/08/26