Interpreting BERT Using LIME and SHAP

preprint OA: closed CC-BY-4.0
📄 Open PDF Full text JSON View at publisher

Abstract

Abstract Transformer-based language models such as BERT have achieved state-of-the-art performance on diverse natural language processing tasks, yet their decision processes remain opaque. This paper presents a comprehensive framework for interpreting BERT’s predictions in multi-label text classification using two leading model-agnostic explainability techniques—Local Interpretable Model-Agnostic Explanations (LIME) and SHapley Additive exPlanations (SHAP). An end-to-end pipeline for fine-tuning BERT and producing token-level attributions is introduced. We systematically compare the explainers with respect to local fidelity, global consistency, stability and computational cost. Experimental results suggest that LIME generates intuitive, case-specific explanations while SHAP provides theoretically grounded and globally consistent attributions. By integrating the complementary strengths of both methods, we propose a hybrid interpretation strategy that balances interpretability, scalability and accuracy. The methodology is illustrated through a case study on multi-label genre classification from movie plot summaries. Detailed guidelines and synthetic visualisations are provided to enable practitioners to apply these techniques effectively and responsibly.
Full text 9,478 characters · extracted from preprint-html · click to expand
Interpreting BERT Using LIME and SHAP | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Research Article Interpreting BERT Using LIME and SHAP Manish Shukla This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-7376225/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract Transformer-based language models such as BERT have achieved state-of-the-art performance on diverse natural language processing tasks, yet their decision processes remain opaque. This paper presents a comprehensive framework for interpreting BERT’s predictions in multi-label text classification using two leading model-agnostic explainability techniques—Local Interpretable Model-Agnostic Explanations (LIME) and SHapley Additive exPlanations (SHAP). An end-to-end pipeline for fine-tuning BERT and producing token-level attributions is introduced. We systematically compare the explainers with respect to local fidelity, global consistency, stability and computational cost. Experimental results suggest that LIME generates intuitive, case-specific explanations while SHAP provides theoretically grounded and globally consistent attributions. By integrating the complementary strengths of both methods, we propose a hybrid interpretation strategy that balances interpretability, scalability and accuracy. The methodology is illustrated through a case study on multi-label genre classification from movie plot summaries. Detailed guidelines and synthetic visualisations are provided to enable practitioners to apply these techniques effectively and responsibly. BERT interpretability explainable artificial intelligence LIME SHAP natural language processing multi-label classification Full Text Additional Declarations No competing interests reported. Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-7376225","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":500686762,"identity":"a43b3f2f-4afe-4a0c-a6b6-b1089b756a52","order_by":0,"name":"Manish Shukla","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABIElEQVRIie2PMUvDQBTHcwTMciHrBYvfQHggSIeCXyVB6HQWQXAMCYXLYHQvfolMwfHCgS4XMgkXujjpksFuLXRokkWFNOomcr/hPR68H//3DEOj+aNwFBqegc2wHbBjtR3GP1FQp4zchLcKGY75rExAeW3frxzHRZ5vHoIZyDx6RzTA7uLtOV1fEsOJb7w+5VTOPGFLcQVFNCcoE9g5pNdV0hxGZJH2KpyCQIz7aYnCRuHYvadThRsFyEW/UtaQb1jQKvM1ygIMlZxW2yFFUeA2M/20iFiTYmJQ1uNyMEXVIGwm/IXM2dhvfnETerAcAcF7fynpyao97E6eC7XKgjPHenqt6u3kyIlve5WveF3F0NXv1z+wXn6zrdFoNP+fHWEKbs9YYoqAAAAAAElFTkSuQmCC","orcid":"","institution":"","correspondingAuthor":true,"prefix":"","firstName":"Manish","middleName":"","lastName":"Shukla","suffix":""}],"badges":[],"createdAt":"2025-08-14 18:08:21","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-7376225/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-7376225/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":89266081,"identity":"bd9f6fee-547e-440e-8bfe-dee59976328c","added_by":"auto","created_at":"2025-08-18 08:09:04","extension":"pdf","order_by":1,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":295463,"visible":true,"origin":"","legend":"","description":"","filename":"BERTInterpretation.pdf","url":"https://assets-eu.researchsquare.com/files/rs-7376225/v1_covered_8f064ef8-2f83-428c-8630-1488ac08696d.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"Interpreting BERT Using LIME and SHAP","fulltext":[],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":false,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":true,"hideJournal":true,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":false,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":true,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"BERT, interpretability, explainable artificial intelligence, LIME, SHAP, natural language processing, multi-label classification","lastPublishedDoi":"10.21203/rs.3.rs-7376225/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-7376225/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"Transformer-based language models such as BERT have achieved state-of-the-art performance\non diverse natural language processing tasks, yet their decision processes remain\nopaque. This paper presents a comprehensive framework for interpreting BERT’s predictions\nin multi-label text classification using two leading model-agnostic explainability\ntechniques—Local Interpretable Model-Agnostic Explanations (LIME) and SHapley Additive\nexPlanations (SHAP). An end-to-end pipeline for fine-tuning BERT and producing\ntoken-level attributions is introduced. We systematically compare the explainers with respect\nto local fidelity, global consistency, stability and computational cost. Experimental\nresults suggest that LIME generates intuitive, case-specific explanations while SHAP\nprovides theoretically grounded and globally consistent attributions. By integrating the\ncomplementary strengths of both methods, we propose a hybrid interpretation strategy\nthat balances interpretability, scalability and accuracy. The methodology is illustrated\nthrough a case study on multi-label genre classification from movie plot summaries. Detailed\nguidelines and synthetic visualisations are provided to enable practitioners to apply\nthese techniques effectively and responsibly.","manuscriptTitle":"Interpreting BERT Using LIME and SHAP","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2025-08-18 08:00:43","doi":"10.21203/rs.3.rs-7376225/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"c92a1b4f-b271-46ce-bad1-0da7e17b67f2","owner":[],"postedDate":"August 18th, 2025","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[],"tags":[],"updatedAt":"2025-09-01T03:23:11+00:00","versionOfRecord":[],"versionCreatedAt":"2025-08-18 08:00:43","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-7376225","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-7376225","identity":"rs-7376225","version":["v1"]},"buildId":"8U1c8b4HqxoKbykW_rLl7","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}

Text is read by the "Ask this paper" AI Q&A widget below. Extraction quality varies by source — PMC NXML preserves structure cleanly, OA-HTML may include some navigation residue, and OA-PDF can have broken hyphenation. The publisher copy (via DOI) is the canonical version.

My notes (saved in your browser only)

Ask this paper AI returns verbatim quotes from the full text · source: preprint-html

Answers must be backed by verbatim quotes from this paper's full text. Hallucinated quotes are dropped automatically; if no verbatim passage answers the question, we say so. How this works

Citation neighborhood (no data yet)

We don't have any in-corpus citations linked to this paper yet. This is a recent paper (2025) — citers typically take a year or two to land, and the OpenAlex reference graph may still be filling in.

Source provenance

europepmc
last seen: 2026-05-20T01:45:00.602351+00:00
unpaywall
last seen: 2026-05-28T02:00:01.590549+00:00
License: CC-BY-4.0