LEX-BOT (Personal Law Assistant)
Aditya Bhadra | Aditya Narayan Saha | Tania Karmakar | Prof. Kaushik Roy Choudhury |
Dept. of Computer Science and | Dept. of Computer Science and | Dept. of Computer Science and | Dept. of Computer Science and |
Engineering | Engineering | Engineering | Engineering |
JIS College Of Engineering, | JIS College Of Engineering, | JIS College Of Engineering, | JIS College Of Engineering, |
Kalyani. | Kalyani. | Kalyani. | Kalyani. |
Kalyani, India | Kalyani, India | Kalyani, India | Kalyani, India |
Abstract— Lex-Bot is an Indian Law and AI powered chatbot that targets places with low levels of knowledge about law. It uses the Llama 3.2 architecture, Lex-Bot has made by finetuning the transformer with a dataset prepared using Indian Constitution and its amendment acts, CrPC and IPC. With this specialized training, Lex-Bot can generate different legal responses efficiently. The chatbot shows how NLP can bridge the gap in access to legal help. Especially for individuals without immediate access to help related to legal problems. Lex-Bot. Lex-Bot offers the users a smooth platform and user-friendly interface that is easy to use and can be used both on Personal Computers and Mobile devices. Lex-Bot offers users proper guidance when it comes to legal aid and whenever they need urgent legal help. Lex-Bot offers various forms of legal help including civil law, criminal law, and constitutional matters. Our chatbot stands out from other chatbots in a way that it is different from others. It has a broader goal of giving access to law to the groups of people who do not have both time and money to spare for constitutional help. Lex-Bot uses AI technology for a big social benefit. Lex-Bot is the perfect demonstration which shows how Ai can help in growth of legal informatics.
Keywords— AI-powered chatbot, Legal informatics, Indian Penal Code (IPC), Code of Criminal Procedure (CrPC), Indian Constitution, Legal assistance, Natural Language Processing (NLP), Access to justice, Legal education, AI in law.
I. INTRODUCTION
In a country as big a India in can be very difficult for anyone to access legal help especially if they are not familiar with the formalities of the country. Lex-Bot is an advanced AI tool which uses the advanced Llama 3.2 and dataset with are gathered using the Indian Penal Code (IPC), Code of Criminal Procedure (CrPC), and the Indian Constitution. Lex- Bot provides the user seamless interaction while using the website and it can help the user in various legal help including legal help, civil law, and constitutional law. Lex-Bot simplifies and then provides the user with a response that can be easily understood by anyone thus giving the user a cost- effective option compared to the ones currently
available. By addressing the currently faced barriers in our legal system Lex-Bot provides us with an easy a helpful solution thus paving the way for AI in legal sectors.
II. LITERATURE SURVEY
The development of Lex-Bot is down to advancement of Artificial Intelligence (AI) and Natural Language (NLP). Thus, addressing the Legal problems.
1. AI in Legal Assistance
AL’s integration in Legal Assistance has seen a big Growth since the introduction of ROSS intelligence and CaseMine. Also, studies demonstrate AI’s importance in legal help and show that in can help legal research [1]. However, most of the legal tools that are available are for the US citizens and that cannot be implemented in India because of the linguistic diversity and distinct diversities.
2. NLP for Legal Texts
Legal texts are characterized by complex terms, Legal terms as well case sensitive information. Research focuses on the domain specific fine tuning of AI model to increase the performance output [2]. Models like GPT-3 and Llama can be easily fine- tuned to match specific needs and then it shows that they can provide all the necessary results that were hoped for. Thus, also adding NLP to further more enhance the needed outcome.
3. Challenges in Indian Legal Systems
India is a blend of different diversities and different laws. Studies highlights the limited resources available for the people living in rural areas and the text of legal documents sometimes become too difficult for them to understand [3]
Lex-Bot emphasizes on giving legal help with easy- to-understand text so that people from all parts of our country can easily understand
4. Chatbots for Legal Assistance
Legal chatbots have emerged as an important tool for legal research. (e.g., Sushil et al., 2021) identifies key factors for their success: accurate intent recognition, contextual understanding, and ethical considerations like data privacy [4]. Existing system such as DoNotPay shows us the potential of AI in the sector of Law and Legal research.
5. Dataset Creation and Llama Applications
The creation of High-quality dataset for Indian Law is very crucial. Research (e.g., Chalkidis et al., 2021) [5], shows the need for high quality legislative texts based on the Indian law. Llama models, as shown by Touvron et al. (2023) [6], are very useful for domain specific work thus making it the perfect platform for Lex-Bot
This shows the potential of AI in the sector of Law and Legal Research.
III. METHODOLOGY
The development of Lex-Bot was made possible because of the proper planned way of creating it. It was done in a phase wise manner so that we can assure the user with proper and accurate results that were easy to access and easy to understand.
1. Requirement Analysis
Key barriers that were faced by the people of our country while accessing legal help is that the cost of the legal help is very high and complexity of the help sometimes become too much for normal citizens to understand. People living in the rural areas have no such access to legal help thus making an AI tool which can help most of the country was important
2. Dataset Creation and Preparation
Legal texts from public resources and legal datasets from public sectors were obtained and thus a proper dataset was created.
Preprocessing was done by cleaning, tokenization, and formatting to ensure consistency. A proper dataset was created to ensure proper understanding for Lex-Bot so that it can provide proper legal help. Data augmentation supplemented this with the help of FAQs and ensured better understanding.
3. Model Selection and Training
The Llama 3.2 model was used for its advanced NLP capabilities and adaptability towards fine tuning. The model was trained of the manufactured dataset as mentioned before to ensure accurate results. Hyperparameters such as the size of batch were set later to prevent overfitting
4. System Design and Development
A user-friendly design for the Lex-Bot website was created to ensure that whenever a user uses our website, they can experience a smooth and responsive environment. Login and account creation facilities were also provided by us so that a user can save the data they have previously viewed.
5. Natural Language Processing and Response Generation
NLP techniques were used to generate response from user inputs and extract legal texts. Contextual analysis made sure whether the user is asking for constitutional or criminal laws. The responses include legitimate legal suggestions as well as further steps to access legal help and a response which is tailored to the users’ needs.
6. Testing and Validation
Unit testing and Individual component testing was done to ensure an accurate representation of what we what to do. User responses were taken from law students as well as people working for law firms to ensure that our chatbot is showing accurate results that were promised.
7. Deployment and Maintenance
Lex-Bot was launched on a cloud-based platform to ensure easy accessibility to users. Constant updates and monitoring ensure that the chatbot worked properly.
8. Future Enhancements
Planned improvements include included language settings so that people from all over the country can easily access our chatbot without the language barrier and document drafting
This shows that Lex-Bot is reliable, Trustworthy and it learn with the user so that it can provide proper help.
IV. PROPOSED METHOD
Lex-Bot is a chatbot we made that give help in legal things using Indian laws. We used machine learning and NLP (natural language processing) so that it can understand users’ question and give legally correct answer. We followed many steps like collecting data, training, testing and making simple interface.
1. Collection and Preparing Data
For make bot smart, we needed good data. So, we collected many legal documents and examples from internet.
i. Data that has been used for training
- Indian Penal Code – It has rules about
- Code of Criminal Procedure – It says what to do when a crime happens.
- Constitution of India – For citizen rights and rules of country.
- Some case law – To show real
- FAQs and some made-up questions – So bot can learn more types.
ii. Process and the Cleaning of the Data
- We deleted some symbols and wrong things and repetition of lines.
- Then we make the format same for all data so model can learn nicely.
- Tagging the Data: We separated the text into types like criminal law or Constitutional rights law.
- Also, we wrote what is the meaning of the
2. Model Training (Llama 3.2)
We used a model name Llama 3.2. It is big AI that can understand and give answer.
i. Why We Use Llama 3.2
- It is good with understanding natural language and can handle legal words.
- It is open weight LLM and can be used commercially and can be fine-tuned.
ii. Training Step
- We trained the model with our law dataset
- It learns the words, sections and law terms and gave answers in easy language.
iii. Checking Training
- We used precision, F1 score to see how good the model is giving an answer.
- Some results were okay, some not so we trained again with changes.
3. Understanding Questions (NLP Part)
Lex-Bot use NLP to find what user is asking and then give answer from data.
i. Understanding What User Mean:
- It finds if the question is about rights or crime or court rule.
- It also picks words like section 498A or article 21.
- Giving the Answer: It searches in its data and matches the right info.
ii. Response Generation:
- Mapping queries to the most relevant sections of the dataset for accurate
- Simplifying legal provisions into accessible language for user clarity.
4. Structure of the system
We made a website where user can type question and get a reply.
i. Frontend Design
- Intuitive- We made login and register page. Also search box, history of old questions and nice design.
ii. Backend Infrastructure
- Fine- We hosted finetune Llama model on web cloud. Used API to connect backend and frontend for smooth connection.
5. Testing phase of Lex-Bot
i. What We Tested
- We typed many different questions that people ask. Checked if the bot giving right and clear answer.
ii. What We Checked
- We saw if answer is useful, not confusing and also correct.
6. Deployment and Maintenance of Lex-Bot
i. Creating a Webpage for Deployment
- We put Lex-Bot on a web browser so that people can use it from anywhere and
- Used CI/CD for updating without stopping the bot and kept It Running.
- We checked it every day if it is
- Also updating it with new laws
7. Future Targets
i. More Languages
- We want to add Hindi, Bengali and other languages so that more people can use it.
ii. Legal Help Writing
- It can help to write things like contracts, petitions etc.
iii. Interaction with Lawyer
- We plan to add a feature so that user can talk to a real lawyer if needed.
We have made Lex-Bot to help people with law- related problems or questions that cannot be solved by everyone. It is easy to use but it is still not perfect but we will improve in future
Code Drive Link
https://drive.google.com/drive/folders/1dOaT- skSwRD4aAVLum9kOzmXmOKDdXNs?usp=sharin g
V. RESULTS AND DISCUSSION
Working on Lex-Bot gave us a chance to explore how AI could make legal information easier for people to access. We focused on several important aspects during testing: how well the system understood user questions, how useful its answers were, whether users were satisfied, and whether the system could scale as needed. The following part of this paper goes into detail about what we observed and what that might mean going forward.
1. Results
i. Legal Query Understanding
Accuracy: Lex-Bot did quite well when it came to understanding what users were asking. It was able to correctly identify the intent behind queries over 87% of the time, which means it usually knew what kind of legal help the user was looking for.
Contextual Understanding: When users asked questions in everyday language — not in formal legal terms — the model was still able to catch the important parts and connect them with the right legal information. This shows that its contextual understanding of plain-language legal queries was strong.
Named Entity Recognition (NER): Another thing worth noting is how accurately Lex-Bot picked up on specific legal terms and entities, like IPC sections, case names, and procedural rules. Its ability to extract these kinds of details was consistently high, which helped make its responses more precise and useful.
ii. Response Generation
Relevance: Lex-Bot’s responses were generally on point. In over 90% of the test cases, it provided information that was both contextually relevant and accurate, often drawing from trusted sources like the Indian Penal Code (IPC), the Code of Criminal Procedure (CrPC), or the Indian Constitution.
Clarity: One of the standout features was how clearly it explained things. Instead of overwhelming users with legal jargon, it broke down complex terms into simpler, easy-to-understand language. This made the experience a lot more approachable, especially for people without a legal background — and that clarity was something users appreciated during testing.
Figure 1: Generation of Response in CHAT-BOX
iii. User Satisfaction
Ease of Use: The user-friendly interface enabled individuals, including those with no legal background, to interact with Lex-Bot effectively.
Feedback: Users reported an 80% satisfaction rate, praising the chatbot’s ability to provide immediate assistance and simplified legal guidance.
Real-World Application: Test cases included practical legal situations, such as understanding rights during arrests or resolving disputes. Lex-Bot offered actionable insights, increasing user confidence in handling such situations.
iv. Scalability and Performance
Scalability: Lex-Bot’s deployment on cloud-based infrastructure ensured seamless handling of multiple concurrent user queries, with an average response time of less than 3 seconds.
System Uptime: The platform achieved a 99.8% uptime during the testing phase, ensuring reliable availability.
v. Security and Privacy
User data encryption and compliance with privacy protocols ensured that sensitive information was securely handled, fostering trust among users.
2. Discussion
i. Effectiveness of the Proposed Method
In the development of Lex bot, there are many methodological ways of acceptation, along with data acquisition, model fine tuning, and query processing, proved efficiency in building are updated legal assistant. The use of Llama3.2, finetune with legal dataset, and qualified the chatbot to give proper and it was the smart motto in Indian laws
ii. Addressing Legal Literacy
Lex bot makes a huge gap in legal literacy, that for only one person has very finite entry to legal professional, by facilitate hard problems legal jargon and it gives us early support, it authorizes to us to build sensible rights according to their legal actions.
iii. Challenges Encountered
Ambiguity in User Queries: In sometimes we ask or put the not complete or mystical questions or inputs, then it gives us very few answers according to those. After days when the new version when we will be
added then it will give us the proper clarification of our questions and doubts.
The new version of Legal frame works: We assure that the chatbot keeps update with the correction and the legal arrangements are needed for huge strong monitoring procedure.
iv. Limitations
For complicated legal procedure: When the lex bot perfection is very good for normal questions, it is highly accepted that we can build it also for solving critical problems too. These unique key features to need to maintain for occupational legal counsels for high level cases.
Language obstacle: In now days basically Lex bot can assist English. Before that It’s important to enlarge all local languages.
v. User Feedback and Iterative Improvement
The reactions have proven that unnecessary corrective Lex Bot. Person can give their ratings, and their opinions gives us the idea to add the areas like broader areas of law, like family law and property law. These will enhance it and will make for more details in officially for legal details.
Acknowledgment
- We extend our sincere thanks to our Project supervisor Prof. Kaushik Roy Choudhary.
- We would also like to extend our sincere thanks to the whole Dept. of Computer Science and Engineering.
REFERENCES
- Mowbray, A., Chung, P. and Greenleaf, G., 2020. Utilising AI in the legal assistance sector— Testing a role for legal information institutes. Computer Law & Security Review, 38, 105407.
- Satterfield, N., Holbrooka, P. and Wilcoxa, T., 2024. Fine-tuning llama with case law data to improve legal domain performance. OSF Preprints.
- Jayal, N., 2006. Representing India: Ethnic diversity and the governance of public institutions.
- Gromova, E.A., Ferreira, D.B. and Begishev, I.R., 2023. ChatGPT and other intelligent Chatbots: legal, ethical and dispute resolution Revista Brasileira de Alternative Dispute Resolution-Brazilian Journal of Alternative Dispute Resolution-RBADR, 5(10), pp.153-175.
- Greenleaf, V. C. Vivekanandan, P. Chung, R. Singh, and A. Mowbray, “Challenges for free access
to law in a multi-jurisdictional developing country: Building the Legal Information Institute of India,”
- Nat. Law Univ. Delhi, vol. 1, no. 1, pp. 63–93, 2013.
- Ghosh, and Kumar, S., 2024, June. A Survey
of Legal Text Analysis Techniques for Indian Legal Documents. In 2024 International Conference on Circuit, Systems and Communication (ICCSC) (pp. 1-6). IEEE.