Contextualized Obfuscation: A Privacy-Preserving Architecture for Safe LLM Integration in Judicial Text Processing
Abstract
: The adoption of Large Language Models (LLMs) in judicial environments is constrained by strict privacy requirements and the risk of exposing sensitive information under regulations such as the Brazilian General Data Protection Law (LGPD). This work presents a privacy-preserving adaptation pipeline for judicial document processing based on contextualized obfuscation, in which sensitive entities are replaced by semantically consistent placeholders that preserve referential integrity and contextual coherence. The proposed architecture enforces a fully local preprocessing layer, ensuring that no original sensitive data is transmitted to external LLM services. The pipeline combines LLM-based entity extraction, rule-based enhancement, and post-processing techniques to improve entity normalization and replacement consistency. Experimental evaluation using real-world judicial documents and nine different LLMs, including both local and commercial models, demonstrated that contextualized obfuscation consistently outperformed traditional anonymization approaches in downstream interpretation tasks. Across all evaluated commercial LLM judges, the proposed approach achieved substantial gains in contextual understanding, with average improvements of around 3× and gains reaching up to 17× in some scenarios, while consistently preserving actor traceability and semantic relationships more effectively than traditional masking strategies. Results also indicate that the proposed pipeline remains computationally feasible in resource-constrained environments, supporting practical and scalable privacy-preserving integration of LLMs into judicial workflows