{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/scar-sparse-conditioned-autoencoders-for","title":"SCAR: Sparse Conditioned Autoencoders for Concept Detection and Steering in LLMs","arxiv_id":"2411.07122","date":"2024-11-11","proceeding":null,"authors":["Ruben Härle","Felix Friedrich","Manuel Brack","Björn Deiseroth","Patrick Schramowski","Kristian Kersting"],"abstract":"Large Language Models (LLMs) have demonstrated remarkable capabilities in generating human-like text, but their output may not be aligned with the user or even produce harmful content. This paper presents a novel approach to detect and steer concepts such as toxicity before generation. We introduce the Sparse Conditioned Autoencoder (SCAR), a single trained module that extends the otherwise untouched LLM. SCAR ensures full steerability, towards and away from concepts (e.g., toxic content), without compromising the quality of the model's text generation on standard evaluation benchmarks. We demonstrate the effective application of our approach through a variety of concepts, including toxicity, safety, and writing style alignment. As such, this work establishes a robust framework for controlling LLM generations, ensuring their ethical and safe deployment in real-world applications.","url_abs":"https://arxiv.org/abs/2411.07122v2","url_pdf":"https://arxiv.org/pdf/2411.07122v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"scar-sparse-conditioned-autoencoders-for","repo_url":"https://github.com/ml-research/SCAR","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"text-generation","task_name":"Text Generation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2411.07122","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2411.07122"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ml-research/SCAR","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":3,"unverified":5},"by_repo_kind":{"official":{"samples":8,"ran":3,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":8,"samples":[{"code_sha256_prefix":"b4af06c57a251295","entry":"LN","repo":"ml-research/SCAR","repo_kind":"official","path":"llama3_SAE/modeling_llama3_SAE.py","file_url":"https://github.com/ml-research/SCAR/blob/HEAD/llama3_SAE/modeling_llama3_SAE.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b4af06c57a251295"}},{"code_sha256_prefix":"de684cf111d8904c","entry":"normalized_L1_loss","repo":"ml-research/scar","repo_kind":"official","path":"llama3_SAE/determined_trails.py","file_url":"https://github.com/ml-research/scar/blob/HEAD/llama3_SAE/determined_trails.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"de684cf111d8904c"}},{"code_sha256_prefix":"dd80cffd34886b22","entry":"normalized_mean_squared_error","repo":"ml-research/scar","repo_kind":"official","path":"llama3_SAE/determined_trails.py","file_url":"https://github.com/ml-research/scar/blob/HEAD/llama3_SAE/determined_trails.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"dd80cffd34886b22"}},{"code_sha256_prefix":"dfa10d2dbbeb512e","entry":"get_ckpts","repo":"ml-research/SCAR","repo_kind":"official","path":"llama3_SAE/ConversionScript.py","file_url":"https://github.com/ml-research/SCAR/blob/HEAD/llama3_SAE/ConversionScript.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"dfa10d2dbbeb512e"}},{"code_sha256_prefix":"aa4acb1713828901","entry":"get_ppl","repo":"ml-research/SCAR","repo_kind":"official","path":"evaluations/eval_funcs.py","file_url":"https://github.com/ml-research/SCAR/blob/HEAD/evaluations/eval_funcs.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"aa4acb1713828901"}},{"code_sha256_prefix":"4035c953636d0200","entry":"preprocess","repo":"ml-research/SCAR","repo_kind":"official","path":"evaluations/eval_funcs.py","file_url":"https://github.com/ml-research/SCAR/blob/HEAD/evaluations/eval_funcs.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4035c953636d0200"}},{"code_sha256_prefix":"468ae565cf4fb501","entry":"rectangle","repo":"ml-research/SCAR","repo_kind":"official","path":"llama3_SAE/modeling_llama3_SAE.py","file_url":"https://github.com/ml-research/SCAR/blob/HEAD/llama3_SAE/modeling_llama3_SAE.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"468ae565cf4fb501"}},{"code_sha256_prefix":"2d6b9b45dd7f7241","entry":"test_ppl","repo":"ml-research/SCAR","repo_kind":"official","path":"evaluations/eval_funcs.py","file_url":"https://github.com/ml-research/SCAR/blob/HEAD/evaluations/eval_funcs.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2d6b9b45dd7f7241"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}