[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-119722-en":3,"doc-seo-119722-105":30,"detail-sidebar-cat-0-en-105":91},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":4,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":27,"seo_description":14,"update_tm":28,"read_time":29},119722,687197100911,"Himbo","https://ap-avatar.wpscdn.com/avatar/a000239b6f1da00475?x-image-process=image/resize,m_fixed,w_180,h_180&k=1785132997149421697",8,"Research & Report","TOWARDS MEMORY-EFFICIENT TRAINING FOR EXTREMELY LARGE OUTPUT SPACES - LEARNING WITH 500 K LABELS ON A SINGLE COMMODITY GPU","Classification with extremely large output spaces (up to millions of labels) makes the final layer prohibitively memory hungry. The document analyzes sparse connectivity as a way to reduce memory, noting that naive sparse training can substantially harm predictive performance. It proposes mitigating this by adding a penultimate intermediate layer, enabling dense-like results with sparsity. It further enforces uniform sparsity so each output neuron receives the same number of connections, allowing efficient GPU sparse operations. A custom CUDA implementation demonstrates scalability to 670,000 labels within 4GB memory.","arXiv :2306 .03725v 1 [ cs .LG] 6 Jun 2023  \nTOWARDS MEMORY-EFFICIENT TRAINING FOR EXTREMELY LARGE OUTPUT SPACES – LEARNING WITH 500 K LABELS ON A  \nSINGLE COMMODITY GPU  \nA PREPRINT  \nErik Schultheis Aalto University Helsinki, Finland [erik.schultheis@aalto.fi](erik.schultheis@aalto.fi)  \nRohit Babbar  \nUniversity of Bath / Aalto University Bath, UK / Helsinki, Finland [rb2608@bath.ac.uk](rb2608@bath.ac.uk)  \nABSTRACT  \nIn classi􀀂cation problems with large output spaces (up to millions of labels), the last layer can require an enormous amount of memory. Using sparse connectivity would drastically reduce the memory requirements, but as we show below, it can result in much diminished predictive performance of the model. Fortunately, we found that this can be mitigated by introducing a penultimate layer of intermediate size. We further demonstrate that one can constrain the connectivity of the sparse layer to be uniform, in the sense that each output neuron will have the exact same number of incoming connections. This allows for ef􀀂cient implementations of sparse matrix multiplication and connection redistribution on GPU hardware. Via a custom CUDA implementation, we show that the proposed approach can scale to datasets with 670,000 labels on a single commodity GPU with only 4GB memory.  \n1 Introduction  \nIn this paper, we present 􀀂ndings towards employing sparse connectivity in order to reduce the memory consumption of the classi􀀂cation layer for problems with extremely large output spaces (XMC). Such problems arise in, e.g., tagging of text documents [8], next-word predictions [22], and different kinds of recommendation tasks [5, 30, 1, 25, 20] . In order to ensure computational tractability of these tasks, which can have up to several millions of labels, one typically builds a hierarchical label tree [24, 33, 13, 31, 14], only exploring branches that are likely to contain relevant labels for the current instance. Even though this is very effective at reducing the computation (from linear in the number of labels to logarithmic), it does not help in addressing the memory consumption, which is still linear in the number of labels times the number of hidden units.  \nAs an illustration consider the AMAZON-3M [19] dataset. If we were to map the inputs to a hidden representation of 1024 units, the fully connected last layer for this dataset would need about 2.9 billion parameters, corresponding to 10.7 GiB 1 . Given that modern deep learning optimizers such as ADAM [16] need to keep track of the value, gradient, and 􀀂rst and second moment, this leads to an overall peak memory consumption of over 40 GiB, making it nigh impossible to train such models on commodity hardware.  \nTherefore, we want to investigate possibilities for memory ef􀀂cient sparse training of this huge last layer. There are two pre-existing approaches that serve as an indication that this is an idea that could be successful: First, for DISMEC, a linear model applied to tf-idf representations of input text, it is known that the resulting layer can be sparsi􀀂ed after training to contain less than 1% non-zeros [2] . In a linear model, the different classi􀀂ers for each label can be trained independently. As a result, only the full weights of the label that is currently trained needs to be kept in memory, and can be pruned as soon as the training for that label has 􀀂nished. For non-linear models, the MACH [20] algorithm can be interpreted as a special case of training with static, random sparsity. It works by hashing the labels into different buckets, and performing training and predictions only on the level of buckets. If enough independent hashes are used,  \n1Assuming 32-bit 􀀃oating point numbers  \n Training for Deep Extreme Classi􀀂ers on Single Commodity GPU A PREPRINT  \nthis method allows to solve the original problem in the large output space. However, in practice, the results presented for MACH are not as good as for competing methods.  \nThe contributions of this p","cbCaifhUoxiixLom","https://ap.wps.com/l/cbCaifhUoxiixLom","pdf",215043,1,13,"English","en",105,"# Abstract\n# Introduction\n# Setup and Background","[{\"question\":\"Why is training difficult when the output space contains millions of labels?\",\"answer\":\"The final classification layer requires an enormous amount of memory because its parameters scale with the number of labels and hidden units.\"},{\"question\":\"Why can naive sparse training reduce predictive performance?\",\"answer\":\"Although sparse connectivity lowers memory usage, the resulting models often perform much worse than dense counterparts.\"},{\"question\":\"How does the proposed method improve both memory usage and accuracy?\",\"answer\":\"It inserts a larger penultimate intermediate layer and constrains the sparse layer to uniform connectivity, enabling efficient GPU computation while maintaining predictive quality.\"}]","TOWARDS MEMORY-EFFICIENT TRAINING FOR EXTREMELY LARGE OUTPUT SPACES - LEARNING WITH 500 K LABELS ON A SINGLE COMMODITY GPU | PDF",1785725966,33,{"code":4,"msg":31,"data":32},"ok",{"site_id":24,"language":23,"slug":33,"title":13,"keywords":34,"description":14,"schema_data":35,"social_meta":86,"head_meta":88,"extra_data":90,"updated_unix":28},"towards-memory-efficient-training-for-extremely-large-output-spaces-learning-with-500k-labels-on-a-single-commodity-gpu","",{"@graph":36,"@context":85},[37,54,68],{"@type":38,"itemListElement":39},"BreadcrumbList",[40,44,48,51],{"item":41,"name":42,"@type":43,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":45,"name":46,"@type":43,"position":47},"https://docshare.wps.com/document/","Document",2,{"item":49,"name":12,"@type":43,"position":50},"https://docshare.wps.com/document/research-report/",3,{"item":52,"name":13,"@type":43,"position":53},"https://docshare.wps.com/document/towards-memory-efficient-training-for-extremely-large-output-spaces-learning-with-500k-labels-on-a-single-commodity-gpu/119722/",4,{"url":52,"name":13,"@type":55,"author":56,"headline":13,"publisher":58,"fileFormat":61,"inLanguage":23,"description":14,"dateModified":62,"datePublished":62,"encodingFormat":61,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":57},"Person",{"url":41,"name":59,"@type":60},"DocShare","Organization","application/pdf","2026-08-03",true,{"@type":65,"interactionType":66,"userInteractionCount":4},"InteractionCounter",{"@type":67},"ViewAction",{"@type":69,"mainEntity":70},"FAQPage",[71,77,81],{"name":72,"@type":73,"acceptedAnswer":74},"Why is training difficult when the output space contains millions of labels?","Question",{"text":75,"@type":76},"The final classification layer requires an enormous amount of memory because its parameters scale with the number of labels and hidden units.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"Why can naive sparse training reduce predictive performance?",{"text":80,"@type":76},"Although sparse connectivity lowers memory usage, the resulting models often perform much worse than dense counterparts.",{"name":82,"@type":73,"acceptedAnswer":83},"How does the proposed method improve both memory usage and accuracy?",{"text":84,"@type":76},"It inserts a larger penultimate intermediate layer and constrains the sparse layer to uniform connectivity, enabling efficient GPU computation while maintaining predictive quality.","https://schema.org",{"og:url":52,"og:type":87,"og:title":13,"og:site_name":59,"og:description":14},"article",{"robots":89,"canonical":52},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":92},[93,97,101,105,110,115,120,123,128,131,135],{"id":20,"doc_module":4,"doc_module_name":46,"category_name":94,"show_sort_weight":95,"slug":96},"Story & Novel",90,"story-novel",{"id":47,"doc_module":4,"doc_module_name":46,"category_name":98,"show_sort_weight":99,"slug":100},"Literature",80,"literature",{"id":53,"doc_module":4,"doc_module_name":46,"category_name":102,"show_sort_weight":103,"slug":104},"Exam",70,"exam",{"id":106,"doc_module":4,"doc_module_name":46,"category_name":107,"show_sort_weight":108,"slug":109},5,"Comic",60,"comic",{"id":111,"doc_module":4,"doc_module_name":46,"category_name":112,"show_sort_weight":113,"slug":114},6,"Technology",50,"technology",{"id":116,"doc_module":4,"doc_module_name":46,"category_name":117,"show_sort_weight":118,"slug":119},7,"Healthcare",40,"healthcare",{"id":11,"doc_module":4,"doc_module_name":46,"category_name":12,"show_sort_weight":121,"slug":122},30,"research-report",{"id":124,"doc_module":4,"doc_module_name":46,"category_name":125,"show_sort_weight":126,"slug":127},9,"Religion & Spirituality",20,"religion-spirituality",{"id":126,"doc_module":4,"doc_module_name":46,"category_name":129,"show_sort_weight":126,"slug":130},"World Cup","world-cup",{"id":132,"doc_module":4,"doc_module_name":46,"category_name":133,"show_sort_weight":132,"slug":134},10,"Lifestyle","lifestyle",{"id":136,"doc_module":4,"doc_module_name":46,"category_name":137,"show_sort_weight":106,"slug":138},19,"General","general"]