USING GENERATIVE AI FOR CLASSIFICATION OF LEGAL DOCUMENTS
DOI:
https://doi.org/10.66104/4zsfgz56Palavras-chave:
Judicial Efficiency, Legal Technology, Artificial Intelligence in Law, Procedural Automation, Digital JusticeResumo
The Brazilian judicial system is currently overwhelmed by an enormous backlog of digital lawsuits, making manual case sorting both financially draining and unreliable. This research explores the integration of Generative Artificial Intelligence to streamline the categorization of legal petitions through Large Language Models (LLMs). The study outlines a technical progression divided into three distinct phases. First, a few-shot learning model was tested, resulting in a modest accuracy rate of 56%. Second, the methodology was improved using prompt engineering combined with N-gram analysis and data augmentation strategies to address the issue of skewed datasets. Finally, the research implemented a Retrieval-Augmented Generation (RAG) framework to optimize performance. Using real-world data from the Court of Justice of Tocantins, the experiments demonstrated that the RAG-based system achieved a significant 84% accuracy across 11 complex legal categories. This advanced architecture effectively minimized the occurrence of AI hallucinations and clarified semantic uncertainties often found in legal texts. The findings suggest that this innovative approach provides a reliable and scalable framework for the LegalTech industry, offering a viable path toward modernizing judicial administration. By automating the initial stages of case management, the proposed solution not only enhances operational efficiency but also ensures a higher degree of consistency in the processing of legal documents, ultimately contributing to a more agile and responsive justice system in Brazil and potentially other jurisdictions facing similar digital challenges.
Downloads
Referências
BENTO, F. M.; TEIVE, R. C. G. Classificação de documentos jurı́dicos utilizando a arquitetura transformer: uma análise comparativa com algoritmos tradicionais de Machine Learning e ChatGPT. Brazilian Journal of Development, v. 9, p. 20208–20224, 2023. DOI: https://doi.org/10.34117/bjdv9n6-97
BROWN, T. et al. Language models are few-shot learners. Advances in neural information processing systems, 2020.
DEVLIN, J. et al. BERT: Pre-training of deep bidirectional transformers for language understanding. Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers). [S.l.]: [s.n.]. 2019. p. 4171–4186.
LEWIS, P. et al. Retrieval-augmented generation for knowledge-intensive NLP tasks. Advances in Neural Information Processing Systems. [S.l.]: [s.n.]. 2020. p. 9459–9474.
MAURITZ, B. J. Automatic classification of legal documents. Master’s thesis, Masarykova univerzita. 2018.
SHUKLA, B. et al. Challenges and issues in legal documents classification. AIP Conference Proceedings. 2023. DOI: https://doi.org/10.1063/5.0161060
TEAM, G. et al. Gemini: a family of highly capable multimodal models. arXiv preprint arXiv:2312.11805, 2023.
VASWANI, A. et al. Attention is all you need. Advances in neural information processing systems 30. 2017. p. 5998–6008.
Downloads
Publicado
Edição
Seção
Licença
Copyright (c) 2026 Ruan Dias Santana, Gabriel Reis Nadler Prata, Marcelo da Silva Lisboa, Silvanete Maria da Silva , Marcelo Lisboa Rocha

Este trabalho está licenciado sob uma licença Creative Commons Attribution 4.0 International License.
Autores que publicam nesta revista concordam com os seguintes termos:
- Autores mantém os direitos autorais e concedem à revista o direito de primeira publicação, com o trabalho simultaneamente licenciado sob a Licença Creative Commons Attribution que permite o compartilhamento do trabalho com reconhecimento da autoria e publicação inicial nesta revista;
- Autores têm autorização para assumir contratos adicionais separadamente, para distribuição não-exclusiva da versão do trabalho publicada nesta revista (ex.: publicar em repositório institucional ou como capítulo de livro), com reconhecimento de autoria e publicação inicial nesta revista, desde que adpatado ao template do repositório em questão;
- Autores têm permissão e são estimulados a publicar e distribuir seu trabalho online (ex.: em repositórios institucionais ou na sua página pessoal) a qualquer ponto antes ou durante o processo editorial, já que isso pode gerar alterações produtivas, bem como aumentar o impacto e a citação do trabalho publicado (Veja O Efeito do Acesso Livre).
- Os autores são responsáveis por inserir corretamente seus dados, incluindo nome, palavras-chave, resumos e demais informações, definindo assim a forma como desejam ser citados. Dessa forma, o corpo editorial da revista não se responsabiliza por eventuais erros ou inconsistências nesses registros.
POLÍTICA DE PRIVACIDADE
Os nomes e endereços informados nesta revista serão usados exclusivamente para os serviços prestados por esta publicação, não sendo disponibilizados para outras finalidades ou a terceiros.
Obs: todo o conteúdo do trabalho é de responsabilidade do autor e orientador.
