{"id":{"repo_id":"texas-state","oai_identifier":"oai:digital.library.txst.edu:10877/23441"},"canonical_url":"https://search.ndltd.org/etd/texas-state/oai:digital.library.txst.edu:10877/23441","repository":{"repo_id":"texas-state","name":"Texas State University","base_url":"https://digital.library.txst.edu/server/oai/request"},"display":{"title":"Towards Characterizing Machine Learning Contracts using Large Language Models","abstract":"Machine Learning (ML) contracts formally describe expected behavior and constraints before calling ML APIs. In practice, developers rely on incomplete docs or informal Q&A, leading to subtle misuses and contract violations. We address this by using Retrieval-Augmented Generation (RAG) with large language models (LLMs) to automatically characterize multi-label ML contracts from Stack Overflow posts: semantically similar, labeled examples are retrieved and paired with a concise taxonomy primer to produce structured labels across multiple levels. Beyond labeling, we additionally synthesize executable Python PyContracts with brief natural-language summaries and actionable fixes, and validate them via a lightweight Judge LLM plus a human-in-the-loop review that ensures contracts reproduce the reported fault and then pass after minimal repair. Our approach achieves up to 0.86 F1-score on challenging labels, processes posts in 3–5s at low cost, produces insights rated 75–80% relevant but only 25–30% actionable, and both GPT and Claude reach 100% executable PyContracts after guided repair. On a human-annotated corpus, retrieval-guided prompting improves label quality, and the contract stage attains high compile/run rates while guiding targeted fixes. This provides a practical bridge from informal Q&A to enforceable, verified ML contracts. We demonstrate practical utility through a VS Code extension that integrates our RAG-based contract detection and PyContract generation directly into the development workflow, enabling real-time violation detection, automated contract synthesis with iterative feedback loops, and interactive violation analysis with comprehensive label explanations.","abstract_html":"Machine Learning (ML) contracts formally describe expected behavior and constraints before calling ML APIs. In practice, developers rely on incomplete docs or informal Q&amp;A, leading to subtle misuses and contract violations. We address this by using Retrieval-Augmented Generation (RAG) with large language models (LLMs) to automatically characterize multi-label ML contracts from Stack Overflow posts: semantically similar, labeled examples are retrieved and paired with a concise taxonomy primer to produce structured labels across multiple levels. Beyond labeling, we additionally synthesize executable Python PyContracts with brief natural-language summaries and actionable fixes, and validate them via a lightweight Judge LLM plus a human-in-the-loop review that ensures contracts reproduce the reported fault and then pass after minimal repair. Our approach achieves up to 0.86 F1-score on challenging labels, processes posts in 3–5s at low cost, produces insights rated 75–80% relevant but only 25–30% actionable, and both GPT and Claude reach 100% executable PyContracts after guided repair. On a human-annotated corpus, retrieval-guided prompting improves label quality, and the contract stage attains high compile/run rates while guiding targeted fixes. This provides a practical bridge from informal Q&amp;A to enforceable, verified ML contracts. We demonstrate practical utility through a VS Code extension that integrates our RAG-based contract detection and PyContract generation directly into the development workflow, enabling real-time violation detection, automated contract synthesis with iterative feedback loops, and interactive violation analysis with comprehensive label explanations.","abstract_has_math":false,"creators":["Mohammed Abdul, Wasay"],"institution":"Texas State University","degree_name":"Master of Science","degree_level":"Masters","degree_discipline":"Computer Science","degree_department":"Computer Science","school":null,"contributors":[],"advisors":["Ahmed, Shibbir"],"committee_chairs":[],"committee_members":["Podorozhny, Rodion","Chen, Xiao"],"year":2025,"date_issued":"2025-12","date_published":"2025-12","updated_at":"2026-11-20T16:09:35Z","subjects":["machine learning","ML","contracts","specifications","RAG","LLMs","AI"],"languages":["en"],"rights":[],"rights_urls":[],"identifier_entries":[{"key":"dc:identifier.citation","label":"Dc Identifier Citation","values":["Mohammed Abdul, W. (2025). Towards characterizing machine learning contracts using large language models. [Master's thesis, Texas State University]."],"render_values":[{"text":"Mohammed Abdul, W. (2025). Towards characterizing machine learning contracts using large language models. [Master's thesis, Texas State University].","href":null,"code":true}]}],"person_identifier_entries":[]},"links":{"outbound_url":"https://hdl.handle.net/10877/23441","outbound_label":"Handle","outbound_source":"dc:identifier.uri","record_url":"https://hdl.handle.net/10877/23441","record_label":"Repository record","record_kind":"handle","record_source":"dc:identifier.uri","access_status":null,"embargo_until":null,"access_note":null},"oai_pmh_record":{"url":"https://union.ndltd.org/oai-pmh/?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai%3Aunion.ndltd.org%3Arepo%3Atexas-state%3Aoai%3Adigital.library.txst.edu%3A10877%2F23441","prefix":"oai_dc"},"source_record":{"url":"https://digital.library.txst.edu/server/oai/request?verb=GetRecord&metadataPrefix=dim&identifier=oai%3Adigital.library.txst.edu%3A10877%2F23441","prefix":"dim"},"metadata_groups":[{"id":"people","label":"People","entries":[{"key":"dc:contributor.advisor","label":"Advisor","values":["Ahmed, Shibbir"]},{"key":"dc:contributor.committeemember","label":"Committee Member","values":["Podorozhny, Rodion","Chen, Xiao"]},{"key":"dc:contributor.department","label":"Department","values":["Computer Science"]},{"key":"dc:creator","label":"Author","values":["Mohammed Abdul, Wasay"]}]},{"id":"academic_context","label":"Academic Context","entries":[{"key":"dc:date.accessioned","label":"Dc Date Accessioned","values":["2025-12-08T14:31:09Z"]},{"key":"dc:date.issued","label":"Date","values":["2025-12"]},{"key":"dc:type","label":"Dc Type","values":["Thesis"]},{"key":"thesis:degree_department","label":"Department","values":["Computer Science"]},{"key":"thesis:degree_discipline","label":"Discipline","values":["Computer Science"]},{"key":"thesis:degree_level","label":"Degree Level","values":["Masters"]},{"key":"thesis:degree_name","label":"Degree Name","values":["Master of Science"]},{"key":"thesis:institution_name","label":"Thesis Institution Name","values":["Texas State University"]}]},{"id":"subjects_keywords","label":"Subjects and Keywords","entries":[{"key":"dc:subject","label":"Dc Subject","values":["machine learning","ML","contracts","specifications","RAG","LLMs","AI"]}]},{"id":"language_rights","label":"Language and Rights","entries":[{"key":"dc:language.iso","label":"Language (ISO)","values":["en"]}]},{"id":"identifiers","label":"Identifiers","entries":[{"key":"dc:identifier.citation","label":"Dc Identifier Citation","values":["Mohammed Abdul, W. (2025). Towards characterizing machine learning contracts using large language models. [Master's thesis, Texas State University]."]},{"key":"dc:identifier.uri","label":"Identifier URI","values":["https://hdl.handle.net/10877/23441"]}]},{"id":"additional","label":"Additional Metadata","entries":[{"key":"dc:description.abstract","label":"Abstract","values":["Machine Learning (ML) contracts formally describe expected behavior and constraints before calling ML APIs. In practice, developers rely on incomplete docs or informal Q&A, leading to subtle misuses and contract violations. We address this by using Retrieval-Augmented Generation (RAG) with large language models (LLMs) to automatically characterize multi-label ML contracts from Stack Overflow posts: semantically similar, labeled examples are retrieved and paired with a concise taxonomy primer to produce structured labels across multiple levels. Beyond labeling, we additionally synthesize executable Python PyContracts with brief natural-language summaries and actionable fixes, and validate them via a lightweight Judge LLM plus a human-in-the-loop review that ensures contracts reproduce the reported fault and then pass after minimal repair. Our approach achieves up to 0.86 F1-score on challenging labels, processes posts in 3–5s at low cost, produces insights rated 75–80% relevant but only 25–30% actionable, and both GPT and Claude reach 100% executable PyContracts after guided repair. On a human-annotated corpus, retrieval-guided prompting improves label quality, and the contract stage attains high compile/run rates while guiding targeted fixes. This provides a practical bridge from informal Q&A to enforceable, verified ML contracts. We demonstrate practical utility through a VS Code extension that integrates our RAG-based contract detection and PyContract generation directly into the development workflow, enabling real-time violation detection, automated contract synthesis with iterative feedback loops, and interactive violation analysis with comprehensive label explanations."]},{"key":"dc:embargo.terms","label":"Dc Embargo Terms","values":["This thesis is under a 1-year embargo. The full-text (PDF) will be made available in December 2026."]},{"key":"dc:format","label":"Dc Format","values":["Text"]},{"key":"dc:format.extent","label":"Dc Format Extent","values":["55 pages"]},{"key":"dc:format.medium","label":"Dc Format Medium","values":["1 file (.pdf)"]},{"key":"dc:title","label":"Title","values":["Towards Characterizing Machine Learning Contracts using Large Language Models"]},{"key":"others:access_status","label":"Others Access Status","values":["embargo"]}]}],"canonical_facts":{"dc:contributor.advisor":["Ahmed, Shibbir"],"dc:contributor.committeemember":["Podorozhny, Rodion","Chen, Xiao"],"dc:contributor.department":["Computer Science"],"dc:creator":["Mohammed Abdul, Wasay"],"dc:date.accessioned":["2025-12-08T14:31:09Z"],"dc:date.issued":["2025-12"],"dc:description.abstract":["Machine Learning (ML) contracts formally describe expected behavior and constraints before calling ML APIs. In practice, developers rely on incomplete docs or informal Q&A, leading to subtle misuses and contract violations. We address this by using Retrieval-Augmented Generation (RAG) with large language models (LLMs) to automatically characterize multi-label ML contracts from Stack Overflow posts: semantically similar, labeled examples are retrieved and paired with a concise taxonomy primer to produce structured labels across multiple levels. Beyond labeling, we additionally synthesize executable Python PyContracts with brief natural-language summaries and actionable fixes, and validate them via a lightweight Judge LLM plus a human-in-the-loop review that ensures contracts reproduce the reported fault and then pass after minimal repair. Our approach achieves up to 0.86 F1-score on challenging labels, processes posts in 3–5s at low cost, produces insights rated 75–80% relevant but only 25–30% actionable, and both GPT and Claude reach 100% executable PyContracts after guided repair. On a human-annotated corpus, retrieval-guided prompting improves label quality, and the contract stage attains high compile/run rates while guiding targeted fixes. This provides a practical bridge from informal Q&A to enforceable, verified ML contracts. We demonstrate practical utility through a VS Code extension that integrates our RAG-based contract detection and PyContract generation directly into the development workflow, enabling real-time violation detection, automated contract synthesis with iterative feedback loops, and interactive violation analysis with comprehensive label explanations."],"dc:embargo.terms":["This thesis is under a 1-year embargo. The full-text (PDF) will be made available in December 2026."],"dc:format":["Text"],"dc:format.extent":["55 pages"],"dc:format.medium":["1 file (.pdf)"],"dc:identifier.citation":["Mohammed Abdul, W. (2025). Towards characterizing machine learning contracts using large language models. [Master's thesis, Texas State University]."],"dc:identifier.uri":["https://hdl.handle.net/10877/23441"],"dc:language.iso":["en"],"dc:subject":["machine learning","ML","contracts","specifications","RAG","LLMs","AI"],"dc:title":["Towards Characterizing Machine Learning Contracts using Large Language Models"],"dc:type":["Thesis"],"others:access_status":["embargo"],"thesis:degree_department":["Computer Science"],"thesis:degree_discipline":["Computer Science"],"thesis:degree_level":["Masters"],"thesis:degree_name":["Master of Science"],"thesis:institution_name":["Texas State University"]},"updated_at":"2026-11-20T16:09:35Z"}