PactPal: GPT-Driven Legal Contract System

Research Article
Open access

PactPal: GPT-Driven Legal Contract System

Xiaoyi Wang 1* , Jinxuan Wang 2
  • 1 Shandong University of Finance and Economics, Jinan 250014, China    
  • 2 Southwest JiaoTong University, Chengdu 611765, China    
  • *corresponding author 15589782680@163.com
Published on 24 January 2025 | https://doi.org/10.54254/2755-2721/2024.20571
ACE Vol.131
ISSN (Print): 2755-273X
ISSN (Online): 2755-2721
ISBN (Print): 978-1-83558-939-7
ISBN (Online): 978-1-83558-940-3

Abstract

Whenever an ordinary person is called upon to draft a contract for the first time they may be perplexed. In this regard, we have taken advantage of ChatGPT’s ability to consider the particulars of the situations that its clients are in to be able to give them information and advice on the law and to assist laypeople in creating their contracts. This paper presents the design and implementation of the PactPal system, a generation and legal contract management tool based on ChatGPT. Through the incorporation of artificial intelligence, the system presents an enhanced approach to contract generation whereby legal contracts that fulfill the needs of the user can be developed in a short time. We created both medium and high-fidelity prototypes; we improved the user interface, contract generation, and customization options step by step. Based on the user testing, it was found that PactPal enhances the drafting of contracts, minimizes the occurrence of errors in the process, and is a smart tool for legal contract management in the future.

Keywords:

Artificial Intelligence & Law, ChatGPT, Contract, Legal Assistant

Wang,X.;Wang,J. (2025). PactPal: GPT-Driven Legal Contract System. Applied and Computational Engineering,131,117-122.
Export citation

1. Introduction

1.1. Promise

Contracts have been important in business and legal relations for many years, and their significance is growing further today. As legal agreements, contracts stipulate the terms and conditions that parties involved in a transaction must adhere to, ensuring the smooth execution of the transaction and the protection of each party's rights. Contracts are not only applicable in the commercial sector but also extend to employment, leases, partnerships, and other relationships, where they clarify mutual expectations and prevent misunderstandings and legal disputes. By specifying critical details such as delivery times and quality standards, contracts effectively prevent potential conflicts that might arise from oral agreements. Consequently, drafting contracts requires great caution, with comprehensive consideration of all possible scenarios that may occur in a business relationship, in order to maintain a stable business and legal environment [1].

However, one has to come up with and alter contract terms and this may be a very stressful process [2]. It is quite a task to come up with a contract for the first time and be able to make the terms clear while at the same time being sensitive to the parties involved and avoiding the use of ambiguous and contradictory language so that the contract is legally binding. Another source of complexity stems from the fact that when amending contracts, the changes made may also give rise to new disputes or legal issues. Modifications of the contract mean that every single point of the terms has to be discussed again and the new content has to be introduced into the text without repetition and duplication of efforts. Some of the challenges that are usually experienced include. Automated tools such as AI can also be helpful in this process by helping to detect some of the problems with the contract, suggest changes that may need to be made in the contract, and ensure that the same things are written similarly throughout the contract [3]. This not only improves the speed of contractual creation and alteration but also minimizes the possibility of human error, which is vital for the changing legal and commercial environment. As a sophisticated language model, ChatGPT has recently gained a lot of popularity, attention, and ubiquity among the general population, scholars, businesses, and the press. As for interaction, users can perform different text-related tasks by using a free chat interface; developers, in turn, can leverage this model and integrate it into various applications via APIs, which means that there will be numerous products created with the help of ChatGPT [4].Especially, ChatGPT has proven to be highly beneficial in the legal industry [5]. It offers a natural and cross-domain approach to contract creation and editing/alteration and solves the problem of expensive legal services thereby making legal assistance available to users. In this context, contract management products based on artificial intelligence not only increase the speed and effectiveness of contract processing [6], but also provide more affordable and accessible legal services to those who are in the ‘legal desert’ [7].

In the literature, other studies have been made to compare the effectiveness of GPT-4 models in legal text analysis [5]. More specifically, it used GPT-4’s capability to understand legal terms and to reason through legal cases. Based on such studies, it was observed that GPT-4, when provided with clear annotation instructions, is as effective as a law school student who has been trained well. Also, the findings show that GPT-4 is capable of making batch predictions, which makes it more efficient at a lower cost while incurring only a slight reduction in efficiency.

1.2. Related work

In the legal domain, a topic that we are particularly interested in is the application of AI for the automation of contracts. It is understood that Large Language Models (LLMs) are being used for many legal tasks such as the prediction of legal judgments, legal document analysis, and the generation of legal documents [8]. Additionally, ChatGPT can write legal documents [9], and GPT-4 similarly to the legal students, when provided with the annotation guidelines, can identify the meaning of the legal text [5]. Research has established that responses produced by ChatGPT are usually considered more useful than those provided by legal professionals, but there is a risk that ChatGPT may provide wrong information, especially in the legal context, as it may refer to non-existent legal documents [10]. To tackle these problems, we present LawGPT, the first open-source model targeted at Chinese legal tasks, which incorporates legal-focused pre-training and supervised fine-tuning [11].

Similarly, in previous studies, the efficiency of GPT-4 models in legal text analysis tasks has been analyzed [5]. More specifically, they have centered on the capability of GPT-4 in understanding legal terms and comprehending courts’ decisions. Such studies established that when provided with clear instructions on how to handle the answer, GPT-4’s performance is similar to that of law school students who have been trained effectively. Furthermore, the study also reveals that GPT-4 is capable of generating batch predictions thus cutting down costs with only a slight impact on the overall performance.

1.3. Goal

In this paper, our main focus is on the creation of a proper and easy-to-use system with the help of ChatGPT AI that will help users easily prepare and alter legal contracts. Legal contracts are very vital and can not be overlooked in business undertakings and everyday life. Nevertheless, the conventional contract creation procedure is frequently cramped, imprecise, and time-consuming. Our vision is to induce state-of-the-art artificial intelligence in the contract drafting process to deliver an intelligent, efficient, and user-friendly platform to the users. To achieve this goal, our team works on creating an AI-based system that would be able to grasp and analyze legal language and conditions. Through training on a large number of legal documents, GPT will be in a position to develop contract texts that are compliant with industry standards and policies. The user is required to enter basic information of the contract and its requirements, and the system will come up with a draft in no time, thus saving the time that would have been used in drafting. Also, the system will have a simple and intuitive interface whereby users will be able to alter and manipulate the content of the contract. Such features as intelligent assistant prompts and legal clause lookup help users avoid mistakes and omissions in the contracts.

2. Prototype

2.1. Medium-fidelity prototype

In the process of advancing the goal of efficient contract drafting, we showcased the medium-fidelity prototype of PactPal, which is one of the key initial models we developed using Figma. During the development of the medium-fidelity prototype, we focused on the following aspects:

User Interface: We initially designed a simple and intuitive user interface that allows users to easily input basic contract information. This interface includes core functionalities for contract generation and modification. Taking the drafting of a lease agreement as an example, users can input personal information, select the type of lease, and set rent and deposit terms. By simulating the real contract generation process, we ensured the system's operability and responsiveness.

/word/media/image1.jpeg

(a) Chatgpt generate the contract (b) Personalized modifications (c) Retrieve the contract

Figure 1. User Interface simulated by Figma

It is noted that the entire page on the left can be edited at any time according to the different needs of users, as shown in Fig.1.

ii. Contract Generation Logic: In the medium-fidelity stage, we implemented the automatic generation of contract terms for the first time. Users only need to input basic information, and the system will generate a legally compliant draft based on built-in contract templates. To verify the system's accuracy, we conducted multiple internal tests to ensure that the generated contract content is legally binding and meets industry standards.

iii. User Feedback Collection: We invited several potential users to participate in testing the medium-fidelity prototype. By observing users' actions and gathering their feedback during the usage process, we identified shortcomings in the interface design and recorded users' needs for accuracy in contract generation and customization features.

Table 1. Statistic data of the survey

Question 1: What issues do you typically encounter during the routine revision of contracts?

Options

Count

Percentage

Uncertainty about how to modify specific clauses

9

75%

Difficulty in understanding legal terminology

5

41.67%

Inconsistencies in the format and structure of contract clauses

2

16.67%

Difficulty in ensuring the legal compliance of contract clauses

10

83.33%

Valid Responses for This Question

12

Question 2: What content do you think the GPT contract suggestions in the sidebar should include to improve the efficiency of contract revisions?

Options

Count

Percentage

Detailed explanations of user modifications

4

33.33%

References to relevant legal provisions

6

50%

Examples of similar practice contracts

2

16.67%

Valid Responses for This Question

12

Question 3: If we were to update the product, which improvements or new features would you most like to see?

Options

Count

Percentage

Provide more legal clause templates and examples

3

25%

Enhance explanations and assistance with legal terminology

6

50%

Offer automatic validation and compliance checks for contract clauses

8

66.67%

Add contract version comparison and tracking features

7

58.33%

Valid Responses for This Question

12

The survey highlights a significant demand for features that ensure legal compliance and clarity, especially through automation and authoritative legal references. Users are less concerned with format consistency and more focused on modifying clauses accurately and understanding complex legal terms. Accordingly, we should revise our system that be able to offer compliance checks, legal references, and enhanced explanations to address these user needs.

In summary, PactPal represents significant progress in our intelligent contract drafting platform, designed to demonstrate the system's core functionalities and user interaction experience. The medium-fidelity prototype enhanced the intuitiveness and efficiency of contract drafting through a user-friendly interface. The achievements at this stage validated the core functionalities of the system and laid the foundation for the development of the high-fidelity prototype and further optimization of the system.

2.2. High-fidelity Prototype

After collecting and analyzing user feedback from the medium-fidelity prototype, we developed the high-fidelity prototype of PactPal to further enhance the system's functionality and user experience. The high-fidelity prototype includes the following improvements:

Enhanced User Interface: We redesigned the user interface with more visually appealing color schemes and layouts, making the system more modern and user-friendly. Users can now preview the information they input in real time, which helps to prevent errors during data entry. Additionally, the system has added a real-time legal clause lookup feature, allowing users to consult relevant laws and regulations while drafting contracts.

/word/media/image2.png

Figure 2. Basic User interface with chatgpt-4o

As shown in Fig.2, the page on the left allows for basic text editing, while the GPT on the right provides real-time information retrieval and Q&A assistance.

Intelligent Contract Generation: The high-fidelity prototype significantly improved the level of intelligence in contract generation. The system can now dynamically adjust contract terms based on the user's personalized needs. This includes generating appropriate contract formats based on different types of leases (e.g., commercial, residential) and automatically adding relevant legal clauses to ensure the contract's comprehensiveness and legal compliance.

User Testing and Optimization: Based on the feedback of the user testing, as revealed in Table.1, we have refined our user interface(UI) design to better meet the needs of our users. We have enhanced the contract modification functionality, assisting users in more clearly tracking the parts of the contract that require amendments. We attempted to have the original testers reuse the PactPal system. The results showed significant improvements in the interaction between Pactpal and users. However, we currently are unable to integrate the capability for the quick location of the relevant legal provisions within the contract.

3. Conclusion

The development and testing of the PactPal system, from medium-fidelity to high-fidelity prototypes, have validated its effectiveness in legal contract generation and management. In the medium-fidelity phase, we initially tested the basic contract generation functionalities and gathered user feedback, which provided a foundation for subsequent optimizations. The high-fidelity phase focused on enhancing the user interface and intelligent features, significantly improving the user experience. Testing has shown that PactPal can quickly and accurately generate contracts that meet user needs, earning widespread recognition. In the future, we will continue to optimize the system and expand its applications in the legal field to provide a more comprehensive legal service platform.

Acknowledgement

Xiaoyi Wang and Jinxuan Wang contributed equally to this work and should be considered co-first authors.


References

[1]. E. A. Zacks, ‘The Moral Hazard of Contract Drafting’, Fla. St. U. L. Rev., vol. 42, p. 991, 2015 2014.

[2]. S. Williams, "Contractual Complexity, " Delaware Journal of Corporate Law, vol. 1, no. 3.

[3]. F. Martin-Bariteau and M. Pavlovic, ‘AI and Contract Law’, Feb. 01, 2021, Rochester, NY: 3730385. Accessed: Aug. 27, 2024. [Online]. Available: https://papers.ssrn.com/abstract=3730385

[4]. J. Tan, H. Westermann, and K. Benyekhlef, ‘ChatGPT as an Artificial Lawyer?’.

[5]. J. Savelka, K. D. Ashley, M. A. Gray, H. Westermann, and H. Xu, ‘Can GPT-4 Support Analysis of Textual Data in Tasks Requiring Highly Specialized Domain Expertise?’, Jun. 24, 2023. doi: 10.1145/3587102.3588792.

[6]. S. Williams, ‘Generative Contracts’, 2024, Rochester, NY: 4582753. [Online]. Available: https://papers.ssrn.com/abstract=4582753

[7]. M. Lauritsen, Q. Steenhuis, Substantive legal software quality: A gathering storm?, in: Proceedings of the Seventeenth International Conference on Artificial Intelligence and Law, 2019, pp. 52–62.

[8]. Z. Sun, ‘A Short Survey of Viewing Large Language Models in Legal Aspect’, Mar. 16, 2023, arXiv: arXiv:2303.09136. Accessed: Aug. 21, 2024. [Online]. Available: http://arxiv.org/abs/2303.09136

[9]. A. M. Perlman, et al., The implications of openai’s assistant for legal services and society, Available at SSRN (2022).

[10]. B. Guo, X. Zhang, Z. Wang, M. Jiang, J. Nie, Y. Ding, J. Yue, Y. Wu, How close is chatgpt to human experts? comparison corpus, evaluation, and detection, arXiv preprint arXiv:2301.07597 (2023).

[11]. Z. Zhou et al., “LawGPT: A Chinese Legal Knowledge-Enhanced Large Language Model, ” Jun. 06, 2024, arXiv: arXiv:2406.04614. Accessed: Aug. 24, 2024. [Online]. Available: http://arxiv.org/abs/2406.04614


Cite this article

Wang,X.;Wang,J. (2025). PactPal: GPT-Driven Legal Contract System. Applied and Computational Engineering,131,117-122.

Data availability

The datasets used and/or analyzed during the current study will be available from the authors upon reasonable request.

Disclaimer/Publisher's Note

The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of EWA Publishing and/or the editor(s). EWA Publishing and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

About volume

Volume title: Proceedings of the 2nd International Conference on Machine Learning and Automation

ISBN:978-1-83558-939-7(Print) / 978-1-83558-940-3(Online)
Editor:Mustafa ISTANBULLU
Conference website: https://2024.confmla.org/
Conference date: 21 November 2024
Series: Applied and Computational Engineering
Volume number: Vol.131
ISSN:2755-2721(Print) / 2755-273X(Online)

© 2024 by the author(s). Licensee EWA Publishing, Oxford, UK. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license. Authors who publish this series agree to the following terms:
1. Authors retain copyright and grant the series right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this series.
2. Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the series's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial publication in this series.
3. Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See Open access policy for details).

References

[1]. E. A. Zacks, ‘The Moral Hazard of Contract Drafting’, Fla. St. U. L. Rev., vol. 42, p. 991, 2015 2014.

[2]. S. Williams, "Contractual Complexity, " Delaware Journal of Corporate Law, vol. 1, no. 3.

[3]. F. Martin-Bariteau and M. Pavlovic, ‘AI and Contract Law’, Feb. 01, 2021, Rochester, NY: 3730385. Accessed: Aug. 27, 2024. [Online]. Available: https://papers.ssrn.com/abstract=3730385

[4]. J. Tan, H. Westermann, and K. Benyekhlef, ‘ChatGPT as an Artificial Lawyer?’.

[5]. J. Savelka, K. D. Ashley, M. A. Gray, H. Westermann, and H. Xu, ‘Can GPT-4 Support Analysis of Textual Data in Tasks Requiring Highly Specialized Domain Expertise?’, Jun. 24, 2023. doi: 10.1145/3587102.3588792.

[6]. S. Williams, ‘Generative Contracts’, 2024, Rochester, NY: 4582753. [Online]. Available: https://papers.ssrn.com/abstract=4582753

[7]. M. Lauritsen, Q. Steenhuis, Substantive legal software quality: A gathering storm?, in: Proceedings of the Seventeenth International Conference on Artificial Intelligence and Law, 2019, pp. 52–62.

[8]. Z. Sun, ‘A Short Survey of Viewing Large Language Models in Legal Aspect’, Mar. 16, 2023, arXiv: arXiv:2303.09136. Accessed: Aug. 21, 2024. [Online]. Available: http://arxiv.org/abs/2303.09136

[9]. A. M. Perlman, et al., The implications of openai’s assistant for legal services and society, Available at SSRN (2022).

[10]. B. Guo, X. Zhang, Z. Wang, M. Jiang, J. Nie, Y. Ding, J. Yue, Y. Wu, How close is chatgpt to human experts? comparison corpus, evaluation, and detection, arXiv preprint arXiv:2301.07597 (2023).

[11]. Z. Zhou et al., “LawGPT: A Chinese Legal Knowledge-Enhanced Large Language Model, ” Jun. 06, 2024, arXiv: arXiv:2406.04614. Accessed: Aug. 24, 2024. [Online]. Available: http://arxiv.org/abs/2406.04614