{"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/transformer-compression-via-subspace","title":"$\\rm SP^3$: Enhancing Structured Pruning via PCA Projection","arxiv_id":"2308.16475","date":"2023-08-31","proceeding":null,"authors":["Yuxuan Hu","Jing Zhang","Zhe Zhao","Chen Zhao","Xiaodong Chen","Cuiping Li","Hong Chen"],"abstract":"Structured pruning is a widely used technique for reducing the size of pre-trained language models (PLMs), but current methods often overlook the potential of compressing the hidden dimension (d) in PLMs, a dimension critical to model size and efficiency. This paper introduces a novel structured pruning approach, Structured Pruning with PCA Projection (SP3), targeting the effective reduction of d by projecting features into a space defined by principal components before masking. Extensive experiments on benchmarks (GLUE and SQuAD) show that SP3 can reduce d by 70%, compress 94% of the BERTbase model, maintain over 96% accuracy, and outperform other methods that compress d by 6% in accuracy at the same compression ratio. SP3 has also proven effective with other models, including OPT and Llama. Our data and code are available at an anonymous repo.","url_abs":"https://arxiv.org/abs/2308.16475v3","url_pdf":"https://arxiv.org/pdf/2308.16475v3.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":"transformer-compression-via-subspace","repo_url":"https://github.com/hyx1999/sp3","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[],"methods":[{"method_slug":"adafactor","method_name":"Adafactor"},{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bert","method_name":"BERT"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"glu","method_name":"Gated Linear Unit"},{"method_slug":"inverse-square-root-schedule","method_name":"Inverse Square Root Schedule"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-linear-decay","method_name":"Linear Warmup With Linear Decay"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"opt","method_name":"OPT"},{"method_slug":"pca","method_name":"PCA"},{"method_slug":"pruning","method_name":"Pruning"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"sentencepiece","method_name":"SentencePiece"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"t5","method_name":"T5"},{"method_slug":"weight-decay","method_name":"Weight Decay"},{"method_slug":"wordpiece","method_name":"WordPiece"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2308.16475","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2308.16475"}},"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/hyx1999/sp3","reach":{"status":"ok"}}],"summary":{"ran":9,"ran_violates":1,"ran_honours":1,"ran_draft_wrong":1,"unverified":2},"by_repo_kind":{"official":{"samples":14,"ran":12,"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":14,"samples":[{"code_sha256_prefix":"454817035cd7e70d","entry":"acc_and_f1","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/metric/glue.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/metric/glue.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"454817035cd7e70d"}},{"code_sha256_prefix":"bf75673211903e14","entry":"exact_match_score","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/metric/squad.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/metric/squad.py","link_basis":"plan_row","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bf75673211903e14"}},{"code_sha256_prefix":"cdf4b8c0fec3da02","entry":"f1_score","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/metric/squad.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/metric/squad.py","link_basis":"plan_row","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cdf4b8c0fec3da02"}},{"code_sha256_prefix":"666b0f418a1cd3e1","entry":"get_distill_args","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/pipeline/glue/entry.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/pipeline/glue/entry.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"666b0f418a1cd3e1"}},{"code_sha256_prefix":"04c98539fd77722e","entry":"get_num_params","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/pipeline/glue/entry.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/pipeline/glue/entry.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"04c98539fd77722e"}},{"code_sha256_prefix":"72ae17e5ad61f6cb","entry":"get_tokens","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/metric/squad_v2.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/metric/squad_v2.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"72ae17e5ad61f6cb"}},{"code_sha256_prefix":"41e5ac23be97994b","entry":"make_qid_to_has_ans","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/metric/squad_v2.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/metric/squad_v2.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"41e5ac23be97994b"}},{"code_sha256_prefix":"e7e75981cb464788","entry":"normalize_answer","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/metric/squad.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/metric/squad.py","link_basis":"harvester_set","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":"e7e75981cb464788"}},{"code_sha256_prefix":"2d391d2daa3c57fe","entry":"normalize_answer","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/metric/squad_v2.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/metric/squad_v2.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2d391d2daa3c57fe"}},{"code_sha256_prefix":"e3e13638a674e4b1","entry":"pearson_and_spearman","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/metric/glue.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/metric/glue.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e3e13638a674e4b1"}},{"code_sha256_prefix":"8c446e6529052aa4","entry":"sample","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/modeling/compactor.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/modeling/compactor.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8c446e6529052aa4"}},{"code_sha256_prefix":"ee7891c2dca1d285","entry":"sample","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/modeling/initializer.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/modeling/initializer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ee7891c2dca1d285"}},{"code_sha256_prefix":"2cab98f6275ec5b6","entry":"evaluate","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/pipeline/glue/perf_entry.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/pipeline/glue/perf_entry.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":"2cab98f6275ec5b6"}},{"code_sha256_prefix":"83eba990d34db6a2","entry":"simple_accuracy","repo":"hyx1999/sp3","repo_kind":"official","path":"bert/metric/glue.py","file_url":"https://github.com/hyx1999/sp3/blob/HEAD/bert/metric/glue.py","link_basis":"harvester_set","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":"83eba990d34db6a2"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}