To correct imbalances in training data, don’t oversample: Cluster

In experiments involving sound recognition, technique reduces error rate by 15% to 30%.

Most modern machine learning systems are classifiers. They take input data and sort it into categories: pictures of particular animals, vocalizations of particular words, words acting as particular parts of speech, and the like.

Ideally, when a system is being trained to perform multiple classifications — say, pictures of cats, dogs, and horses — it will see roughly the same number of training examples from each category. Otherwise, it will probably end up biased toward the category that it sees most frequently.

Sometimes, though, imbalances in training data are unavoidable, and somehow, the training process has to correct for them. This spring, at the International Conference on Acoustics, Speech, and Signal Processing, my colleagues and I will present a new technique for correcting such imbalances.

In experiments, we applied our technique to the problem of recognizing particular sounds, such as glass breaking or babies crying. We found that, for a type of neural network commonly used in audio detection, our technique reduced error rates by 15% to 30% over the standard technique for correcting data imbalances.

To get a sense of the problem of data imbalance, suppose that a classifier were trained on examples of three classes, and one of the classes had 20 times as much training data as the other two. By simply assigning every input to the overrepresented class, the classifier could achieve 90% accuracy on the training data; it would have little incentive to resolve borderline cases in favor of either of the other two classes.

The standard way to address data imbalances is simply to overweight the examples in the underrepresented classes: if a particular class has one-fifth as much training data as another, each of its examples should count five times as much.

A more sophisticated approach is to train a neural network to produce “embeddings” that capture differences between data in different classes. An embedding is a representation of a data item as a point in a fixed-dimensional space (a vector). A neural network can be trained to produce embeddings that maximize the distances between points in different classes. The embedding vectors, not the data themselves, then serve as inputs to a classifier.

Model depicting the stages in the training of an embedding network
Stages in the training of an embedding network. Initially, the embedding is random, with points representing data from three different classes jumbled together. After two passes through the training data, the embedding produces greater separation between data points (center left). After five passes through the data, the embedding reliably groups data of the same class together (center right and far right).

Data imbalance is a problem when learning embeddings, too, so during training, if any data class is larger than any others, it’s split into clusters that are approximately the size of the smallest class. (In the figure above, for instance, the dots on the red end of the color spectrum are all from the same class. As it was four times the size of the other two classes, it was split into four clusters.)

Historically, the problem with this approach has been that, during training, every time the neural network embeds a new data item, it has to measure the distance between that item and every other item it’s seen. For large data sets, this is impractically time consuming.

To solve this problem, our algorithm instead keeps a running measurement of the centroid of each data cluster in the embedding space. The centroid is the point that minimizes the average distance of all the points of the cluster (like a center of gravity). With each new embedding, our algorithm measures its distance from the centroids of the clusters, a much more efficient computation than exhaustively measuring pairwise distances.

Once the embedding network is trained, we use its outputs as training data for a new classifier, which, unlike the embedding network, applies labels to input data. We found that our system works best if we allow the process of training the classifier to adjust the internal settings of the embedding network, too.

We tested our system on four types of sounds from an industry-standard data set: dogs’ barks, babies’ cries, gunshots, and background sounds. We also experimented with two different network architectures for doing the embeddings: a small, efficient long short-term memory (LSTM) network and a larger, slower, but more accurate convolutional neural net (CNN). As a baseline, we used the same architectures but adjusted for data imbalances by overweighting underrepresented samples, rather than maximizing distances in the embedding space.

Across the board, our embeddings improved the performance of the LSTM model, reducing the error rate by 15% to 30% on particular sounds and by 22% overall. For many applications, smaller networks will be preferable because of their greater efficiency.

With the CNN model, the results were more varied. When the ratio of the sizes of the data classes was 6:1:2:16 (dog : baby : gunshot : background), the baseline CNN model slightly outperformed our system on the most underrepresented class (baby’s cries), with a relative error reduction of 6%. But our system’s advantage on the other two classes was great enough that it still performed better overall.

When the ratio of negative to positive data was larger, however (2:2:1:26), our system outperformed the CNN model across the board, with an average relative error reduction of 19%. This suggests that the greater the data imbalance, the greater the advantage our system enjoys.

Acknowledgments: Vipul Arora, Chao Wang

Related content

US, WA, Seattle
Are you interested in shaping the future of entertainment? Prime Video's technology teams are creating best-in-class digital video experience. Prime Video is a first-stop entertainment destination offering customers a vast collection of premium programming in one app available across thousands of devices. Prime members can customize their viewing experience and find their favorite movies, series, documentaries, and live sports – including Amazon MGM Studios-produced series and movies; licensed fan favorites; and exclusive access to coverage of live sports. All customers regardless of whether they have a Prime membership or not, can access programming from subscriptions such as Apple TV, Peacock Premium Plus, HBO Max, FOX One, Crunchyroll and MGM+, as well as more than 900 free ad-support (FAST) Channels, rent or buy titles, and enjoy even more content for free with ads. The Prime Video Personalization and Discovery team matches customers with the right content at the right time, at all touch points throughout the content discovery journey. We are looking for a customer-focused, solutions-oriented Data Scientist to help build new data-driven frameworks to understand what makes new personalization and content discovery innovations successful for users and the business. You'll be part of an embedded science team on projects that are fast-paced, challenging, and ultimately influence what millions of customers around the world see when the log into Prime Video. The ideal candidate brings strong problem-solving skills, stakeholder communication skills, and the ability to balance technical rigor with delivery speed and customer impact. You will build cross-functional support within Prime Video, assess business problems, define metrics, and support iterative scientific solutions that balance short-term delivery with long-term science roadmaps. Key job responsibilities - Use advanced statistical and machine learning techniques to extract insights from complex, large-scale data sets - Design and implement end-to-end data science workflows, from data acquisition and cleaning to model development, testing, and deployment - Support scalable, self-service data analyses by building datasets for analytics, reporting and ML use cases - Partner with product stakeholders and senior science peers to identify strategic data-driven opportunities to improve the customer experience - Communicate findings, conclusions, and recommendations to technical and non-technical stakeholders - Stay up-to-date on the latest data science tools, techniques, and best practices and help evangelize them across the organization
IN, KA, Bengaluru
Amazon Music is an immersive audio entertainment service that deepens connections between fans, artists, and creators. From personalized music playlists to exclusive podcasts, concert livestreams to artist merch, Amazon Music is innovating at some of the most exciting intersections of music and culture. We offer experiences that serve all listeners with our different tiers of service: Prime members get access to all the music in shuffle mode, and top ad-free podcasts, included with their membership; customers can upgrade to Amazon Music Unlimited for unlimited, on-demand access to 100 million songs, including millions in HD, Ultra HD, and spatial audio; and anyone can listen for free by downloading the Amazon Music app or via Alexa-enabled devices. Join us for the opportunity to influence how Amazon Music engages fans, artists, and creators on a global scale. Learn more at https://www.amazon.com/music. The Music Catalog Quality team at Amazon Music serves a key role in developing solutions to ensure and improve the quality of catalog metadata and content across the music streaming experience. We create solutions that detect, measure, and remediate quality issues in music metadata - including artist information, track attributes, versions, content tags, and provide actionable insights that enable continuous improvement of the catalog. We leverage a host of scientific and engineering technologies to accomplish this mission, including Generative AI, classical ML, Natural Language Processing, Computer Vision, and automated data validation pipelines. Key job responsibilities As an Applied Scientist, you will own the design and development of end-to-end systems. You’ll have the opportunity to create technical roadmaps, and drive production level projects that will support Amazon Science. You will work closely with Amazon scientists, and other science interns to develop solutions and deploy them into production. The ideal scientist must have the ability to work with diverse groups of people and cross-functional teams to solve complex business problems. Other responsibilities include: - Collaborate with scientists, engineers, and product managers to define and frame business problems as ML or optimization tasks. - Use machine learning, deep learning, LLMs and Agentic AI techniques to create scalable solutions for business problems - Analyze and extract relevant information from large amounts of Amazon's data to help automate and optimize key processes - Design, development and evaluation of AI models for predictive learning - Research and implement novel machine learning and statistical approaches - Implement scalable data pipelines and model-serving systems. - Analyze experimental results, draw insights, and refine models to improve accuracy and robustness. - Communicate findings and recommendations to technical and non-technical audiences.
IN, KA, Bengaluru
Amazon Music is an immersive audio entertainment service that deepens connections between fans, artists, and creators. From personalized music playlists to exclusive podcasts, concert livestreams to artist merch, Amazon Music is innovating at some of the most exciting intersections of music and culture. We offer experiences that serve all listeners with our different tiers of service: Prime members get access to all the music in shuffle mode, and top ad-free podcasts, included with their membership; customers can upgrade to Amazon Music Unlimited for unlimited, on-demand access to 100 million songs, including millions in HD, Ultra HD, and spatial audio; and anyone can listen for free by downloading the Amazon Music app or via Alexa-enabled devices. Join us for the opportunity to influence how Amazon Music engages fans, artists, and creators on a global scale. Learn more at https://www.amazon.com/music. The Music Catalog Quality team at Amazon Music serves a key role in developing solutions to ensure and improve the quality of catalog metadata and content across the music streaming experience. We create solutions that detect, measure, and remediate quality issues in music metadata - including artist information, track attributes, versions, content tags, and provide actionable insights that enable continuous improvement of the catalog. We leverage a host of scientific and engineering technologies to accomplish this mission, including Generative AI, classical ML, Natural Language Processing, Computer Vision, and automated data validation pipelines. Key job responsibilities As an Applied Scientist, you will own the design and development of end-to-end systems. You’ll have the opportunity to create technical roadmaps, and drive production level projects that will support Amazon Science. You will work closely with Amazon scientists, and other science interns to develop solutions and deploy them into production. The ideal scientist must have the ability to work with diverse groups of people and cross-functional teams to solve complex business problems. Other responsibilities include: - Collaborate with scientists, engineers, and product managers to define and frame business problems as ML or optimization tasks. - Use machine learning, deep learning, LLMs and Agentic AI techniques to create scalable solutions for business problems - Analyze and extract relevant information from large amounts of Amazon's data to help automate and optimize key processes - Design, development and evaluation of AI models for predictive learning - Research and implement novel machine learning and statistical approaches - Implement scalable data pipelines and model-serving systems. - Analyze experimental results, draw insights, and refine models to improve accuracy and robustness. - Communicate findings and recommendations to technical and non-technical audiences.
IN, KA, Bengaluru
Amazon Music is an immersive audio entertainment service that deepens connections between fans, artists, and creators. From personalized music playlists to exclusive podcasts, concert livestreams to artist merch, Amazon Music is innovating at some of the most exciting intersections of music and culture. We offer experiences that serve all listeners with our different tiers of service: Prime members get access to all the music in shuffle mode, and top ad-free podcasts, included with their membership; customers can upgrade to Amazon Music Unlimited for unlimited, on-demand access to 100 million songs, including millions in HD, Ultra HD, and spatial audio; and anyone can listen for free by downloading the Amazon Music app or via Alexa-enabled devices. Join us for the opportunity to influence how Amazon Music engages fans, artists, and creators on a global scale. Learn more at https://www.amazon.com/music. The Music Catalog Quality team at Amazon Music serves a key role in developing solutions to ensure and improve the quality of catalog metadata and content across the music streaming experience. We create solutions that detect, measure, and remediate quality issues in music metadata - including artist information, track attributes, versions, content tags, and provide actionable insights that enable continuous improvement of the catalog. We leverage a host of scientific and engineering technologies to accomplish this mission, including Generative AI, classical ML, Natural Language Processing, Computer Vision, and automated data validation pipelines. Key job responsibilities As an Applied Scientist, you will own the design and development of end-to-end systems. You’ll have the opportunity to create technical roadmaps, and drive production level projects that will support Amazon Science. You will work closely with Amazon scientists, and other science interns to develop solutions and deploy them into production. The ideal scientist must have the ability to work with diverse groups of people and cross-functional teams to solve complex business problems. Other responsibilities include: - Collaborate with scientists, engineers, and product managers to define and frame business problems as ML or optimization tasks. - Use machine learning, deep learning, LLMs and Agentic AI techniques to create scalable solutions for business problems - Analyze and extract relevant information from large amounts of Amazon's data to help automate and optimize key processes - Design, development and evaluation of AI models for predictive learning - Research and implement novel machine learning and statistical approaches - Implement scalable data pipelines and model-serving systems. - Analyze experimental results, draw insights, and refine models to improve accuracy and robustness. - Communicate findings and recommendations to technical and non-technical audiences.
US, CA, San Diego
Do you want to join an innovative team of scientists and engineers who use terabytes of data and create state-of-the-art Generative AI algorithms to push the boundaries of AI creativity? We are building foundational behavioral models for Amazon Stores using Generative AI, LLMs and Large Model training techniques that fuses general world knowledge, customer shopping behavior and Amazon e-commerce domain knowledge. We are looking for scientists who are passionate about technology, innovation, and customer experience, and are ready to make a lasting impact on the industry using intelligent and transformative AI applications. Working closely with cross-functional teams, you will be an essential part of every stage of AI development, from ideation and design to rigorous testing and successful deployment, ensuring our AI projects drive innovation and provide value for our customers. If you’re fired up about being part of a dynamic, driven team, then this is your moment to join us on this exciting journey! Key job responsibilities In this role you will leverage your background and expertise to lead developing foundational behavioral model for Amazon Stores using Generative AI, LLM and Large Model training techniques. On a day-to-day basis, you will: - Research and implement new algorithms and architectures for generative AI applications. - Optimize model performance and scalability for inference and deployment. - Collaborate with other talented applied scientists and engineers to gather and preprocess large datasets and develop an improved training infrastructure that accelerates innovation. - Experiment with SOTA methods to improve generative AI model quality. - Provide technical expertise and guidance to support the integration of generative AI solutions into various products and services.
IN, KA, Bengaluru
The Music Catalog Quality team at Amazon Music serves a key role in developing solutions to ensure and improve the quality of catalog metadata and content across the music streaming experience. We create solutions that detect, measure, and remediate quality issues in music metadata - including artist information, track attributes, versions, content tags, and provide actionable insights that enable continuous improvement of the catalog. We leverage a host of scientific and engineering technologies to accomplish this mission, including Generative AI, classical ML, Natural Language Processing, Computer Vision, and automated data validation pipelines. As an Applied Science Manager on the team, you will lead a team of scientists to define and execute a transformative vision for holistic catalog quality measurement, metadata enrichment, and content integrity. Your team will own the science solutions for foundational quality detection frameworks, metadata validation and correction technologies, state-of-the-art algorithms to identify and resolve catalog anomalies (violative content, duplicative/low value content, misattributed tracks, incorrect metadata), and/or agentic AI solutions that help internal teams quickly surface and fix quality issues to ensure customers receive accurate, complete catalog experiences. Key job responsibilities You independently manage a team of scientists. You identify the needs of your team and effectively grow, hire, and promote scientists to maintain a high-performing team. You have a broad understanding of scientific techniques, several of which may fall out of your specific job function. You define the strategic vision for your team. You establish a roadmap and successfully deliver scientific solutions that innovate on catalog quality detection, metadata enrichment, and content integrity. You define clear goals for your team and effectively prioritize, balancing short-term quality improvements and long-term innovation in catalog intelligence. You establish clear and effective metrics and scientific process to enforce consistent, high-quality artifact delivery and measurable catalog quality improvements. You proactively identify risks and bring them to the attention of your manager, customers, and stakeholders with plans for mitigation before they become roadblocks. You know when to escalate. You communicate ideas effectively, both verbally and in writing, to all types of audiences. You author strategic documentation for your team. You communicate issues and options with leaders in such a way that facilitates understanding and that leads to a decision. You work successfully with customers, leaders, and engineering teams. You foster a constructive dialogue, harmonize discordant views, and lead the resolution of contentious issues. About the team We are a team of scientists and MLEs focused on music catalog quality and metadata intelligence. You will work with colleagues with deep expertise in ML, NLP, CV, Gen AI, and data quality systems with a diverse range of backgrounds. We partner closely with top-notch engineers, product managers, content operations teams, and other scientists with expertise in music metadata, content classification, and building scalable modeling and software solutions that keep the Amazon Music catalog accurate, complete, and trustworthy.
US, CA, San Diego
Do you want to join an innovative team of scientists and engineers who use terabytes of data and create state-of-the-art Generative AI algorithms to push the boundaries of AI creativity? We are building foundational behavioral models for Amazon Stores using Generative AI, LLMs and Large Model training techniques that fuses general world knowledge, customer shopping behavior and Amazon e-commerce domain knowledge. We are looking for scientists who are passionate about technology, innovation, and customer experience, and are ready to make a lasting impact on the industry using intelligent and transformative AI applications. Working closely with cross-functional teams, you will be an essential part of every stage of AI development, from ideation and design to rigorous testing and successful deployment, ensuring our AI projects drive innovation and provide value for our customers. If you’re fired up about being part of a dynamic, driven team, then this is your moment to join us on this exciting journey! Key job responsibilities In this role you will leverage your background and expertise to lead developing foundational behavioral model for Amazon Stores using Generative AI, LLM and Large Model training techniques. On a day-to-day basis, you will: - Research and implement new algorithms and architectures for generative AI applications. - Optimize model performance and scalability for inference and deployment. - Collaborate with other talented applied scientists and engineers to gather and preprocess large datasets and develop an improved training infrastructure that accelerates innovation. - Experiment with SOTA methods to improve generative AI model quality. - Provide technical expertise and guidance to support the integration of generative AI solutions into various products and services.
US, WA, Seattle
Do you want to join an innovative team of scientists and engineers who use terabytes of data and create state-of-the-art Generative AI algorithms to push the boundaries of AI creativity? We are building foundational behavioral models for Amazon Stores using Generative AI, LLMs and Large Model training techniques that fuses general world knowledge, customer shopping behavior and Amazon e-commerce domain knowledge. We are looking for scientists who are passionate about technology, innovation, and customer experience, and are ready to make a lasting impact on the industry using intelligent and transformative AI applications. Working closely with cross-functional teams, you will be an essential part of every stage of AI development, from ideation and design to rigorous testing and successful deployment, ensuring our AI projects drive innovation and provide value for our customers. If you’re fired up about being part of a dynamic, driven team, then this is your moment to join us on this exciting journey! Key job responsibilities In this role you will leverage your background and expertise to lead developing foundational behavioral model for Amazon Stores using Generative AI, LLM and Large Model training techniques. On a day-to-day basis, you will: - Research and implement new algorithms and architectures for generative AI applications. - Optimize model performance and scalability for inference and deployment. - Collaborate with other talented applied scientists and engineers to gather and preprocess large datasets and develop an improved training infrastructure that accelerates innovation. - Experiment with SOTA methods to improve generative AI model quality. - Provide technical expertise and guidance to support the integration of generative AI solutions into various products and services.
US, MA, Boston
The Alexa Edge AI team is looking for a passionate, talented, and innovative senior applied scientist with a strong background in deep learning and speech processing techniques. You will have an enormous opportunity to impact the customer experience, design, architecture, and implementation of an industry-leading product used every day by people you know. As an Applied Scientist, you will leverage Amazon’s heterogeneous data sources and large-scale computing resources to develop novel machine learning algorithms to advance the state of the art in speech and audio processing. Key job responsibilities · Conduct applied research project(s) effectively and know when to ask for help and when to work independently · Engage with an experienced cross-disciplinary staff to conceive and design innovative solutions for consumer products. · Actively participate and contribute to research activities including publications and patents · Work closely with an internal inter-disciplinary team, and outside partners to drive key aspects of product definition, execution and test. · Be proactive, flexible and able to succeed within an open collaborative peer environment
US, CA, Pasadena
We are seeking an Applied Scientist to join the SAF Lab. In this role, you will lead the effort in safe reinforcement learning (RL) including the development of legged locomotion algorithms that internalize safety and are deployable on physical hardware—enabling highly dynamic robots to walk, run, avoid collisions and recover from disturbances with agility and robustness. You will develop RL architectures that interface with physics-based models (for dynamic retargeting and reward shaping), internalize safety constraints in training, sim-to-real transfer and interface with safety filters at run-time. Therefore, your work will sit at the intersection of safety-critical control and learning, and you will collaborate with others in the SAF Lab and Amazon working on perception, planning, whole-body and safety-critical control. This is an opportunity to shape the foundations of safe learning on emerging platforms that will remove bottlenecks to deployment and enable these robots to safely operate around humans. Key job responsibilities • Collaborate with product teams and science leaders to set a science roadmap (with eventual impact on real robots). • Design, train, and deploy reinforcement learning (RL) policies for dynamic legged locomotion including walking, running, stair climbing, and fall recovery on physical robots • Develop sim-to-real transfer pipelines that produce policies robust to the reality gap, including domain randomization, system identification, and adaptive strategies • Integrate control-based methods with RL, as inputs to the RL (dynamic retargeting and control-guided rewards), in training (internalizing safety constraints in training), and as the RL feeds into safety layers and whole-body control • Develop and maintain large-scale training infrastructure for locomotion policy learning, including physics simulation environments, domain randomization and GPU parallelization • Investigate the distillation of locomotion policies, integration with whole-body control, foundation models, VLAs, world models, perception and full-stack autonomy • Evaluate policy performance rigorously through simulation benchmarks, hardware experiments, and failure-mode analysis • Publish research at top-tier robotics and ML venues and contribute to Amazon's scientific reputation in advanced robotics • Collaborate with perception and planning teams to enable terrain-aware and goal-conditioned locomotion behaviors A day in the life Amazon offers a full range of benefits that support you and eligible family members, including domestic partners and their children. Benefits can vary by location, the number of regularly scheduled hours you work, length of employment, and job status such as seasonal or temporary employment. The benefits that generally apply to regular, full-time employees include: 1. Medical, Dental, and Vision Coverage 2. Maternity and Parental Leave Options 3. Paid Time Off (PTO) 4. 401(k) Plan If you are not sure that every qualification on the list above describes you exactly, we'd still love to hear from you! At Amazon, we value people with unique backgrounds, experiences, and skillsets. If you’re passionate about this role and want to make an impact on a global scale, please apply! About the team Work with the inventor of control barrier functions in the Safe Autonomy Frontiers (SAF) Lab. The first industry research lab in safe autonomy, developing a universal safety layer for the next generation of robotic systems: mobile robots, manipulators, mobile manipulators, and future platforms with dynamic stability. You will push the frontiers of performant safety for highly dynamic robots: CBF theory integrated with perception and learning, evaluated on next-generation robots. Your work will underpin robots operating alongside people at Amazon's unprecedented scale.