Loading... Loading...
Grenze Logo
GRENZE International Journal of Engineering and Technology Vol. 12 (2026), Issue 1

Legal Contract Analyzer using LLM and RAG

Authors

S. Poornima, K Elankumaran, M Nandhana, B Parthasarathy, V Sudharshan

Abstract

This project presents a Legal Contract Analyzer that helps users understand contracts, and identify risks, by applying a Retrieval-Augmented Generation (RAG) model, based on Large Language Models (LLMs). The program pulls in text from the uploaded PDF contracts using Docling and turns that text into smaller chunks, after which it embeds each chunk semantically using the Sentence-Transformers all-mpnet-base-v2 model. Once the embeddings are created, they are inserted into a FAISS database that facilitates the subsequent retrieval of each of the clauses. The program assesses the most relevant clauses to pre-set categories including, payment, liability, termination, and confidentiality for example, and then breaks the clauses down using the Zephyr-7B model on Hugging Face. The model summarizes the key terms, assesses possible risks, then makes recommendations on ways to mitigate those risks. By combining document analysis, semantic search, and AI-facilitated reasoning, the project eliminates manual effort, enhances risk detection, and provides a way for legal specialists and non-specialists to read and comprehend complex contracts with greater simplicity.