Improving LLM pretraining with better data organization

“Best-fit packing” adapts bin-packing to avoid unnecessary truncation of training documents, improving LLM performance across a wide range of tasks and reducing hallucination.

The documents used to train a large language model (LLM) are typically concatenated to form a single “superdocument”, which is then divided into sequences that match the model's context length. This improves training efficiency but often results in unnecessary truncations, where individual documents are broken up across successive sequences.

Related content
Contiguous parameter management and prefetched activation offloading expand the MiCS tool kit.

In paper we’re presenting at this year’s International Conference on Machine Learning (ICML 2024), titled “Fewer truncations improve language modeling”, we report an in-depth study of this common concatenation-chunking document-processing method. We found that it severely impairs the model's ability to understand contextual coherence and factual consistency. This not only affects the model's performance on downstream tasks but also increases the risk of hallucinations.

To address this issue, we propose best-fit packing, an innovative document-processing strategy that optimizes document combinations to eliminate unnecessary text truncations. In experiments, we compared a model trained using best-fit packing to one trained in the ordinary way on six downstream tasks: reading comprehension, natural-language inference, context following, summarization, commonsense and closed-book question answering, and program synthesis. We found that best-fit packing monotonically improves performance on an array of 22 sub-tasks, by as much as 15% (program synthesis) to 17% (context following). Importantly, best-fit packing also reduces closed-domain hallucination effectively by up to 58.3%.

Best-fit packing.png
A comparison of best-fit packing (left), which seeks to minimize document truncation, with the standard approach to large-language-model training, which concatenates training documents and then divides them into fixed-length sequences.

Consequences of truncation

In the analysis reported in our paper, we identified several problems caused by document truncation, including undefined names, ungrounded content, and missing knowledge.

Related content
Prompt engineering enables researchers to generate customized training examples for lightweight “student” models.

Undefined names: In programming languages like Python, truncation may separate definitions of variables from their invocations, introducing syntax errors and causing some variables to be undefined. As a consequence, the model may learn misleading patterns and possibly hallucinate on downstream tasks.

Ungrounded content: Truncation damages data integrity. In the example below, for instance, a reference (“the earthquake on Monday morning”) is separated from its antecedent, resulting in unfaithful generation.

Missing knowledge: Truncation hinders knowledge acquisition. In the example below, the model cannot learn the location of the ICML conference because the conference name and location occur in different training sequences.

Truncation errors.png
Examples of three common truncation errors: (a) undefined names, (b) ungrounded content, and (c) missing knowledge.

Best-fit packing

To address this issue, we propose optimizing the assignment of documents to training sequences so as to eliminate unnecessary truncations, while minimally increasing the number of sequences relative to concatenation. This is a variation of the well-known bin-packing problem, which is NP-hard in general, but we use a heuristic called the best-fit-decreasing (BFD) algorithm that tends to work well in practice. We thus call our method best-fit packing.

The normal implementation of BFD has quasi-linear time complexity, which is not efficient enough for LLM pretraining, which typically involves millions of documents. By taking advantage of the unique nature of pretraining data, however, we were able to optimize BFD so that it scales linearly with data size, ensuring its applicability to large-scale pretraining datasets. Further, we show that in practical applications, best-fit packing generates approximately the same number of training sequences as the traditional method, while significantly reducing data loss caused by truncation.

Truncations per document.png
Truncations per document as a function of document length, for both best-fit packing (pack) and concatenation (concat), for natural-language data (top) and programming-language data (bottom). The natural-language data is evaluated with context lengths of both 2,000 and 8,000.

Curious to know how we achieve it? Let’s dive deep!

Best-fit packing — an example

Following the standard bin-packing nomenclature, we call each training sequence a “bin”, and each bin has a capacity equal to the LLM’s context size. The goal is to assign a combination of whole documents to each bin so as to minimize the wasted bin capacity.

First, we divide any document that’s larger than the LLM context into context-length chunks, plus a remainder. Then we sort the documents (and document fragments) from largest to smallest. Finally, we work our way down the sorted list, assigning each document to the bin whose available space is as close to the document size as possible.

Related content
Novel “checkpointing” scheme that uses CPU memory reduces the time wasted on failure recovery by more than 92%.

To maximize efficiency, we use three data structures to manage the assignment of documents to bins: a binary tree and two tables. We can use this design because (1) the maximum bin size is the model’s context size, so the tree won’t be too deep, and (2) we do not need to distinguish bins with the same remaining capacity, which simplifies the the tree. Instead, we use the tables to map bin capacities to bins.

Consider a simple example, in which the context size (the bin size) is eight. The binary tree has eight leaves, corresponding to the eight possibilities for available space in any given bin. (In a real LLM, the context size is on the order of thousands of tokens, so the tree would have thousands of leaves.)

Each parent node of the tree has an associated number, indicating the size of the largest available bin slot among its descendants. The number associated with the parent’s right child is always greater than or equal to the number associated with the left child.

Initially, the value of the rightmost node in each layer of the tree is eight, and all the other nodes have values of zero. This means that all the available bin slots have a capacity of eight.

Best-fit initialization.png
The initial states of the three data structures we use to implement best-fit packing. The rightmost node of each layer of the tree has a value of eight, and all other nodes have values of zero, indicating that all the bins are empty (i.e., are at maximum capacity).

Now consider a later state, when four documents of size eight, six, six, and four have been packed. The two bins containing documents of size six have available slots of size two (8 – 6), and the bin containing a document of size four has an available slot of size four (8 – 4). These sizes are represented by the numbers two and four at leaves two and four of the tree. Multiple bins remain empty, so leaf eight has a value of eight, too.

Note that the value two at leaf two indicates only that at least one bin slot of size two is available; it doesn’t indicate how many such slots there are or where they can be found. That information is contained in the tables.

Tree after packing.png
The state of the data structures after four documents of sizes six, six, four, and eight have been packed.

Now consider a document of size three, which we wish to assign to a bin. To find the best available bin slot, simply go left at each node of the tree, unless going left leads to a node whose value is less than the document size, in which case, go right.

Document packing.png
Tree traversal identifies the available bin slot that best fits the new document.

The best fit for a document of size three is a slot of size four, and in the “space-to-bins” table, we see that there is one bin — bin three — with a slot of that size. So there we place the document.

Finally, we update all three data structures to reflect the new placement:

Data structure update.png
Data structure updates after the document (item four) of size three has been packed. The tree leaf corresponding to slot sizes of four is reset to zero, and the tree leaf corresponding to slot sizes of one is set to one. The tables are updated accordingly.

Results

To evaluate the effect of bin-packing on downstream tasks, we pretrained models of 7 billion and 13 billion parameters with context lengths of 2,000 and 8,000 on text and code using both best-fit packing and concatenation. We then tested both sets of models on our six downstream tasks. On average, across multiple datasets, context lengths, and metrics, best-fit packing offered better performance on all six tasks. The biggest gains came in reading comprehension (+4.7%), natural-language inference (+9.3%), context following (+16.8%), and program synthesis (+15.0%).

Related content
In a series of papers, Amazon researchers performed a theoretical analysis of a simplified problem that led to a learnable learning-rate scheduler, applied that scheduler to a more complex neural model, and distilled the results into a practical algorithm.

We also found that best-fit packing helped prevent closed-domain hallucination, particularly in program synthesis tasks, where it reduced "undefined name" errors by up to 58.3%, indicating a more complete understanding of program structure and logic.

Additionally, models trained with best-fit packing were better at following instructions, such as adhering to length constraints. And best-fit packing helped the model acquire “tail knowledge” that is truncation sensitive due to scarcity in training data. Indeed, this result suggests a possible reason for why LLMs struggle to learn long-tail knowledge.

While the experiments conducted in our paper primarily focused on LLM pretraining, best-fit packing is broadly applicable to fine tuning as well. Determining the benefits it can offer during fine tuning is an intriguing topic for future study.

Research areas

Related content

US, WA, Redmond
Amazon Leo is Amazon’s low Earth orbit satellite broadband network. Its mission is to deliver fast, reliable internet to customers and communities around the world, and we’ve designed the system with the capacity, flexibility, and performance to serve a wide range of customers, from individual households to schools, hospitals, businesses, government agencies, and other organizations operating in locations without reliable connectivity. Export Control Requirement: Due to applicable export control laws and regulations, candidates must be a U.S. citizen or national, U.S. permanent resident (i.e., current Green Card holder), or lawfully admitted into the U.S. as a refugee or granted asylum. We are looking for an experienced Data Scientist to help architect state-of-the-art test infrastructure and lead the development of data models and analysis tools to represent the ground truth about satellite test results in order to facilitate important business decisions. Our team is responsible for core infrastructure and tools that will serve as the backbone of automated satellite testing operations to enable rapid scaling of manufacturing processes. Key job responsibilities * Work with engineering, software and manufacturing teams to understand drivers, impacts, and key influences on satellite performance * Lead the design, build and implementation of production models and make decisions in real time for satellite test results * Drive actions at scale to optimize test methodology and drive increases to satellite reliability * Analysis and modeling of satellite telemetry from test results in lab and on-orbit * Develop models and data pipelines for satellite telemetry * Create and manage datasets for continued pre-training and supervised fine-tuning of LLMs * Develop scalable visualizations for analysis of satellite performance A day in the life As Amazon Leo Data Scientist you will own the architecture definition and development of data analysis tools to to aid engineering and production teams in deciding flight-worthiness of each Amazon Leo satellite and historical traceability tools to enable simplified discovery and interpretation of past test data. You will work with multiple engineering, software and manufacturing teams across ground and space systems, to specify requirements, define data collection, interpretation strategies, data pipelines and implement data analysis and reporting tools for Integrated Vehicle tests. Your focus will be in optimizing the analysis of test results to enable Amazon Leo production plans. About the team The Automated Vehicle Testing Team is a mix of scientists and software engineers responsible for data infrastructure, tools, and research that serve as the backbone of automated satellite testing operations to enable rapid scaling of manufacturing processes.
CN, 31, Shanghai
Worldwide Global Selling has been helping individuals and businesses increase sales and reach new customers around the globe. Today, more than 50% of Amazon's total unit sales come from third-party selection. The Global Selling team in China is responsible for recruiting local businesses to sell on Amazon's 19+ overseas marketplaces and supporting local Sellers' success and growth on Amazon. Our vision is to be the first choice for all types of Chinese business to go globally. The Worldwide Global Selling Analytics, Intelligence, and Technology (WWGS-AIT) team serves as the research, automation, and insight arm of the International Seller Service data hub, enabling rapid delivery of growth insights through strategic investments in regional data foundations, self-service business intelligence solutions, and artificial intelligence tools. The WWGS-AIT team is positioned to establish AI-ready foundational capabilities across the WWGS organization while maintaining excellence in business insight generation, and self-service BI/AI application development. WWGS-AIT is looking for a Data Scientist to design and build seller-facing AI agents that turn our AI-ready data foundation into intelligent, conversational experiences for Amazon's global sellers. You will own the intelligence layer of these agents end-to-end, from modeling and retrieval to evaluation and launch, working alongside applied scientists, data engineers, and the Seller Assistant platform team to put trustworthy AI directly into sellers' hands. Key job responsibilities - Design, build, and iterate seller-facing AI agents (LLM-powered) that help Chinese sellers grow globally, reasoning over WWGS-AIT's AI-ready data foundation and knowledge base. - Develop the intelligence layer of agents: retrieval-augmented generation (RAG) over our knowledge management system, tool-use / function-calling orchestration, prompt engineering, and model fine-tuning or adaptation where needed. - Ground agent responses in standardized metrics and unified seller profiles to guarantee consistency and accuracy across agents; design and enforce guardrails that prevent hallucination and protect sensitive, compliance-restricted data. - Build rigorous evaluation frameworks (golden datasets, offline evaluation, and online experimentation) to measure and continuously improve agent quality, safety, and seller impact. - Develop seller-intelligence models (segmentation, entity resolution / One-ID, ranking and recommendation) that power personalized agent experiences. - Partner with WWGS Tech and the Seller Assistant platform team to productionize agents and tools (e.g., via MCP), defining the model and intelligence contract while engineering operates the runtime. - Collaborate with business, product, and cross-functional partners to translate seller pain points into agent capabilities and measurable business outcomes. - Stay current with advances in GenAI and agentic systems, and bring applied research into production.
US, WA, Redmond
At Amazon, we’re inventing on behalf of customers, and with Amazon Leo, we’re redefining what global connectivity looks like. Our mission is to deliver fast, affordable broadband to unserved and underserved communities around the world through a constellation of low Earth orbit (LEO) satellites. Every system we build helps connect people to education, healthcare, opportunity, and each other. As a Data Scientist, you will be responsible for developing advanced analytics and machine learning solutions for user terminals. You will develop predictive models to proactively identify possible user terminal failures in the field. You will work in a collaborative environment with a multi-disciplinary team, including constellation, RF, antenna, silicon, algorithm, and software engineers. Key job responsibilities As a Data Scientist, you will develop analytic tools for a team developing current and future user terminals. Your responsibilities include: • Develop statistical and analytical tool to enable the regression decision from on-orbit and lab measurement of user terminals • Publish documents and create compelling visualizations and presentations to communicate insights to stakeholders • Create and manage datasets for continued pre-training and supervised fine-tuning of LLMs • Develop scalable visualizations for analysis of user terminal performance • Work closely with constellation, RF, antenna, silicon, algorithm, and software engineers to root-cause the failures using data as the primary tool • Drive consensus on metrics and analysis approaches to support product development strategy Export Control Requirement: Due to applicable export control laws and regulations, candidates must be a U.S. citizen or national, U.S. permanent resident (i.e., current Green Card holder), or lawfully admitted into the U.S. as a refugee or granted asylum. A day in the life As a Data Scientist in the LEO Customer Terminal Team, you will work daily with satellite constellation, algorithm, RF, antenna, silicon, hardware, and software teams in a collaborative environment. Your focus will be using data as an intelligence source to enable design decisions for the team. About the team The LEO Customer Terminal team is responsible for developing both outdoor and indoor devices that enable customers to access internet service via the LEO satellite network. We own the entire process from early prototypes through mass production, including requirements documentation, architecture definition, hardware development, algorithm development, and all integration and verification testing.
US, WA, Seattle
Amazon Web Services (AWS) is looking for a sr. Manager, Applied to join the Quick Science team. Quick is AWS’s enterprise generative AI assistant that helps users answer questions, summarize documents, generate content, take actions, and automate workflows using information across enterprise systems. As a key member of this team, you will lead research and development efforts in generative AI and Agentic AI to enable intelligent agents that perform complex reasoning, automate multi-step workflows, and make enterprise users significantly more productive. Key job responsibilities You’ll work on building and optimizing multi-modal foundation models, training and fine-tuning state-of-the-art LLMs, and architecting systems that scale efficiently across domains. This role blends science leadership, development of applied scientists, innovation, and deep collaboration with engineering teams to bring research into production.
US, NY, New York
MULTIPLE POSITIONS AVAILABLE Employer: AMAZON.COM SERVICES LLC Offered Position: Research Scientist II Job Location: New York, New York Job Number: AMZ9898222 Position Responsibilities: Interact with various software and business groups to develop an understanding of their business requirements and operational processes. Utilize acquired knowledge and business judgment to build scalable machine learning systems, optimization models and operational tools to improve the bottom line. Build quantitative mathematical models to represent a wide range of supply chain, transportation and logistics systems. Implement these models and tools using modeling languages and engineering code in software languages such as Python, C++, or JAVA. Gather required data for analysis and mathematical model building by writing ad-hoc scripts and database queries. Perform quantitative, economic, and numerical performance analyses of these systems under uncertainty using statistical and optimization tools. Create computer simulations to support operational decision-making. Identify areas with potential for improvement and work with internal teams to generate requirements to realize improvements. Design optimal or near optimal solution methodologies to be used by in-house decision support tools and software. Create software prototypes to verify and validate the devised solutions methodologies. Integrate prototypes into production systems using standard software development tools and methodologies. Position Requirements: Master's degree or foreign equivalent degree in Operations Research, Computer Science, Engineering, Mathematics, or a related field and one year of research or work experience in the job offered, or as a Research Scientist, Research Assistant, Software Engineer, or a related occupation. Employer will accept a Bachelor's degree or foreign equivalent degree in Operations Research, Computer Science, Engineering, Mathematics, or a related field and five years of progressive post-baccalaureate research or work experience in the job offered or a related occupation as equivalent to the Master's degree and one year of experience. Must have one year of research or work experience in the following skill(s): (1) programming with a major programming language including Java, C++, C#, C, or Python; and (2) formulating and solving both discrete and continuous optimization problems. Amazon.com is an Equal Opportunity-Affirmative Action Employer – Minority / Female / Disability / Veteran / Gender Identity / Sexual Orientation. 40 hours / week, 8:00am-5:00pm, Salary Range $158,440/year to $212,800/year. Amazon is a total compensation company. Dependent on the position offered, equity, sign-on payments, and other forms of compensation may be provided as part of a total compensation package, in addition to a full range of medical, financial, and/or other benefits. For more information, visit: https://www.aboutamazon.com/workplace/employee-benefits.#0000
IN, TN, Chennai
As a member of the CMT team, you'll play a key role in the evolution of our Competitive Monitoring systems to solve significantly complex and interesting technical challenges in machine learning, large language models in production, and recommender systems to name a few. The team's work directly impacts customer experience at a worldwide scale. Key job responsibilities Key job responsibilities 1. Research the problem domain and come up with various approaches to solve the problem. 2. Be willing to experiment quickly and fail fast. 3. Collaborate with engineers to come up with the right end to end solution to the business problems. 4. Ideate on future roadmap for science in CMT 5. Be willing to roll up your sleeves and learn core topics outside applied science, for example ML engineering A day in the life A typical day might involve (a) working on ideas for improving models around product similarity or price recommendations, (b) working closely with other scientists and our ML engineers to ensure that the best models are in production, (c) writing good maintainable code that can be reused and reproduced, (d) sharing your work across CMT and beyond via technical writings and presentations
US, CA, Sunnyvale
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 programming from Prime Video add-on subscriptions such as Apple TV+, Max, Crunchyroll and MGM+. All customers, regardless of whether they have a Prime membership or not, can rent or buy titles via the Prime Video Store, and can enjoy even more content for free with ads. Are you interested in shaping the future of entertainment? Prime Video's technology teams are creating best-in-class digital video experience. As a Prime Video technologist, you’ll have end-to-end ownership of the product, user experience, design, and technology required to deliver state-of-the-art experiences for our customers. You’ll get to work on projects that are fast-paced, challenging, and varied. You’ll also be able to experiment with new possibilities, take risks, and collaborate with remarkable people. We’ll look for you to bring your diverse perspectives, ideas, and skill-sets to make Prime Video even better for our customers. With global opportunities for talented technologists, you can decide where a career Prime Video Tech takes you! Key job responsibilities - Develop ML models for various recommendation & search systems using deep learning, online learning, and optimization methods - Work closely with other scientists, engineers and product managers to expand the depth of our product insights with data, create a variety of experiments to determine the high impact projects to include in planning roadmaps - Stay up-to-date with advancements and the latest modeling techniques in the field - Publish your research findings in top conferences and journals A day in the life We're using advanced approaches such as foundation models to connect information about our videos and customers from a variety of information sources, acquiring and processing data sets on a scale that only a few companies in the world can match. This will enable us to recommend titles effectively, even when we don't have a large behavioral signal (to tackle the cold-start title problem). It will also allow us to find our customer's niche interests, helping them discover groups of titles that they didn't even know existed. We are looking for creative & customer obsessed machine learning scientists who can apply the latest research, state of the art algorithms and ML to build highly scalable page personalization solutions. You'll be a research leader in the space and a hands-on ML practitioner, guiding and collaborating with talented teams of engineers and scientists and senior leaders in the Prime Video organization. You will also have the opportunity to publish your research at internal and external conferences.
US, CA, Sunnyvale
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 programming from Prime Video add-on subscriptions such as Apple TV+, Max, Crunchyroll and MGM+. All customers, regardless of whether they have a Prime membership or not, can rent or buy titles via the Prime Video Store, and can enjoy even more content for free with ads. Are you interested in shaping the future of entertainment? Prime Video's technology teams are creating best-in-class digital video experience. As a Prime Video technologist, you’ll have end-to-end ownership of the product, user experience, design, and technology required to deliver state-of-the-art experiences for our customers. You’ll get to work on projects that are fast-paced, challenging, and varied. You’ll also be able to experiment with new possibilities, take risks, and collaborate with remarkable people. We’ll look for you to bring your diverse perspectives, ideas, and skill-sets to make Prime Video even better for our customers. With global opportunities for talented technologists, you can decide where a career Prime Video Tech takes you! We are looking for a self-motivated, passionate and resourceful Applied Scientist to bring diverse perspectives, ideas, and skill-sets to make Prime Video even better for our customers. You will spend your time as a hands-on machine learning practitioner and a research leader. You will play a key role on the team, building and guiding machine learning models from the ground up. At the end of the day, you will have the reward of seeing your contributions benefit millions of Amazon.com customers worldwide. Key job responsibilities - Develop AI solutions for various Prime Video Search systems using Deep learning, GenAI, Reinforcement Learning, and optimization methods; - Work closely with engineers and product managers to design, implement and launch AI solutions end-to-end; - Design and conduct offline and online (A/B) experiments to evaluate proposed solutions based on in-depth data analyses; - Effectively communicate technical and non-technical ideas with teammates and stakeholders; - Stay up-to-date with advancements and the latest modeling techniques in the field; - Publish your research findings in top conferences and journals. About the team Prime Video Search Science team owns science solution to power search experience on various devices, from sourcing, relevance, ranking, to name a few. We work closely with the engineering teams to launch our solutions in production.
US, WA, Seattle
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 programming from Prime Video subscriptions such as Apple TV+, HBO Max, Peacock, Crunchyroll and MGM+. All customers, regardless of whether they have a Prime membership or not, can rent or buy titles via the Prime Video Store, and can enjoy even more content for free with ads. Are you interested in shaping the future of entertainment? Prime Video's technology teams are creating best-in-class digital video experience. As a Prime Video team member, you’ll have end-to-end ownership of the product, user experience, design, and technology required to deliver state-of-the-art experiences for our customers. You’ll get to work on projects that are fast-paced, challenging, and varied. You’ll also be able to experiment with new possibilities, take risks, and collaborate with remarkable people. We’ll look for you to bring your diverse perspectives, ideas, and skill-sets to make Prime Video even better for our customers. With global opportunities for talented technologists, you can decide where a career Prime Video Tech takes you! Key job responsibilities As a highly experienced science leader in speech and audio processing, you will apply state-of-the-art research in automatic speech recognition, voice synthesis, speech translation, and prosody modeling to make content sound great in every language, powering features like Dialogue Boost, AI-Assisted Dubbing, and Automated Audio Descriptions. You will lead the research direction for a team of deeply talented applied scientists working at the intersection of speech AI and accessibility, defining roadmaps that advance our capabilities in dialogue enhancement, hybrid AI-human dubbing pipelines, and dialect adaptation at scale. You will communicate these roadmaps effectively to senior leadership, connecting technical breakthroughs to customer impact. About the team The Prime Video - Content Reasoning, Enrichment & Localization Team's mission is to deeply understand all content and empower all customers with relevant language options, innovative accessibility assists, and rich title-information across all their content-experiences on Prime Video. We create and publish content on-time that's meaningful, accurate, and accessible to every customer globally. We delight our customers by pushing the boundaries of content understanding and enrichment. Through inclusion and innovation, we do the most fulfilling work of our career.
JP, 13, Tokyo
Do you want to see your research directly impact how millions of customers discover, browse, and purchase products on Amazon — across Japan and the globe? Amazon's Japan Store Tech team owns the science and technology behind cross-border shopping — product discovery, search relevance, personalization, and content experiences spanning dozens of marketplaces. We tackle problems at massive scale: multi-language signals, multi-marketplace data, and region-specific customer behaviors, all served at low latency to millions of daily shoppers. We're looking for current Bachelor or Master students with a passion for applied science and machine learning to join us as an Applied Scientist in 2028 to shape the future of customer experiences at scale. For this position, our Japan Store Tech team is looking for students with a specialization in one or more of the following research areas: machine learning, deep learning, natural language processing (NLP), information retrieval, recommender systems, computer vision, large language models (LLMs), generative AI, causal inference, experimentation and A/B testing, optimization, and more! As an Applied Scientist Intern, you'll develop novel models and algorithms, design and run experiments on live traffic, and own meaningful science contributions end-to-end. You'll also leverage and contribute to GenAI/LLM systems that power both customer-facing experiences and internal development tools. If you want to kickstart your science career at global scale — solving real customer problems alongside talented scientists and engineers in a collaborative, international environment — this is the place to start. Key job responsibilities - Collaborate and communicate effectively with experienced cross-disciplinary Amazonians to design, develop, and deploy innovative machine learning models and scientific solutions that delight our customers, while participating in technical discussions to drive solutions forward. - Develop and implement scalable machine learning models and algorithms to improve product discovery, search relevance, personalization, or other customer-facing experiences. - Design and conduct experiments (offline and online) to validate hypotheses and measure the impact of proposed solutions. - Analyze large-scale datasets to identify patterns, generate insights, and inform model design decisions. - Leverage and contribute to the development of GenAI and LLM-powered tools to enhance customer experiences and development productivity while staying current with emerging technologies. - Write clean, maintainable, production-quality code following best practices. - Communicate research findings effectively through documentation, presentations, and technical papers. - Work in an agile environment and collaborate closely with software engineers to bring science solutions from prototype to production.