Legal-BERT Semantic Clustering and Explainable XGBoost for Liability Allocation in Automated Cross-Border Digital Trade Contract Performance
Abstract
Cross-border automated contract performance involves multiple contracting parties, platforms, software developers, and external data suppliers as performers, giving rise to multi-class allocation of liability. We present a computational method involving Legal-BERT semantic vectors, unsupervised clustering, and explainable XGBoost classification. EU, Singaporean, and England & Wales legal texts are categorized through comparative coding, with the UNCTIRAL Model Law on Automated Contracting providing international benchmarking. Legal-BERT encodes the context of paragraphs, UMAP performs dimensionality reduction of Legal-BERT vectors, and HDBSCAN detects recurrent liability reasoning patterns. XGBoost predicts the responsible party across five classes based on coded variables concerning control, causality, disclosure, ability to intervene, failure type, and jurisdictional aspects. Source-based partitioning avoids leaking paragraphs across training and testing sets; moreover, we use stratified five-fold cross-validation and nested optimization to find the best classification model. Actor-based allocation score is determined through SHAP values on the basis of probability predictions, legal considerations, and penalties for poor control and causality. In our case study of 438 cases, clustering produced silhouette coefficient of 0.46 ± 0.04. Classification gave macro-F1 of 0.816 ± 0.019 and multiclass AUC of 0.904 ± 0.013. Scenario agreement was 0.842 ± 0.051. The framework provides an inspectable computational basis for comparing liability patterns across automated performance failures.
References
- United Nations Commission on International Trade Law. (2024).UNCITRAL model law on automated contracting. United Nations.
- Law Commission. (2021).Smart legal contracts: Advice to government. Law Commission.
- European Parliament & Council of the European Union. (2023). Regulation (EU) 2023/2854 on harmonised rules on fair access to and use of data.Official Journal of the European Union.
- Blycha, N., & Garside, A. (2022). A model for the integration of machine capabilities into contracts. In J. G. Allen & P. Hunn (Eds.),Smart legal contracts: Computable law in theory and practice(pp. 142–181). Oxford University Press.
- Wilkinson, S., & Giuffre, J. (2022). Six levels of contract automation: The evolution of smart legal contracts. In J. G. Allen & P. Hunn (Eds.),Smart legal contracts: Computable law in theory and practice(pp. 182–204). Oxford University Press.
- Gleeson, S. (2022). The legal consequences of automated mistake. In J. G. Allen & P. Hunn (Eds.),Smart legal contracts: Computable law in theory and practice(pp. 397–419). Oxford University Press.
- Zammit, D. E., & Debono, P. (2022). Establishing civil liability for smart contracts: A hybrid legal framework to regulate an emerging technology. In P. Laghi & E. Teliti (Eds.),Processo, processi e rivoluzione tecnologica(pp. 163–222). CEDAM.
- Lamappulage Donn, T. D. (2023). Smart contracts and international trade: European legal strategies for managing challenges.Journal of Digital Technologies and Law, 1(4), 1042–1057.
- Soavi, M., Zeni, N., Mylopoulos, J., & Mich, L. (2022). From legal contracts to formal specifications: A systematic literature review.SN Computer Science, 3, 345.
- Wehnert, S., Dureja, S., Kutty, L., Sudhi, V., & De Luca, E. W. (2022). Applying BERT embeddings to predict legal textual entailment.The Review of Socionetwork Strategies, 16, 197–219.