Abstract
ContractSense AI is a production-ready Retrieval-Augmented Generation (RAG) web application that analyzes legal contracts for risk, surfaces dangerous clauses, and enables interactive question-answering over uploaded PDF documents. The system combines FastAPI with LangChain orchestration, a locally running sentencetransformer embedding model (all-MiniLM-L6-v2), and the Groq-hosted Llama 3.3 70B large language model for fast inference. A custom NumpyVectorStore provides lightweight vector similarity search without external database dependencies. The frontend features an animated Three.js landing page and a fully interactive threepanel dashboard with risk gauge, red-flag cards, TL;DR summary, and RAG-powered conversational chat. All embedding computation runs locally — no cloud embedding API is required — making the system inherently privacy-preserving and cost-free to operate at the inference layer. The system is designed for deployment on standard personal computing hardware without requiring GPU acceleration, making it accessible to students, freelancers, and small organisations with limited IT infrastructure.
Keywords
Retrieval-Augmented Generation, Legal Document Analysis, Large Language Models, FastAPI, LangChain, Sentence Transformers, Risk Assessment, Vector Similarity Search, Groq, Natural Language Processing.
References
[1] Lewis, P., et al. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. NeurIPS 2020.
[2] Reimers, N., & Gurevych, I. (2019). Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks.
EMNLP 2019.
[3] LangChain Documentation. (2024). LangChain: Building Applications with LLMs.
https://docs.langchain.com
[4] Groq Inc. (2024). Groq LPU Inference Engine. https://console.groq.com/docs
[5] FastAPI Documentation. (2024). FastAPI: High Performance Web Framework. https://fastapi.tiangolo.com
[6] Hugging Face. (2024). all-MiniLM-L6-v2. https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2
[7] Johnson, J., Douze, M., & Jegou, H. (2019). Billion-scale similarity search with GPUs. IEEE Trans. Big Data.
[8] Three.js. (2024). Three.js JavaScript 3D Library. https://threejs.org
[2] Reimers, N., & Gurevych, I. (2019). Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks.
EMNLP 2019.
[3] LangChain Documentation. (2024). LangChain: Building Applications with LLMs.
https://docs.langchain.com
[4] Groq Inc. (2024). Groq LPU Inference Engine. https://console.groq.com/docs
[5] FastAPI Documentation. (2024). FastAPI: High Performance Web Framework. https://fastapi.tiangolo.com
[6] Hugging Face. (2024). all-MiniLM-L6-v2. https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2
[7] Johnson, J., Douze, M., & Jegou, H. (2019). Billion-scale similarity search with GPUs. IEEE Trans. Big Data.
[8] Three.js. (2024). Three.js JavaScript 3D Library. https://threejs.org