Proceedings

Semantic Similarity Is Not Legal Correctness: Evaluating RAG Systems in Brazilian Civil Procedure

Download BibTeX Cite

Proceedings of the Thirty-Fifth International Joint Conference on Artificial Intelligence. Main Track. Pages 5919-5927.

https://doi.org/10.24963/ijcai.2026/659

Abstract

Evaluating retrieval-augmented generation (RAG) systems in legal domains is challenging due to the nuanced nature of legal reasoning and scarcity of

domain-specific benchmarks. We investigate semantic similarity and legal correctness in Brazilian legal question answering, developing a synthetic dataset of 3,012 evaluation instances from the Brazilian Civil Procedure Code spanning seven query types, validated through human expert assessment. Our evaluation framework combines BERTScore with domain-adapted LLM-as-Judge (GPT-4o-mini), validated against expert legal assessment. Analysis reveals 50.8% disagreement between semantic similarity and legal correctness, with correlation varying substantially by query type (ρ = 0.464 to ρ = 0.732). Explicit article citation emerges as the strongest quality predictor (Cohen’s d = 1.099), with cited responses achieving 145% higher legal correctness scores. Concrete examples demonstrate bidirectional divergence: responses may achieve high semantic similarity yet cite incorrect articles, or provide legally perfect answers with minimal lexical overlap. Findings demonstrate that semantic metrics alone are insufficient for legal RAG evaluation, with disagreement patterns structured by query type.

  1. [Asai et al., 2023] Akari Asai, Zeqiu Wu, Yizhong Wang, Avirup Sil, and Hannaneh Hajishirzi. Self-rag: Learning to retrieve, generate, and critique through self-reflection. ArXiv, abs/2310.11511, 2023.
  2. [Chalkidis et al., 2020] Ilias Chalkidis, Manos Fergadiotis, et al. LEGAL-BERT: The muppets straight out of law school. In Trevor Cohn, Yulan He, and Yang Liu, editors, Findings of the Association for Computational Linguistics: EMNLP 2020, pages 2898-2904, Online, November 2020. Association for Computational Linguistics. [Douze et al., 2025]
  3. Matthijs Douze, Alexandr Guzhva, Chengqi Deng, Jeff Johnson, Gergely Szilvasy, Pierre- Emmanuel Mazaré, Maria Lomeli, Lucas Hosseini, and Hervé Jégou. The faiss library, 2025.
  4. [Es et al., 2024] Shahul Es, Jithin James, Luis Es- pinosa Anke, and Steven Schockaert. RAGAs: Automated evaluation of retrieval augmented generation. In Nikolaos Aletras and Orphee De Clercq, editors, Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics: System Demonstrations, pages 150-158, St. Julians, Malta, March 2024. Association for Computational Linguistics.
  5. [Gao et al., 2024] Yunfan Gao, Yun Xiong, Xinyu Gao, Kangxiang Jia, Jinliu Pan, Yuxi Bi, Yi Dai, Jiawei Sun, Meng Wang, and Haofen Wang. Retrieval-augmented gen- eration for large language models: A survey, 2024.
  6. [Gao et al., 2025] Mingqi Gao, Xinyu Hu, Xunjian Yin, Jie Ruan, Xiao Pu, and Xiaojun Wan. LLM-based NLG eval- uation: Current status and challenges. Computational Lin- guistics, 51:661-687, June 2025.
  7. [Grattafiori et al., 2024] Aaron Grattafiori, Abhimanyu Dubey, et al. The llama 3 herd of models, 2024.
  8. [Guha et al., 2023a] Neel Guha, Julian Nyarko, et al. Legal- bench: A collaboratively built benchmark for measuring legal reasoning in large language models, 2023.
  9. [Guha et al., 2023b] Neel Guha, Julian Nyarko, et al. Legal- bench: a collaboratively built benchmark for measuring legal reasoning in large language models. In Proceedings of the 37th International Conference on Neural Informa- tion Processing Systems, NIPS '23, Red Hook, NY, USA, 2023.
  10. [Curran Associates Inc. Hu and Zhou, 2024] Taojun Hu and Xiao-Hua Zhou. Un- veiling llm evaluation focused on metrics: Challenges and solutions, 2024.
  11. [Huang and Huang, 2024] Yizheng Huang and Jimmy Huang. A survey on retrieval-augmented text generation for large language models, 2024.
  12. [Huang et al., 2024] Lei Huang, Weijiang Yu, Weitao Ma, Weihong Zhong, Zhangyin Feng, Haotian Wang, Qiang- long Chen, Weihua Peng, Xiaocheng Feng, Bing Qin, and Ting Liu. A survey on hallucination in large language models: Principles, taxonomy, challenges, and open ques- tions. ACM Transactions on Information Systems, Novem- ber 2024.
  13. [Huang et al., 2025] Lei Huang, Weijiang Yu, Weitao Ma, Weihong Zhong, Zhangyin Feng, Haotian Wang, Qian- glong Chen, Weihua Peng, Xiaocheng Feng, Bing Qin, and Ting Liu. A survey on hallucination in large lan- guage models: Principles, taxonomy, challenges, and open questions. ACM Transactions on Information Systems, 43(2):1-55, January 2025.
  14. [Ioannou et al., 2025] Antreas Ioannou, Andreas Shiamishis, Nora Hollenstein, and Nezihe Merve Gürel. Evaluating the limits of large language models in multilingual legal reasoning, 2025.
  15. [Ji et al., 2023] Ziwei Ji, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Ye Jin Bang, Andrea Madotto, and Pascale Fung. Survey of halluci- nation in natural language generation. ACM Computing Surveys, 55(12):1-38, March 2023.
  16. [Jiang et al., 2023] Albert Q. Jiang, Alexandre Sablayrolles, et al. Mistral 7b, 2023.
  17. [Junior et al., 2025] Roseval Malaquias Junior, Ramon Pires, et al. Juru: Legal brazilian large language model from reputable sources, 2025.
  18. [Kalai et al., 2025] Adam Tauman Kalai, Ofir Nachum, San- tosh S. Vempala, and Edwin Zhang. Why language models hallucinate, 2025.
  19. [Kalra et al., 2024] Rishi Kalra, Zekun Wu, et al. HyPA- RAG: A hybrid parameter adaptive retrieval-augmented generation system for AI legal and policy applications. In Sachin Kumar, Vidhisha Balachandran, Chan Young Park, Weijia Shi, Shirley Anugrah Hayati, Yulia Tsvetkov, Noah Smith, Hannaneh Hajishirzi, Dongyeop Kang, and David Jurgens, editors, Proceedings of the 1st Workshop on Cus- tomizable NLP: Progress and Challenges in Customiz- ing NLP for a Domain, Application, Group, or Individual (CustomNLP4U), pages 237-256, Miami, Florida, USA, November 2024. Association for Computational Linguis- tics.
  20. [Kant et al., 2025] Manuj Kant, Sareh Nabi, Manav Kant, Roland Scharrer, Megan Ma, and Marzieh Nabi. Towards robust legal reasoning: Harnessing logical llms in law, 2025.
  21. [Katz et al., 2023] Daniel Martin Katz, Dirk Hartung, Lau- ritz Gerlach, Abhik Jana, and Michael J. Bommarito II. Natural language processing in the legal domain, 2023.
  22. [Kim et al., 2022] Mi-Young Kim, Juliano Rabelo, Randy Goebel, Masaharu Yoshioka, Yoshinobu Kano, and Ken Satoh. Coliee 2022 summary: Methods fornbsp;legal document retrieval andnbsp;entailment. In New Frontiers in Artificial Intelligence: JSAI-IsAI 2022 Workshop, JU- RISIN 2022, and JSAI 2022 International Session, Kyoto, Japan, June 12-17, 2022, Revised Selected Papers, page 51-67, Berlin, Heidelberg, 2022. Springer-Verlag.
  23. [Li et al., 2023] Zhuoyan Li, Hangxiao Zhu, Zhuoran Lu, and Ming Yin. Synthetic data generation with large lan- guage models for text classification: Potential and limi- tations. In Houda Bouamor, Juan Pino, and Kalika Bali, editors, Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 10443- 10461, Singapore, December 2023. Association for Com- putational Linguistics.
  24. [Li et al., 2024] Junyi Li, Jie Chen, Ruiyang Ren, Xiaoxue Cheng, Xin Zhao, Jian-Yun Nie, and Ji-Rong Wen. The dawn after the dark: An empirical study on factuality hal- lucination in large language models. In Lun-Wei Ku, An- dre Martins, and Vivek Srikumar, editors, Proceedings of the 62nd Annual Meeting of the Association for Computa- tional Linguistics (Volume 1: Long Papers), pages 10879- 10899, Bangkok, Thailand, August 2024. Association for Computational Linguistics.
  25. [Lin, 2004] Chin-Yew Lin. ROUGE: A package for auto- matic evaluation of summaries. In Text Summarization Branches Out, pages 74-81, Barcelona, Spain, July 2004. Association for Computational Linguistics.
  26. [Liu et al., 2023] Yang Liu, Dan Iter, Yichong Xu, Shuohang Wang, Ruochen Xu, and Chenguang Zhu. G-eval: NLG evaluation using gpt-4 with better human alignment. In
  27. Houda Bouamor, Juan Pino, and Kalika Bali, editors, Pro- ceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 2511-2522, Singa- pore, December 2023. Association for Computational Lin- guistics.
  28. [Liu et al., 2024] Ruibo Liu, Jerry Wei, Fangyu Liu, Chen- glei Si, Yanzhe Zhang, Jinmeng Rao, Steven Zheng, Daiyi Peng, Diyi Yang, Denny Zhou, and Andrew M. Dai. Best practices and lessons learned on synthetic data, 2024.
  29. [Long et al., 2024] Lin Long, Rui Wang, Ruixuan Xiao, Junbo Zhao, Xiao Ding, Gang Chen, and Haobo Wang. On LLMs-driven synthetic data generation, curation, and evaluation: A survey. In Lun-Wei Ku, Andre Martins, and Vivek Srikumar, editors, Findings of the Association for Computational Linguistics: ACL 2024, pages 11065- 11082, Bangkok, Thailand, August 2024. Association for Computational Linguistics.
  30. [Nguyen et al., 2025] Ha Thanh Nguyen, Wachara Fung- wacharakorn, et al. Llms for legal reasoning: A unified framework and future perspectives. Computer Law Secu- rity Review, 58:106165, 2025.
  31. [Nigam et al., 2025] Shubham Kumar Nigam, Balaramama- hanthi Deepak Patnaik, et al. Nyayarag: Realistic legal judgment prediction with rag under the indian common law system, 2025.
  32. [Oliva et al., 2025] Maria Paz Oliva, Adriana Correia, Ivan Vankov, and Viktor Botev. The illusion of a perfect metric: Why evaluating ai's words is harder than it looks, 2025.
  33. [Papineni et al., 2002] Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for au- tomatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting on Association for Computa- tional Linguistics, ACL '02, page 311-318, USA, 2002. Association for Computational Linguistics.
  34. [Pipitone and Alami, 2024] Nicholas Pipitone and Ghita Houir Alami. Legalbench-rag: A benchmark for retrieval-augmented generation in the legal domain, 2024.
  35. [Reimers and Gurevych, 2019] Nils Reimers and Iryna Gurevych. Sentence-bert: Sentence embeddings using siamese bert-networks, 2019. [Robertson and Zaragoza, 2009] Stephen Robertson and Hugo Zaragoza. The probabilistic relevance framework: Bm25 and beyond. Found. Trends Inf. Retr., 3(4):333-389, April 2009.
  36. [Saad-Falcon et al., 2024] Jon Saad-Falcon, Omar Khattab, Christopher Potts, and Matei Zaharia. ARES: An auto- mated evaluation framework for retrieval-augmented gen- eration systems. In Kevin Duh, Helena Gomez, and Steven Bethard, editors, Proceedings of the 2024 Conference of the North American Chapter of the Association for Com- putational Linguistics: Human Language Technologies (Volume 1: Long Papers), pages 338-354, Mexico City, Mexico, June 2024. Association for Computational Lin- guistics.
  37. [Xu et al., 2025] Ziwei Xu, Sanjay Jain, and Mohan Kankanhalli. Hallucination is inevitable: An innate lim- itation of large language models, 2025.
  38. [Yang et al., 2023] Jingfeng Yang, Hongye Jin, Ruixiang Tang, Xiaotian Han, Qizhang Feng, Haoming Jiang, Bing Yin, and Xia Hu. Harnessing the power of llms in practice: A survey on chatgpt and beyond. 2023.
  39. [Yu et al., 2024] Hao Yu, Aoran Gan, Kai Zhang, Shiwei Tong, Qi Liu, and Zhaofeng Liu. Evaluation of retrieval- augmented generation: A survey, 2024.
  40. [Zhang et al., 2020] Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q. Weinberger, and Yoav Artzi. Bertscore: Evaluating text generation with bert, 2020.
  41. [Zhang et al., 2023] Xiang Zhang, Senyu Li, et al. Don't trust ChatGPT when your question is not in English: A study of multilingual abilities and types of LLMs. In
  42. Houda Bouamor, Juan Pino, and Kalika Bali, editors, Pro- ceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 7915-7927, Singa- pore, December 2023. Association for Computational Lin- guistics. Zheng et al., 2023] Lianmin Zheng, Wei-Lin Chiang, Ying Sheng, Siyuan Zhuang, Zhanghao Wu, Yonghao Zhuang, Zi Lin, Zhuohan Li, Dacheng Li, Eric P. Xing, Hao Zhang, Joseph E. Gonzalez, and Ion Stoica. Judging llm-as-a- judge with mt-bench and chatbot arena, 2023.

References were extracted automatically from the PDF and may contain errors.

Welcome Future Conferences AI Journal Division IJCAI Proceedings About IJCAI IJCAI Awards