Submitted:
27 June 2026
Posted:
29 June 2026
You are already at the latest version
Abstract

Keywords:
1. Introduction
1.1. Fourth Book of Civil Code of Catalonia
1.2. Regulations for the Organization and System of the Notary Profession
1.3. Large Language Models (LLMs)
2. Methods
2.1. Hardware
2.2. Local LLM Models
- Reasoner v1
- Llama 3 8B Instruct (Meta-Llama-3-8B-Instruct.Q4_0.gguf)
- DeepSeek-R1-Distill-Qwen-14B
- Mistral Instruct
- Orca2 (Full) (orca-2-13b.Q4_0.gguf)
- Wizard v1.2
- Hermes
- Snoozy
- Phi-3 Mini Instruct
2.3. Retrieval-Augmented Generation (RAG) Technique
- Fourth Book of the Civil Code, dedicated to the law of succession (Ley 10/2008, de 10 de julio, del libro cuarto del Código civil de Cataluña, relativo a las sucesiones) [3]
- The Decree of June 2, 1944, approving definitively the Regulations for the organization and system of the Notary Profession (Decreto 2 junio 1944, por el que se aprueba con carácter definitivo el Reglamento de la organización y régimen del Notariado) [7].
- 4 CPU threads
- Llama 3 8B Instruct (Meta-Lama-3-8B-Instruct.Q4_0.gguf)
- 2048 context length
- 128 prompt batch size
- 0.4 Top-P
- 0 Min-P
- 32 GPU layers
- 4096 max length
- 0.7 temperature
- 40 top-k
- 64 repeat penalty tokens
- 1.18 repeat penalty.
2.4. Comparison with Commercial Cloud-Based LLMs
2.5. Statistical Analyses
3. Findings
3.1. General Findings and Evaluation Metrics
3.2. Comparison with Commercial Cloud-Based LLMs
3.3. Specific Questions
4. Discussion
5. Conclusions
Supplementary Materials
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
Abbreviations
| AI | Artificial intelligence |
| BERT | Bidirectional transformers for language understanding |
| CPU | Central processing unit |
| GPT | Generative pre-trained transformer |
| GPU | Graphics processing unit |
| LLM | Large language model |
| RAM | Random-access memory |
Appendix A
Appendix A.1. Transformer Explainer: Example

Appendix A.1. Transformer Explainer: Probability of “Expected” Token Being Sampled

Appendix B. Llama 3 System-Level Approach for Safety

References
- Código de Leyes Civiles de Cataluña. Agencia Estatal Boletin Oficial del Estado (BOE). Available online: https://www.boe.es/biblioteca_juridica/codigos/codigo.php?id=150&modo=2¬a=0&tab=2.
- Ley 10/2008, de 10 de julio, del libro cuarto del Código Civil de Cataluña, relativo a las sucesiones. «DOGC» núm. 5175, de 17/07/2008, «BOE» núm. 190, de 07/08/2008. Entrada en vigor: 01/01/2009. Departamento: Comunidad Autónoma de Cataluña. Referencia: BOE-A-2008-13533; Permalink ELI; Available online: https://www.boe.es/eli/es-ct/l/2008/07/10/10/con.
- Noticias Juridicas. Ley 10/2008, de 10 de julio, del libro cuarto del Código civil de Cataluña, relativo a las sucesiones. Available online: https://noticias.juridicas.com/base_datos/CCAA/ca-l10-2008.html (accessed on 3rd April 2026).
- GenCat. Departament de Justicia. Llibre quart del Codi civil de Catalunya, relatiu a les successions. Available online: https://repositori.justicia.gencat.cat/handle/20.500.14226/589#page=1 (accessed on 3rd April 2026).
- Ley del Notariado de 28 de mayo de 1862. Publicado en: «Gaceta de Madrid» núm. 149, de 29/05/1862. Entrada en vigor:19/06/1862. Departamento: Ministerio de Gracia y Justicia. Referencia: BOE-A-1862-4073. Permalink ELI. Available online: https://www.boe.es/eli/es/l/1862/05/28/(1)/con.
- Preliminary title. Fundamental principles. Article 1. Decreto 2 junio 1944, por el que se aprueba con carácter definitivo el Reglamento de la organización y régimen del Notariado. Órgano MINISTERIO DE JUSTICIA. Publicado en BOE núm. 189 de 07 de Julio de 1944. Vigencia desde 27 de Julio de 1944. 2015. [PubMed]
- Noticias Juridicas. Ley de 28 de mayo 1862, Orgánica del Notariado. Available online: https://noticias.juridicas.com/base_datos/Privado/ln.html (accessed on 3r April 2026).
- Vaswani, Ashish; Shazeer, Noam; Parmar, Niki; Uszkoreit, Jakob; Jones, Llion; Gomez, Aidan N.; Kaiser, Lukasz; Polosukhin, Illia. Attention Is All You Need. arXiv arXiv:1706.03762.
- Devlin, Jacob; Chang, Ming-Wei; Lee, Kenton; Toutanova, Kristina. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. arXiv arXiv:1810.04805.
- Zhang, E.Y.; Cheok, A.D.; Pan, Z.; Cai, J.; Yan, Y. From Turing to Transformers: A Comprehensive Review and Tutorial on the Evolution and Applications of Generative Transformer Models. Sci 2023, 5, 46. [Google Scholar] [CrossRef]
- Ruder, Sebastian. An overview of gradient descent optimization algorithms. arXiv arXiv:1609.04747.
- HECHT-NIELSEN, R.O.B.E.R.T., III. 3 - Theory of the Backpropagation Neural Network**Based on “nonindent” by Robert Hecht-Nielsen, which appeared in Proceedings of the International Joint Conference on Neural Networks 1, 593–611, June 1989. © 1989 IEEE. In Neural Networks for Perception; Wechsler, Harry, Ed.; Academic Press, 1992; pp. Pages 65–93. ISBN 9780127412528. [Google Scholar] [CrossRef]
- LeCun, Y.; Bottou, L.; Orr, G. B.; Müller, K. R. Efficient backprop. In Neural networks: Tricks of the trade; Springer, 1998; pp. 9–50. [Google Scholar]
- Rumelhart, D. E.; Hinton, G. E.; Williams, R. J. Learning representations by back-propagating errors. Nature 1986, 323(6088), 533–536. [Google Scholar] [CrossRef]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A. N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. Advances in neural information processing systems, 2017; Vol. 30. [Google Scholar]
- Guenole, N. (no date) Psychometrics.ai: Transforming Behavioral Science with Machine Learning. Available online: https://psychometrics.ai (accessed on 3rd April 2026).
- Mikolov, Tomas; Chen, Kai; Corrado, Greg; Dean, Jeffrey. Efficient Estimation of Word Representations in Vector Space. Available online: https://arxiv.org/abs/1301.3781.
- Cho, Aeree; Kim, Grace C.; Karpekov, Alexander; Helbling, Alec; Wang, Zijie J.; Lee, Seongmin; Hoover, Benjamin; Chau, Duen Horng. Transformer Explainer: Interactive Learning of Text-Generative Models. arXiv arXiv:2408.04619.
- Ollama. Available online: https://ollama.com/ (accessed on 3rd April 2026).
- LM Studio AI. Element Labs, Inc. (c) 2026. Available online: https://lmstudio.ai/ (accessed on 3rd April 2026).
- Llama 3 open-source AI model. Meta. Available online: https://www.llama.com/models/llama-3/ (accessed on 3rd April 2026).
- Klesel, M.; Wittmann, H.F. Retrieval-Augmented Generation (RAG). Bus. Inf. Syst. Eng. 2025, 67, 551–561. [Google Scholar] [CrossRef]
- Lewis, Patrick; Perez, Ethan; Piktus, Aleksandra; Petroni, Fabio; Karpukhin, Vladimir; Goyal, Naman; Küttler, Heinrich; Lewis, Mike; Yih, Wen-tau; Rocktäschel, Tim; Riedel, Sebastian; Kiela, Douwe. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. Accepted at NeurIPS 2020. Comput. Lang. (cs.CL); Machine Learning (cs.LG) . arXiv:2005.11401.
- Yang, R.; Ning, Y.; Keppo, E.; et al. Retrieval-augmented generation for generative artificial intelligence in health care. npj Health Syst. 2025, 2, 2. [Google Scholar] [CrossRef]
- Patil, R.; Gudivada, V. A Review of Current Trends, Techniques, and Challenges in Large Language Models (LLMs). Appl. Sci. 2024, 14, 2074. [Google Scholar] [CrossRef]
- Abdollahi, M.; Yeganli, S.F.; Baharloo, M.; Baniasadi, A. Hardware Design and Verification with Large Language Models: A Scoping Review, Challenges, and Open Issues. Electronics 2025, 14, 120. [Google Scholar] [CrossRef]
- Chen, X.; Ma, W.; Li, D.; Zhu, F.; Routray, S.; Guduri, M.; Margala, M. Kalman-based Adaptive Moment Estimation Optimisation Algorithm to Enhance GPT in LLMs for Medical Sentiment Analysis of Patient Health-related Feedback. IEEE J. BioMed Health Inf. 2025, PP. [Google Scholar] [CrossRef] [PubMed]
- Ke, Y.H.; Jin, L.; Elangovan, K.; Abdullah, H.R.; Liu, N.; Sia, A.T.H.; Soh, C.R.; Tung, J.Y.M.; Ong, J.C.L.; Kuo, C.F.; et al. Retrieval augmented generation for 10 large language models and its generalizability in assessing medical fitness. npj Digit Med. 2025, 8, 187. [Google Scholar] [CrossRef] [PubMed]
- Tayebi Arasteh, S.; Lotfinia, M.; Bressem, K.; Siepmann, R.; Adams, L.; Ferber, D.; Kuhl, C.; Kather, J.N.; Nebelung, S.; Truhn, D. RadioRAG: Online Retrieval-Augmented Generation for Radiology Question Answering. Radiol. Artif. Intell. 2025, 7, e240476. [Google Scholar] [CrossRef] [PubMed]
- Zhang, R.; Wang, Y.; Yang, W.; Wen, J.; Liu, W.; Zhi, S.; Li, G.; Chai, N.; Huang, J.; Xie, Y.; et al. PlantGPT: An Arabidopsis-Based Intelligent Agent that Answers Questions about Plant Functional Genomics. Adv. Sci. (Weinh) 2025, 12, e03926. [Google Scholar] [CrossRef] [PubMed]
- Zhong, W.; Liu, Y.; Liu, Y.; Yang, K.; Gao, H.; Yan, H.; Hao, W.; Yan, Y.; Yin, C. Performance of ChatGPT-4o and Four Open-Source Large Language Models in Generating Diagnoses Based on China’s Rare Disease Catalog: Comparative Study. J. Med. Internet Res. 2025, 27, e69929. [Google Scholar] [CrossRef] [PubMed]
- Meta. Llama API. Meet the models. Available online: https://llama.developer.meta.com/docs/models (accessed on 4th April 2026).
- Face, Hugging. meta-llama/Meta-Llama-3-8B-Instruct. Available online: https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct (accessed on 4th April 2026).
- Bhatt, Manish; Chennabasappa, Sahana; Li, Yue; Nikolaidis, Cyrus; Song, Daniel; Wan, Shengye; Ahmad, Faizan; Aschermann, Cornelius; Chen, Yaohui; Kapil, Dhaval; Molnar, David; Whitman, Spencer; Saxe, Joshua. CYBERSECEVAL 2: A Wide-Ranging Cybersecurity Evaluation Suite for Large Language Models. 18 April 2024. Available online: https://scontent-nrt1-1.xx.fbcdn.net/v/t39.2365-6/438983861_247813051691642_9146727788360945492_n.pdf?_nc_cat=109&ccb=1-7&_nc_sid=3c67a6&_nc_ohc=tBls4fRWQ_8Q7kNvwHoW18p&_nc_oc=Adq4YoideawjH7-NW2VJUggo0dMuM_CdgLEcN3MWdWjFnX4COTrcIA3FBJJL7oo4UKs&_nc_zt=14&_nc_ht=scontent-nrt1-1.xx&_nc_gid=Tmw7kR2coZGoQOdQi95KXg&_nc_ss=7a389&oh=00_Af3uwJMRY6nuhebx632lFwAjuHK6-dl8hkxRJLRiDF12Kg&oe=69EE432A (accessed on 22 April 2026).




| Question | Language quality | Content quality | ||
| Fluency | Coherence | Factuality | Relevance | |
| 1 | 3+ | 3+ | 3+ | 3+ |
| 2 | 3+ | 3+ | 2+ | 3+ |
| 3 | 3+ | 3+ | 3+ | 3+ |
| 4 | 2+ | 2+ | 2+ | 2+ |
| 5 | 2+ | 2+ | 2+ | 2+ |
| 6 | 3+ | 3+ | 3+ | 3+ |
| 7 | 3+ | 3+ | 2+ | 2+ |
| 8 | 3+ | 3+ | 2+ | 2+ |
| 9 | 3+ | 3+ | 3+ | 3+ |
| 10 | 3+ | 3+ | 2+ | 3+ |
| Summary | 80% 3+ 20% 2+ |
80% 3+ 20% 2+ |
40% 3+ 60% 2+ |
60% 3+ 40% 2+ |
| Question | Local LLM (Llama 3 8B Instruct) | Grok 4.2 (Expert mode) | GPT5 (Think Deeper) | ||||||
| Length | Human % | Local files | Length | Human % | Sources | Length | Human % | Steps | |
| 1 | 147 | 99 | 2 | 1015 | 0 | 30 | 939 | 0 | 28 |
| 2 | 177 | 50 | 2 | 513 | 0 | 55 | 542 | 0 | 19 |
| 3 | 48 | 99 | 2 | 671 | 94 | 50 | 314 | 0 | 14 |
| 4 | 133 | 100 | 2 | 467 | 0 | 35 | 633 | 0 | 28 |
| 5 | 103 | 48.5 | 2 | 369 | 90 | 50 | 394 | 81 | 13 |
| 6 | 192 | 0 | 2 | 562 | 40 | 70 | 964 | 6 | 23 |
| 7 | 207 | 0 | 2 | 517 | 0 | 65 | 552 | 0 | 21 |
| 8 | 128 | 99 | 2 | 429 | 0 | 50 | 789 | 49 | 24 |
| 9 | 71 | 98 | 2 | 435 | 0 | 70 | 912 | 0 | 14 |
| 10 | 64 | 97 | 2 | 368 | 58 | 70 | 334 | 0 | 21 |
| Average | 127.0 | 69.1 | 2.0 | 534.6 | 28.2 | 54.5 | 637.3 | 13.6 | 20.5 |
| STD | 55.3 | 41.6 | 0.0 | 192.0 | 39.4 | 14.4 | 251.3 | 28.2 | 5.5 |
| Length | Human % similarity | Sources | |
| Local LLM (Llama 3 8B Instruct) | 127 ±55.3 | 69.1% ±41.6 | 2.0 ±0.0 |
| Grok 4.2 | 534.6 ±191.9 | 28.2% ±39.4 | 54.5 ±14.4 |
| GPT5 | 637.3 ±251.3 | 13.6% ±28.2 | 20.5 ±5.5 |
| P value (across groups) | < 0.001 | 0.009 | < 0.001 |
| P value (LLM vs. others) | < 0.001 | 0.004 | < 0.001 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).