<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by HyunJae Lee on Medium]]></title>
        <description><![CDATA[Stories by HyunJae Lee on Medium]]></description>
        <link>https://medium.com/@hyunjae.lee410?source=rss-b5de61fddc69------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SjPR4fo1f87e5ZoBMCMG6w.jpeg</url>
            <title>Stories by HyunJae Lee on Medium</title>
            <link>https://medium.com/@hyunjae.lee410?source=rss-b5de61fddc69------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 02:10:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hyunjae.lee410/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What Makes a Good Research Engineer?]]></title>
            <link>https://medium.com/@hyunjae.lee410/what-makes-a-good-research-engineer-7dee98fc2dac?source=rss-b5de61fddc69------2</link>
            <guid isPermaLink="false">https://medium.com/p/7dee98fc2dac</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[self-improvement]]></category>
            <dc:creator><![CDATA[HyunJae Lee]]></dc:creator>
            <pubDate>Sun, 18 Aug 2024 07:17:02 GMT</pubDate>
            <atom:updated>2024-08-18T07:17:02.982Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>A few years ago, I transitioned from a research scientist to a research engineer because building AI models has become more standardized and I believed the key to making an impact was to apply existing research effectively. During a recent 1:1 lunch, a team member raised an interesting question: “<em>while it’s relatively straightforward to identify what makes a good research scientist, what distinguishes a good research engineer?”</em> This question really got me thinking because both of us started as research scientists before becoming research engineers. I’ve seen the challenges in both roles, but it’s still not easy to clearly explain exactly what makes a good research engineer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P6j6CmtuFBbOSD6z" /><figcaption>Photo from <a href="https://unsplash.com/photos/man-standing-near-whiteboard-0g-iLtxmMhA">Unsplash</a></figcaption></figure><p>Then I realized that the core attributes of a great research engineer are not so different from those of a research scientist. Both scientists and engineers tackle complex problems with the potential for high impact, though they may approach these challenges from different angles. Through my experiences in interviews and collaborations over the years, I’ve observed some attributes needed to achieve meaningful and impactful research:</p><ol><li><strong>A Strong Foundation in Both Theoretical and Practical Aspects: </strong>Theoretical knowledge provides the basis for developing new models and techniques, while practical experience ensures these models can be effectively applied to real-world problems.</li><li><strong>Identifying Significant and Meaningful Problems: </strong>This goes beyond simply applying the latest trends (e.g. applying Vision Transformers in a specific domain). It involves detecting meaningful problems that, if solved, could have a significant impact on the community.</li><li><strong>Developing Innovative and Practical Solutions: A </strong>good researchers critically assess whether a solution makes sense, if it’s efficient, and how it compares to existing methods. They focus on creating solutions that are not only innovative but also practical.</li><li><strong>Conducting Thorough Experiments and Analysis: </strong>This means going beyond just showing that something works; it involves designing experiments that explain why and how the solution works, and under what conditions it might fail.</li></ol><p>In this blog post, I’ll explore what makes a good research engineer and how we can develop these important qualities. While the core attributes of research scientists and engineers may not be exactly the same, you’ll notice they are quite similar.</p><h3>What Makes a Good Research Engineer?</h3><p>The role of a research engineer is broad and varied, often encompassing a wide range of tasks that can differ significantly even within the same company. For example, in OpenAI, one research engineer might be focused on building distributed training frameworks, another on optimizing model training pipelines, and yet another on enhancing the efficiency of machine learning models. Despite these diverse responsibilities, I believe that the key attributes that make a good research engineer are quite similar across different teams.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NkG7vGS0gnORfp84fJOhyA.png" /><figcaption>Diverse specializations of research engineers at <a href="https://openai.com/careers/search/">OpenAI</a></figcaption></figure><p>I’ll explore these key attributes and provide some examples from my own team, which develops <a href="https://medium.com/p/94fd2da2a3f2">a cloud-based training platform</a> and <a href="https://medium.com/p/0b1d1c05e830">an automated AI product development framework</a>. While the specifics of each team’s work may vary, the underlying qualities needed for success are quite similar.</p><h4>1. Technical Knowledge</h4><p>A research engineer should have a deep understanding of AI systems and algorithms, along with strong software development skills to effectively implement and optimize these technologies. In our team, this includes expertise in AI model development pipeline (e.g., data preprocessing, model training, evaluation, deployment) and AI algorithms related to AutoML (e.g. hyperparameter optimization, active learning). Additionally, proficiency in backend development (e.g., Django, Celery), frontend development (e.g. React, Next.js), and infrastructure (e.g. Kubernetes, Terraform) is crucial. While these specific areas of knowledge are key for our team, they may vary depending on the needs of each team. Having this breadth and depth of knowledge is important because it enables research engineers to build, optimize, and scale complex AI systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oCKpBVOSMFmrRyvB.png" /><figcaption>ML Engineer Roadmap (<a href="https://github.com/chris-chris/ml-engineer-roadmap">source</a>)</figcaption></figure><h4>2. Defining Problems</h4><p>While research engineers often focus on solving predefined problems, a key attribute of a great engineer is the ability to effectively define the problem in the first place. This involves evaluating the importance and impact of the problem within the broader context of the project or organization.</p><p>A deep understanding of both AI and software development is crucial in this process. It allows engineers to spot inefficiencies, gaps, or areas of improvement that might not be immediately obvious. For instance, in my team’s case, our organization had an inefficient process for model training and AI model development pipeline. We identified the need for a more effective solution, which led to the development of our <a href="https://medium.com/p/94fd2da2a3f2">cloud-based training platform</a> and an <a href="https://medium.com/p/0b1d1c05e830">automated AI product development framework</a>. Sometimes, it’s about identifying smaller issues that, when solved, can lead to significant improvements. For example, identifying the need for automated hyperparameter optimization or automating dataset export process are smaller but impactful problems.</p><h4>3. Clarifying Requirements and Architecting Systems</h4><p>Once the problem is clearly defined, the next step is to clarify the requirements needed to address it. In my opinion, this is the most challenging and important part of the process. This includes both functional requirements — what the system should do — and non-functional requirements, such as performance and scalability. Good research engineers should be able to handle complexity and clarify ambiguity, breaking down complex problems into clear, actionable requirements. Part of this process might involve modeling databases to define how data will be structured and managed, as well as drawing flow charts to visualize system interactions and workflows. It’s important to recognize that this process is often iterative; we can’t expect to get everything perfect from the start. That’s why we often use an agile approach, refining requirements and designs as we learn more and gather feedback.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SacB3mxdHSbjhkJw.jpg" /><figcaption>Typical workflow of ML pipeline (<a href="https://ml-ops.org/content/end-to-end-ml-workflow">source</a>)</figcaption></figure><p>Once the problems and requirements are defined, the next step is designing a system that can meet those requirements efficiently and at scale. Architecting system is important because it lays the foundation for how well the solution will perform, adapt, and scale over time. This requires a deep understanding of various trade-offs. While a full system design might not be necessary for implementing a small feature, there could still exist important design choices to make. The ability to navigate these decisions and make informed choices is what enables research engineers to build systems that are both robust and effective.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*B0wLRaeIXwMtQ6eF.png" /><figcaption>System architecture of <a href="https://medium.com/lunit/intelligent-cloud-part-2-a-deep-dive-into-the-architecture-and-technical-details-of-incl-b808b39f9f9f">a cloud-based training platform (INCL)</a> in our team</figcaption></figure><h4>4. Implementation and Operation</h4><p>Beyond design, research engineers should also excel in the implementation. This means not only writing code but doing so in a way that is both precise and efficient. It’s not enough to simply implement a solution; the code should also follow best practices to ensure it is readable, maintainable, and scalable. Unfortunately, I’ve seen many research engineers, particularly those coming from an AI-focused background, neglect these aspects, resulting in code that is difficult to manage and extend. Good research engineers understand the importance of writing clean, well-structured code that others can easily understand and maintain.</p><p>In addition to implementation, effective operation is important. This includes not only monitoring and maintaining systems to ensure they continue to perform optimally after deployment but also being adept at handling bugs and errors as they arise. Quickly identifying and resolving issues is important to minimizing downtime and maintaining system reliability.</p><h3>How to Be a Good Research Engineer</h3><p>Becoming a good research engineer is a continuous journey of learning, adapting, and refining skills. While the specific responsibilities and focus areas may vary depending on the team and project, there are common strategies that can help any research engineer excel in their role. There are many ways to improve, but in this section, I’ll share two key strategies for each topic that have been particularly useful in my own experience. I’m still learning and growing too, but these insights have helped me along the way, and I hope they can be beneficial to you as well.</p><h4>1. Improve Technical Knowledge</h4><ul><li><strong>Gain In-Depth Knowledge of Your Domain: </strong>It’s not enough to just know the basics; you need to dive deep into your domain. This means becoming familiar with the state-of-the-art methods, understanding best practices, and knowing the common challenges that arise in your field — and how to overcome them. Whether it’s mastering AI algorithms like hyperparameter optimization or understanding framework like Django, having deep knowledge helps you find the good solutions.</li><li><strong>Commit to Continuous Learning: </strong>Technology, especially in AI and software development, is always changing. To keep up, make continuous learning a regular part of your work. Regularly read papers in your field and keep track of industry trends. By constantly expanding your knowledge, you make sure your skills stay current and you can handle new challenges as they come up.</li></ul><h4>2. Improve Ability to Define Problems</h4><ul><li><strong>Develop a Holistic View: </strong>Understand the broader context of the organization and how different parts of the system or process interact. It’s crucial to see not just the immediate issues but also what is important and what will bring the most impact. By developing this holistic perspective, you can identify and define problems that are aligned with the organization’s goals and priorities, ensuring that your solutions contribute meaningfully to the bigger picture.</li><li><strong>Practice Active Observation: </strong>Pay close attention to the challenges and pain points within your team and organization. Actively observe and question existing workflows, identify bottlenecks, and consider how changes in one area might affect others. This process of active observation allows you to gain valuable insights into problems that need addressing, helping you to spot inefficiencies and areas for improvement that others might overlook.</li></ul><h4>3. Improve Ability to Clarify Requirements and Architect Systems</h4><ul><li><strong>Learn to Handle Complexity and Ambiguity:</strong> Focus on breaking down complex problems into smaller, more manageable parts. It’s important to prioritize what truly matters — some people tend to focus on less important details, overcomplicating things unnecessarily. Having an eye for what’s essential helps streamline decision-making and keeps projects on track. Additionally, the ability to abstract — seeing the bigger picture and simplifying complex systems without losing essential details — is important. Engage in discussions with stakeholders, ask the right questions, and ensure that everyone is aligned on what needs to be done.</li><li><strong>Invest Time in Learning System Design:</strong> Spend time learning about system design, which is crucial for building systems that can adapt and scale over time. System design often involves making important trade-offs, such as choosing between object storage or block storage, or deciding whether to add a caching layer to improve performance. These decisions require a deep understanding of how each choice impacts the system’s performance, scalability, and complexity. However, gaining experience with system design might not always be straightforward, especially in the early stages of your career. I recommend <a href="https://www.youtube.com/@ByteByteGo">ByteByteGo</a> or <a href="https://www.youtube.com/@jordanhasnolife5163">Jordan has no life</a>’s YouTube channel which can help you grasp some important concepts. Understanding these trade-offs and their impact on a system’s long-term success allows you to make informed decisions that lead to solid and effective designs.</li></ul><h4>4. Improve Implementation and Operation Skills</h4><ul><li><strong>Write Clean, Maintainable Code: </strong>It’s not enough to simply implement a solution; the code should also follow best practices to ensure it is readable, maintainable, and scalable. When working with a new framework, it can be challenging to know what the best practices are. One effective way to learn is by studying open-source projects. For example, if you’re new to Django, you can use GitHub search with topic:django stars:&gt;1000 to find popular projects that show good coding practices. This approach helps you understand how experienced developers structure their code and manage their projects, allowing you to adopt those practices in your own work.</li><li><strong>Enhance Troubleshooting Skills: </strong>Troubleshooting becomes difficult as systems grow more complex. To make this process easier, ensure that your code includes well-written logs that provide clear insights into what the system is doing at various stages. Additionally, using tools like <a href="https://sentry.io/welcome/">Sentry</a> can help you monitor and track errors in real-time. Finally, I’ve often seen cases where people rush into troubleshooting and make incorrect assumptions about where the bug is, which only complicates debugging further. It’s crucial to take a step back and think logically about whether your assumptions make sense.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*oEzaf2I5vU-JlBZ5.png" /><figcaption>A good research engineer needs a mix of many important skills (<a href="https://medium.com/@matthewmcateer/journey-to-ml-part-2-skills-of-a-marketable-machine-learning-engineer-dcff8b240e21">source</a>)</figcaption></figure><h3>Conclusion</h3><p>Becoming a good research engineer requires a broad range of knowledge, spanning everything from AI algorithms to software development and system design. Some might think that certain aspects I’ve discussed — such as defining problems or managing operations — fall more under the responsibilities of a product manager or operations team. While those roles do handle these areas, I believe it’s still crucial for research engineers to develop these attributes. Understanding these aspects allows research engineers to contribute more effectively to the entire lifecycle of a project, from concept to deployment, ensuring that the solutions they build are not only technically sound but also aligned with the broader goals of the organization.</p><p>One critical aspect I didn’t mention here is communication and collaboration. The reason I didn’t include it in this discussion is that communication is such a fundamental part of every role, not just research engineering. It underpins everything we do, from defining problems to implementing solutions, and it’s so essential that it deserves its own focused discussion. I believe communication is one of the most important skills a research engineer can develop. Being able to clearly convey complex ideas, collaborate effectively with others, and ensure that everyone is aligned on project goals is vital to success.</p><p>Becoming a great research engineer is a journey that requires continuous learning and growth. I’m still learning, and I hope that the insights shared here can help you on your path as well.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7dee98fc2dac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AutoSCOPE: The Assembly Line of AI Model Development at Lunit]]></title>
            <link>https://medium.com/lunit/autoscope-the-assembly-line-of-ai-model-development-at-lunit-0b1d1c05e830?source=rss-b5de61fddc69------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b1d1c05e830</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[automl]]></category>
            <category><![CDATA[framework]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[HyunJae Lee]]></dc:creator>
            <pubDate>Mon, 13 May 2024 04:41:51 GMT</pubDate>
            <atom:updated>2024-05-14T04:57:04.340Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is AutoSCOPE?</h3><p>Welcome to the future of AI model development, where building AI models is as systematic and efficient as Henry Ford’s pioneering assembly lines in the automotive industry. Just as Henry Ford’s assembly lines dramatically increased manufacturing efficiency, AutoSCOPE transforms AI model development within Lunit’s oncology department. It automates the complex and often repetitive tasks associated with developing AI models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qzZkoWx8wR02MqqqrEvxyQ.png" /><figcaption>Assembly line for building deep learning models (Drawn with <a href="https://openai.com/index/hello-gpt-4o/">GPT-4o</a>)</figcaption></figure><p>AutoSCOPE serves as an all-in-one deep AI development framework, guiding users through the entire lifecycle of AI model development — from managing datasets and training models to making predictions on whole slide images. Its user-friendly web interface simplifies the AI model development, enabling the development of a proof-of-concept model with just a few clicks. AutoSCOPE ensures that every step is clearly defined and integrated, making the process highly efficient and user-centric.</p><h3>Why Do We Need AutoSCOPE?</h3><p>In the fast-paced world of medical research and pharmaceuticals, the traditional method of developing AI models is slow and filled with complex steps. For example, our internal guide for each training and inferencing AI models involves nearly ten manual steps, which shows just how cumbersome the old way can be. Moreover, there is insufficient manpower among researchers to develop multiple models simultaneously. Additionally, the need for constant communication among various teams within the oncology department creates further delays and complications. This is where AutoSCOPE comes in, not just as a tool, but as a strategic asset designed to overcome these challenges.</p><ul><li><strong>Accelerated Development Cycle</strong>: AutoSCOPE streamlines the entire process, from data handling to whole slide image inference, significantly cutting down the time and steps involved.</li><li><strong>Exploring More Product Opportunities </strong>: AutoSCOPE provides the scalability needed to explore the more opportunities in oncology research, especially in collaboration with pharmaceutical companies. It simplifies technical processes, allowing our team to efficiently explore new products without being hindered by complexity.</li><li><strong>Improves Team Coordination</strong>: AutoSCOPE serves as a central hub for all development activities, which helps different teams work together more effectively. It reduces the need for constant meetings and updates, which can slow down progress.</li><li><strong>Allowing Domain Experts to Train Models</strong>: AutoSCOPE enables domain experts, including medical directors — who might lack AI expertise— to directly train AI models and integrate their domain knowledge. This capability ensures that the AI models developed are both accurate and clinically relevant, enhancing the effectiveness of diagnostic tools.Introduction to AutoSCOPE Workflow</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ezQgpBfxCoqj99B2.png" /><figcaption>Workflow in AutoSCOPE: Example scenario illustrating the step-by-step process. <a href="https://medium.com/lunit/intelligent-cloud-part-1-introduction-to-lunits-cloud-deep-learning-platform-for-efficient-94fd2da2a3f2">INCL</a> is Lunit’s cloud training platform and AICP is an internal annotation tool.</figcaption></figure><p>AutoSCOPE simplifies AI model development into clear, manageable steps. From the initial setup of projects to the final inference on whole slide images, it provides a structured workflow that guides users seamlessly through each part of the process. Let’s dive into each step to see how AutoSCOPE streamlines these complex tasks!</p><h4><strong>Creating a Project</strong></h4><p>In AutoSCOPE, a project acts as the foundational element for managing and organizing the AI model development process. Each project is associated with a specific product and organ, setting the focus for the research or application at hand. The project encapsulates all essential components, from datasets to inference models, and serves as a centralized hub for navigating and managing these elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ohh9jV_ueAxMs01W.png" /><figcaption>Creating a project in AutoSCOPE</figcaption></figure><h4><strong>Image Ingestion</strong></h4><p>At this stage, whole slide images (WSIs) along with their metadata are uploaded. This process is enhanced by features for searching, filtering, and sorting within the table, allowing users to efficiently locate and organize images based on specific criteria. Each image’s detailed page provides further information, including file paths and associated datasets, facilitating a comprehensive understanding of each image’s role in various projects. This streamlined approach supports effective management and use of image data essential for AI model development in oncology.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sS53PLuV6letrWKH_1jk0g.png" /><figcaption>Image management in AutoSCOPE: Efficient handling of WSIs and metadata for AI development</figcaption></figure><h4><strong>Dataset Ingestion</strong></h4><p>In AutoSCOPE, dataset ingestion involves organizing patches extracted from whole slide images (WSIs), annotated at various levels like cell, tissue, and organ, ready for model training. On the dataset detail page, users can view essential details. Visualization tools on this page allow users to view the actual patches and their annotations, enhancing the analysis process. Additionally, dataset statistics provide valuable insights into sample distributions, helping users understand data characteristics more deeply.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*GKJgRF3uHJqaxwjPeRwxNw.png" /><figcaption>Dataset Visualizer in AutoSCOPE: Viewing and analyzing annotated patches from WSIs</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h60A7pqKcp1XevqVu0Q3xQ.png" /><figcaption>Dataset Statistics in AutoSCOPE: Insights into sample distributions for informed model training</figcaption></figure><h4><strong>Running Experiments</strong></h4><p>AutoSCOPE automates the model tuning process using advanced AutoML algorithms. This step allows users to effortlessly train AI models while monitoring various performance metrics and visualizations.</p><ul><li><strong>Configuring the Experiment</strong>: To start a new experiment, users select the project and the dataset version on which the models will be trained. They also choose the type of model to train, such as a cell detection model. AutoSCOPE provides a pre-defined model architecture and learning procedures, where users only need to define the metrics for determining the optimal model. Users can enhance the starting point of the models by selecting a pretrained model from the Model Zoo, which can significantly improve performance and efficiency.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*c0fkcQxTpLTGQ32W.png" /><figcaption>Setting up an experiment: Only few clicks are needed for model training</figcaption></figure><ul><li><strong>Monitoring and Adjusting</strong>: Once the experiment is initiated, users can monitor its progress and status through the experiment management table. The detailed page for each experiment provides insights into the settings, status, and the outcomes of individual experiment jobs. Users can track the success of each job and analyze visual results to refine their models further.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lX2_Iw5xwHitKBjn.png" /><figcaption>Model monitoring: Tracking experiment progress and predictions</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*IAB_GVQi5qnE2tL9h0_Hjw.png" /><figcaption>Model Output Visualizer: Displaying and analyzing AI model results</figcaption></figure><ul><li><strong>Advanced Customization</strong>: For advanced users, AutoSCOPE allows detailed customizations of the experiment settings, including modifying the hyperparameter optimization settings, the use of custom loss functions and tweaking other experiment parameters through the advanced settings interface. These customizations can be applied to adapt the training process to specific research needs or experimental goals.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jcIoh9mBBkKD--sY.png" /><figcaption>Advanced Customization: Tailoring experiment settings to specific research needs</figcaption></figure><h4><strong>Model Archiving</strong></h4><p>After a model is trained, we conduct both metric comparisons and visual inspections to identify the most promising model. Once selected for its effectiveness, the model is archived using TorchServe, ensuring it is readily accessible for future inference tasks. To facilitate archiving, users simply choose the desired model from the experiment run. This process automatically captures all essential details, enhancing traceability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZhVPHPzj30D8p99k.png" /><figcaption>Model Archiving: Securing optimal models for future inference tasks</figcaption></figure><h4><strong>Making a Package</strong></h4><p>This step involves compiling a package that includes a set of model archives tailored for specific applications. These packages are designed to meet the diverse needs of the oncology department, allowing for flexible and targeted applications of the models developed. Each package’s details and history are accessible for review, and users can download the package or export it as a Docker image for deployment. This functionality facilitates the sharing of models, allowing them to be easily integrated and utilized in diverse operational environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iSATxIzkaIUzuF9H.png" /><figcaption>Creating a Package: Compiling and customizing model archives for targeted applications</figcaption></figure><h4><strong>WSI Inference</strong></h4><p>The final step involves using the packages to perform inference on WSIs, generating detailed visualizations to support further research and clinical decisions. This process involves two key components: a package containing trained models, and a list of valid WSIs specified as an inference context. Advanced settings can be adjusted to optimize resource use and inference speed, such as the number of parallel instances and memory requirements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ohQs-JTcKVrJ7PRi.png" /><figcaption>Running WSI Inference: Utilizing trained models for detailed analysis</figcaption></figure><p>Upon completion, users can access the inference results through links to raw output files or visual interfaces for detailed visualization, ensuring comprehensive review and analysis of the data processed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*NhBnkeOkpcQXS4ueMk052w.png" /><figcaption>WSI Visualizer: Displaying and analyzing AI model results</figcaption></figure><h3>How AutoSCOPE Simplifies Complex AI Development</h3><p>Building AI models involved a lot of manual work and constant back-and-forth between different teams, which could slow things down and make the process complicated. AutoSCOPE changes this by simplifying and speeding up how AI models are developed. If you’re wondering how this was possible, here’s a breakdown of challenges and solutions that enable it:</p><ol><li><strong>Developing a Robust Foundation</strong>: The effectiveness of AutoSCOPE starts with its core — advanced models and algorithms that have been refined over many years by many researchers at Lunit. Building this foundation required extensive expertise and persistent effort to ensure reliability and quality. These models provide a strong, consistent starting point, simplifying the initial steps of any project.</li><li><strong>Process Standardization</strong>: Simplifying the AI development process involves more than just automation; it requires carefully designing the system to hide unnecessary complexities while retaining essential functionalities. Standardizing these processes was a major challenge that involved understanding the fine details of various development tasks and figuring out which parts could be streamlined without losing effectiveness. This effort enables AutoSCOPE to automate many steps, reducing manual work and the need for continuous communication between teams.</li><li><strong>Advanced AutoML Algorithm</strong>: Integrating automated hyperparameter optimization into AutoSCOPE was another challenge. It adjusts the model’s parameters to ensure optimal performance. Developing a system that consistently matches or exceeds expert performance involved a lot of testing and refinement to ensure reliability across different scenarios.</li></ol><p>By tackling these complex challenges, AutoSCOPE offers a powerful tool that lets users concentrate on using AI effectively, without getting overwhelmed by the detailed steps of the development process.</p><h3>How AutoSCOPE Improved Model Development Process</h3><p>AutoSCOPE has significantly improved how AI models are developed, as shown by its use in recent projects. By automating and simplifying the development process, AutoSCOPE has proven its effectiveness in real-world scenarios:</p><p><strong>Efficient Development of New Products:</strong> Recently, AutoSCOPE was utilized in developing a new product. Traditionally, such development required manual coding and configuration, which not only extended the timeline but also increased the likelihood of errors. With AutoSCOPE, these steps were condensed into a few simple clicks.</p><p><strong>Reduced Unnecessary Communications</strong>: Originally, developing AI models involved multiple teams, which could slow down the process with back-and-forth communications. AutoSCOPE allows to run analyses and refine models without always needing to consult AI researchers. This reduction in unnecessary communications speeds up the overall workflow and makes the process more efficient.</p><p><strong>Validated Performance in Real-World Applications</strong>: AutoSCOPE has also been tested on existing products to ensure it works well in real-world products. The results were better or as good as the released models but were achieved much more efficiently. This proves that despite simplifying the development process, AutoSCOPE does not compromise on the quality or effectiveness of the models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*cinviolAgscG_CwZjeUQ0A.png" /><figcaption>Comparing Model Performance: AutoSCOPE vs. Released Models — AutoSCOPE shows superior performance in real-world applications</figcaption></figure><h3>What’s Next for AutoSCOPE?</h3><p>Looking ahead, our focus will be on enhancing AutoSCOPE’s capabilities through the development of a “closing the loop” system. This next phase is crucial as it incorporates active learning and label refinement to significantly improve the overall performance and accuracy of our models.</p><p><strong>Active Learning</strong>: This approach will concentrate our training efforts on the problematic data points where the AI currently struggles. By identifying and prioritizing these challenging areas, we can make our AI models more robust and capable of handling a wider variety of scenarios.</p><p><strong>Label Refinement</strong>: Annotating histology images is complex and prone to inaccuracies. Imperfect annotations can lead to a decrease in model performance because the training data may not accurately represent the true features of the images. By correcting and updating labels, we ensure our AI trains on accurate data which could significantly boost the accuracy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*V3D_4hX7j_tjzA1mqM_wbQ.png" /><figcaption>Illustration of the closing loop process: Green shows the current training scheme, blue highlights active learning on challenging data, and red indicates label refinement for improved accuracy</figcaption></figure><p>Enhancing data quality is fundamental to improving model performance. Given the extensive range of repetitive tasks involved in refining data and labels, manual handling is not only inefficient but also prone to errors. Automating this pipeline within AutoSCOPE will not only streamline these processes but also add substantial value to the development of scope models.</p><p>As we continue to refine and expand AutoSCOPE’s capabilities, we are excited about the future possibilities it holds. If you’re passionate about building and optimizing deep learning system and want to work on cutting-edge technology that’s making a big impact in the industry, consider joining Lunit’s team!</p><h3>Acknowledgements</h3><p>Many thanks to the developers <strong>Gihyeon Lee, Aaron Valero, Geonwoon Jang</strong>, and <strong>Keunhyung Chung</strong> for making AutoSCOPE possible. Also, thank you to the MCAI, DCAI, MPM, DM, BMRS, AIP, and PD teams for their helpful feedback in making our model development process better.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b1d1c05e830" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lunit/autoscope-the-assembly-line-of-ai-model-development-at-lunit-0b1d1c05e830">AutoSCOPE: The Assembly Line of AI Model Development at Lunit</a> was originally published in <a href="https://medium.com/lunit">Lunit Team Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bayesian Optimization Meets Self-Distillation]]></title>
            <link>https://medium.com/lunit/bayesian-optimization-meets-self-distillation-dcfd056cfe81?source=rss-b5de61fddc69------2</link>
            <guid isPermaLink="false">https://medium.com/p/dcfd056cfe81</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[bayesian-optimization]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[knowledge-distillation]]></category>
            <dc:creator><![CDATA[HyunJae Lee]]></dc:creator>
            <pubDate>Wed, 08 May 2024 01:39:19 GMT</pubDate>
            <atom:updated>2024-05-13T08:26:50.764Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>At Lunit, the accuracy of our models is very important because they are directly used in medical diagnostics and treatments that can save lives. The performance of deep learning models is highly sensitive to the selection of hyperparameters such as learning rate, weight decay, data augmentation, and resampling imbalanced data. However, manually tuning these hyperparameters is not only inefficient but often beyond human capability due to the high-dimensional nature of the problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*wWi5w-EQugMrJwpTYfa6eA.png" /><figcaption>Difficulty of tuning high-dimensional hyperparameter search space (Drawn with <a href="https://openai.com/dall-e-3">DALL-E</a>)</figcaption></figure><p>To overcome these challenges, we have utilized Bayesian optimization (BO), which iteratively suggests promising hyperparameters based on the performance outcomes of prior trials. However, BO tends to overlook a valuable asset: the knowledge within the model from previous trials. We realized that there was a significant opportunity to enhance this process. Inspired by recent advances in self-distillation (SD), which has shown that knowledge transfer from a previously trained model can improve performance, we decided to integrate SD into BO to fully leverage the knowledge obtained from previous trials.</p><p>We call this integrated framework Bayesian Optimization meets Self-diStillation (BOSS) and <a href="https://openaccess.thecvf.com/content/ICCV2023/papers/Lee_Bayesian_Optimization_Meets_Self-Distillation_ICCV_2023_paper.pdf">our paper has been accepted for presentation at ICCV 2023</a>. Following the BO process, BOSS suggests hyperparameter configurations based on observations that are most likely to improve performance. After that, it carefully selects pre-trained networks from previous trials for the next round of training with SD, which are otherwise abandoned in the conventional BO process. This process is performed in an iterative manner, allowing the network to persistently improve upon previous trials. Let’s explore in detail how the BOSS works and how it has significantly enhanced the capabilities of our models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*AHpaTgEgJ1PKYECQx4xTJQ.png" /><figcaption>Performance curves of various methods on CIFAR-100 with VGG-16 architecture. BOSS persistently improves upon previous trials by leveraging prior knowledge as a stepping stone to push the performance boundary.</figcaption></figure><h3>What is Bayesian Optimization?</h3><p><a href="https://distill.pub/2020/bayesian-optimization/">Bayesian Optimization</a> (BO) is a method used to optimize complex functions that are expensive to evaluate. It is effective for tuning hyperparameters in machine learning models, where each evaluation can be computationally intensive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/0*vC9-uqmR0Dw2hqby.gif" /><figcaption>An animation of Bayesian optimization (<a href="https://bella.cc/blog/bolfi/">source</a>)</figcaption></figure><h4>Key Elements of Bayesian Optimization</h4><ul><li><strong>Surrogate Model</strong>: BO uses a probabilistic model to approximate the objective function (e.g. accuracy). This model predicts the outcome based on the hyperparameters used.</li><li><strong>Acquisition Function</strong>: This function guides the selection of the next set of hyperparameters to evaluate by balancing exploration (testing new areas) and exploitation (focusing on promising areas).</li></ul><h4>How It Works</h4><ol><li>BO builds the surrogate model from initial random evaluations of the objective function.</li><li>It then enters a loop where the acquisition function selects the next hyperparameters to evaluate.</li><li>The objective function is evaluated, and the surrogate model is updated.</li><li>This process repeats, refining the hyperparameter choices each time to converge on the optimal solution.</li></ol><h3>Understanding Self-Distillation</h3><p><a href="https://proceedings.mlr.press/v80/furlanello18a/furlanello18a.pdf">Self-distillation</a> (SD) is a technique that enhances model performance by transferring knowledge from the teacher model to student model, typically within the same architecture. Recently, the effectiveness of SD has been theoretically explained by the <a href="https://openreview.net/forum?id=Uuf2q9TfXGA">“multi-view” hypothesis introduced by Allen-Zhu and Li</a>, who showed that SD performs an implicit ensemble of various models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/0*qReo-K_Zab71bOLb.jpeg" /><figcaption>Overview of Self-Distillation (<a href="https://towardsdatascience.com/knowledge-distillation-simplified-dd4973dbc764">source</a>)</figcaption></figure><h4>Key Concepts of Self-Distillation</h4><ul><li><strong>Teacher and Student Models</strong>: In self-distillation, the teacher is a model that has already been trained. The student model is the same architecture that learns from the teacher. The idea is that the student model can exceed the teacher’s performance by learning from its knowledge.</li><li><strong>Knowledge Transfer</strong>: This process involves the student model learning to replicate the behavior of the teacher model. By training the student to mimic the teacher’s output distributions, the student can learn deeper insights that are not obvious just from looking at the training data.</li></ul><h4>How It Works</h4><ol><li>The teacher model is first trained following the standard training procedure.</li><li>The student model is then trained not only to achieve good performance on the training data but also to mimic the output of the teacher model. This dual objective helps the student model capture the knowledge that the teacher model has learned.</li><li>Performing multiple rounds of SD could further improve the performance where the trained student is set to be a new teacher in the following round.</li></ol><h3>BOSS Framework</h3><p><a href="https://openaccess.thecvf.com/content/ICCV2023/papers/Lee_Bayesian_Optimization_Meets_Self-Distillation_ICCV_2023_paper.pdf">BOSS framework</a> introduces a novel approach for combining the hyperparameter optimization capabilities of Bayesian Optimization (BO) with the knowledge retention benefits of Self-Distillation (SD). This integration is not merely a simple combination but a strategic fusion that addresses specific challenges during model training.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XMhSn_xj47RtpNddBgONnA.png" /><figcaption>Overview of BOSS framework</figcaption></figure><h4>How It Works</h4><p>In order to perform SD, a teacher network is required to train a student network. However, the absence of any network in the beginning, poses a cold start problem. To address this issue, a warm-up phase is introduced which is similar to the regular BO process. Therefore, BOSS framework operates in two distinct phases:</p><p><strong>Phase 1: Warm-up</strong></p><ul><li>Objective: This phase aims to address the cold start problem by providing a set of initial models that will be utilized in the subsequent optimization phase.</li><li>Process: Models are trained with the standard Bayesian Optimization process to explore and evaluate different hyperparameter configurations.</li></ul><p><strong>Phase 2: BOSS Training</strong></p><ul><li>Objective: In this phase, BOSS leverages both the hyperparameter configurations suggested by BO and the models trained during the warm-up phase to aggregating knowledge from various models.</li><li>Process: BOSS randomly selects from the high-performing models and initialize the teacher and student networks. The student models are trained not only to perform well on the training data but also to emulate the outputs of their corresponding teacher models, effectively transferring the distilled knowledge.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*8HrilGsEwT8_ihe6a7ESmQ.png" /><figcaption>Detailed Algorithm for BOSS framework</figcaption></figure><h4>Strategic Initialization from Prior Knowledge</h4><p>A critical aspect of the BOSS framework’s effectiveness is its strategic approach to initializing both teacher and student models:</p><ol><li><strong>Dual Initialization</strong>: Both teacher and student models are initialized from the high-performing models of past trials to fully leverage the knowledge from various models.</li><li><strong>Diverse Origins</strong>: To maximize the exploitation of this prior knowledge, teacher and student models are initialized from different training trials. This diversity allows the student model to benefit from a broader spectrum of learned behaviors and insights, potentially leading to a improved performance.</li></ol><h3>Experiments</h3><p>To validate the effectiveness of the BOSS framework, a series of experiments were conducted across various tasks, including general image classification, learning with noisy labels, semi-supervised learning, and medical image analysis. These experiments were designed to test the framework’s performance against traditional Bayesian Optimization (BO), Self-Distillation (SD), Random search (Random), and standard training methods.</p><h4>General Image Classification</h4><p>The BOSS framework exhibits considerably higher accuracy than other methods across all tested datasets. While random search succeeds to improve the performance of the baseline, BO further boosts the performance by adaptively suggesting probable configurations. SD also achieves enhanced performance compared to the baseline as expected. However, the effectiveness of SD and BO varies across datasets. On the other hand, BOSS consistently improves the performance by a large margin, leveraging the advantages of both methods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*cS5UgrTzVr-v7bjXtZkRZg.png" /><figcaption>Top-1 accuracy (%) on CIFAR10/100 and Tiny-ImageNet with VGG-16. The reported results are the average and the 95% confidence interval over 5 repetitions.</figcaption></figure><h4>Learning with Noisy Labels</h4><p>BOSS demonstrated superior resilience to label noise compared to the other methods. Its ability to transfer clean and robust features from teacher to student models helped mitigate the impact of erroneous labels, resulting in higher accuracy. This is particularly important in our context because the ground truth of medical data is often noisy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*Whafduc2kqUgPxlffQl8RA.png" /><figcaption>Comparison with Different Noise Rates on CIFAR-100</figcaption></figure><h4>Semi-Supervised Learning</h4><p>In scenarios with limited labeled data, BOSS leveraged both labeled and unlabeled data more effectively than other methods. It is worth noting that the baseline is one of the state-of-the-art SSL method trained with carefully tuned hyperparameters, advanced regularization techniques, and long training iterations. By distilling knowledge through iterations, BOSS could utilize unlabeled data to enhance the learning process, showing significant improvements. This aspect is crucial because annotating medical data is expensive, and there exists a large amount of unlabeled data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*hexW6InAa_a1cVDpHosArg.png" /><figcaption>Top-1 accuracy (%) of semi-supervised learning on CIFAR-100 with varying numbers of labeled data.</figcaption></figure><h3>How Automated Hyperparameter Optimization Improved Our Models at Lunit</h3><p>At Lunit, there exists a <a href="https://medium.com/p/94fd2da2a3f2">deep learning training platform called INtelligent CLoud (INCL)</a>. BOSS framework is integrated into INCL platform along with other improvement on existing hyperparameter optimization (HPO) algorithm. This setup allows for straightforward execution of automated HPO, leading to a substantial improvement in how we develop AI models.</p><p>Previously, each product at Lunit required extensive manual tuning, which was time-consuming and often yielded suboptimal results. By automating this process through our advanced HPO system, we have not only freed up valuable research time but also consistently achieved a better performance.</p><p>The automatic HPO on INCL has been thoroughly validated across a wide range of internal products. These include diagnostic imaging such as chest x-rays and mammography as well as tissue segmentation and cell detection from histology images. Each of these areas presents unique challenges. However, our HPO consistently improved performance across all tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*PZTiF-CarlCUTnFGWDSYzg.png" /><figcaption>AUC Scores for Chest X-Ray: HPO demonstrates superior or comparable performance across various datasets</figcaption></figure><p>In addition to improving performance on validation datasets, our automatic HPO has also demonstrated enhanced effectiveness on test sets. This indicates that the models are not merely overfitting to the validation data but genuinely learning to generalize better from the training data. Improved test set performance indicates practical utility of our models in real-world scenarios, ensuring that our products remain reliable and effective when deployed in clinical settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*bmGNWZbiS7juChmFssz_vQ.png" /><figcaption>AUC Scores for 3D mammography: Automatic HPO boosts performance on test sets, ensuring reliable and effective real-world application in clinical settings</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*YrssZW5fhrTimdzaMi5E8A.png" /><figcaption>mF1 and mIoU Scores for Cell Detection and Tissue Segmentation from Histology Images</figcaption></figure><h3>Conclusion</h3><p>In this blog post, we presented the <a href="https://openaccess.thecvf.com/content/ICCV2023/papers/Lee_Bayesian_Optimization_Meets_Self-Distillation_ICCV_2023_paper.pdf">BOSS framework</a>, which synergistically combines Bayesian Optimization and Self-Distillation, allowing for more efficient hyperparameter tuning and enhanced knowledge retention. Our comprehensive testing across various tasks has consistently shown that BOSS achieves significant performance improvements, consistently outperforming standard BO or SD when used alone. The BOSS framework is integrated into our <a href="https://medium.com/p/94fd2da2a3f2">Intelligent Cloud (INCL) platform</a>, facilitating easy-to-use automated hyperparameter optimization. This integration reduces the time and expertise required for manual tuning while achieving superior model performance. <a href="https://github.com/sooperset/boss">We have made our code available at Github as well</a>!</p><p>There are still many areas where we could improve deep learning process in Lunit. If you’re passionate about building and optimizing deep learning system and want to work on cutting-edge technology that’s making a big impact in the industry, consider joining Lunit’s team!</p><h3>Acknowledgements</h3><p>Many thanks to <strong>Heon Song, Hyeonsoo Lee, Gi-hyeon Lee, Suyeong Park</strong> and <strong>Donggeun Yoo</strong> for making the research possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dcfd056cfe81" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lunit/bayesian-optimization-meets-self-distillation-dcfd056cfe81">Bayesian Optimization Meets Self-Distillation</a> was originally published in <a href="https://medium.com/lunit">Lunit Team Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intelligent Cloud — Part 3: Optimizing GPU Costs by Leveraging Spot Instances]]></title>
            <link>https://medium.com/lunit/optimizing-gpu-costs-by-leveraging-spot-instances-189e5dfc17ee?source=rss-b5de61fddc69------2</link>
            <guid isPermaLink="false">https://medium.com/p/189e5dfc17ee</guid>
            <category><![CDATA[deep-learning-framework]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[HyunJae Lee]]></dc:creator>
            <pubDate>Tue, 13 Feb 2024 06:08:09 GMT</pubDate>
            <atom:updated>2024-05-13T04:47:23.169Z</atom:updated>
            <content:encoded><![CDATA[<h3>Intelligent Cloud — Part 3: Optimizing GPU Costs by Leveraging Spot Instances</h3><h3>Introduction</h3><p>In our previous blog posts, we explored the <a href="https://medium.com/lunit/intelligent-cloud-part-1-introduction-to-lunits-cloud-deep-learning-platform-for-efficient-94fd2da2a3f2">enhancements brought by INCL to our research processes</a> and <a href="https://medium.com/lunit/intelligent-cloud-part-2-a-deep-dive-into-the-architecture-and-technical-details-of-incl-b808b39f9f9f">delved into its detailed architecture</a>. In this post, we’re shifting our focus to an another critical aspect: how INCL optimizes GPU costs by leveraging spot instances.</p><p>Following INCL’s deployment, we experienced a substantial increase in model training. While this increase demonstrates INCL’s efficiency and user-friendliness, it also highlights a significant challenge: the high cost associated with GPU-powered training. The cost of model training exceeded our expectations, necessitating a reduction in expenses. Therefore, managing these costs became crucial for sustainable AI research and development at Lunit.</p><p>Today, we will delve deeper into how our Intelligent Cloud (INCL) platform achieves significant cost reductions by effectively utilizing spot instances, which offer the same computational power as on-demand instances but at a fraction of the cost. However, the inherent instability of spot instances poses unique challenges, notably their potential for frequent preemptions and unpredictability. This post will explore what spot instances are, the challenges they present, and how INCL handles it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RD6nkR1L0bv1V-VH" /><figcaption>High cost of training deep learning models on GPUs (Drawn with <a href="https://openai.com/dall-e-3">DALL-E</a>)</figcaption></figure><h3>What is a spot instance?</h3><p>In the world of cloud computing, <a href="https://cloud.google.com/compute/docs/instances/spot">spot instances</a> are essentially unused compute capacity in cloud data centers that are available for a significantly lower price compared to standard on-demand instances. The cost benefits are substantial, with spot instances being 60–91% cheaper compared to the on-demand instances. Creating a spot instance is quite simple as well. <a href="https://cloud.google.com/compute/docs/instances/create-use-spot#create">In case of GCP</a>, all you need to do is to provide a “<em>provisioning-model=SPOT</em>” flag as below.</p><pre>gcloud compute instances create {YOUR_VM_NAME} \<br>    --machine-type={YOUR_MACHINE_TYPE} \<br>    --provisioning-model=SPOT</pre><p>The trade-off, however, is their lack of guaranteed availability. Unlike traditional on-demand instances that offer stability and continual availability, spot instances can be terminated by the cloud provider at any time when the demand for computing resources spikes. This uncertainty is a critical factor to consider when integrating spot instances into any workflow. For applications where consistent uptime and reliability are crucial, spot instances may not be ideal.</p><p>Despite this inherent instability, spot instances present an appealing opportunity for deep learning projects. These projects often have processes that can be paused and resumed without detriment to overall progress. While theoretically feasible, seamlessly resuming training after a spot instance is preempted is a complex task. This challenge is precisely where INCL steps in, offering an efficient solution to harness the full potential of spot instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*AZmCT-zbSJ47ksK9JM3mzg.png" /><figcaption>GPU pricing in Google Cloud Platform (<a href="https://cloud.google.com/compute/gpus-pricing">link</a>). Spot price is at least 60% cheaper than on-demand price.</figcaption></figure><h3>How INCL utilizes spot instance for training</h3><p>One of the standout features of INCL is its ability to automatically resume training when a spot instance is preempted. This functionality addresses a significant challenge in using spot instances for deep learning. Without a system like INCL, restarting the process would require manual intervention, increasing both the human workload and the time required to train models.</p><p>Here’s an in-depth look at how INCL manages preempted spot instances and resumes training efficiently:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FlLMbFeiKi3yUteMvuUNcg.png" /><figcaption>Automated training resumption in INCL after a spot instance preemption</figcaption></figure><ol><li><strong>Preemption Initiation by Cloud Provider<br></strong>When the demand for computing resources exceeds a certain threshold, cloud providers may initiate preemption of a spot instance.</li><li><strong>Spot Instance Preemption Reporting<br></strong>The job instance detects and reports its preemption. This is achieved using a <a href="https://cloud.google.com/compute/docs/shutdownscript">shutdown script</a> that is activated just before the instance stops. Since a shutdown script is also executed during normal termination when a job is finished, it is crucial to differentiate between preemption and standard shutdowns. This distinction is essential to determine whether a job should be resumed. Here’s an example script that accomplishes this:</li></ol><pre>#!/bin/bash<br>google_metadata_url=&#39;http://metadata.google.internal/computeMetadata&#39;<br>incl_server_url=&#39;http://www.my_api_server_url.com&#39;<br>instance_name=&#39;my_instance&#39;</pre><pre># Check if instance has been preempted<br>preempted=`curl $google_metadata_url/v1/instance/preempted -H &quot;Metadata-Flavor: Google&quot;`</pre><pre># Report preemption to the INCL API server<br>curl -X POST {incl_server_url}/instance-operations/{instance_name}/shutdown/ -d &quot;preempted=$preempted&quot;</pre><pre># You can add custom logics here e.g. sending SIGINT signal to the training process to save checkpoint</pre><p>3&amp;4.<strong> Instance Type Selection for Resumption.<br></strong>The Instance Selector is triggered by requests from the API server to choose the type of instance for resuming training. This selection can be either a spot or an on-demand instance. While retrying with another spot instance is a common recommendation in the <a href="https://cloud.google.com/compute/docs/instances/create-use-spot#best-practices">official documentation</a>, our empirical data suggests that this can sometimes lead to infinite preemption loop. Therefore, careful selection of the instance type is crucial.</p><p>5&amp;6. <strong>Provisioning and Resuming the Job on the New Instance<br></strong>INCL provisions a new instance of the selected type and resumes the job. Importantly, the disk used in the previously preempted spot instance is not discarded but reused. This reuse strategy eliminates the need to synchronize the checkpoint. The strategy is facilitated by initially setting the “<a href="https://cloud.google.com/sdk/gcloud/reference/compute/instances/create#--boot-disk-auto-delete"><em>no-boot-disk-auto-delete</em></a>” option and specifying “<a href="https://cloud.google.com/sdk/gcloud/reference/compute/instances/create#--disk"><em>disk boot=yes,mode=rw,name={disk_name}</em></a>” during the resumption process. It’s important to note that this disk should be manually deleted once the job is successfully completed, which INCL handles automatically.</p><p>Through this refined approach, INCL effectively leverages spot instances for deep learning, ensuring minimal disruption and optimal cost-efficiency in AI model training.</p><h3>Challenges when leveraging spot instances</h3><p>Optimizing deep learning training with spot instances offers a cost-effective strategy, but it also introduces distinct challenges that require careful management. The primary challenges include avoiding an infinite preemption loop with spot instances, and effectively handling multi-node training in a distributed learning framework. Let’s examine each of these challenges and explore how INCL addresses them.</p><h4>Preventing infinite preemption loop</h4><p>To optimize training costs effectively, it’s crucial to maximize spot instance utilization while preventing the infinite preemption loop. INCL runs all the jobs in the spot instance by default unless specifically requested by user to run on on-demand instance for time-critical experiments. Given the high demand for GPUs at Lunit, where INCL sometimes engages over a thousand GPUs simultaneously, burst usage scenarios frequently lead to numerous preemptions.</p><p>When a spot instance is preempted, a crucial decision needs to be made by INCL: should the job resume on another spot instance or switch to an on-demand instance? According to the <a href="https://cloud.google.com/compute/docs/instances/create-use-spot#best-practices">official documentation</a>, it is recommended to attempt to resume the job on another spot instance. This approach typically works well in low-demand situations, facilitating a seamless transition and successful continuation of training with minimal disruption.</p><p>However, this approach becomes less effective during high-demand periods for spot instances. We have observed that each attempt to initiate a new instance often leads to a chain of continuous preemptions. Not only does this increase the likelihood of subsequent preemptions, but the time required for ‘context switching’ — typically over 10 minutes to set up each new instance — causes significant training interruptions. Such a continuous loop can trap the training process in an endless cycle of starts and stops.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i0X3pLLVSgEu1kXWwNDLVQ.png" /><figcaption>The cycle of continuous preemptions in high-demand periods</figcaption></figure><p>Therefore, deciding whether to resume on a spot or an on-demand instance after preemption requires careful consideration. A significant challenge in this decision-making process is the unpredictability of preemption rates, as this information is not typically provided by cloud providers. INCL addresses this challenge by leveraging empirical data on preemption patterns to establish a policy. Based on this policy, the instance selector decides the optimal moments to switch to on-demand instances. Although more expensive, on-demand instances offer greater stability and predictability, making them a preferable choice in scenarios with a high likelihood of preemption.</p><p>It is important to note that the policy for instance selection should not be static, but rather should evolve over time. This adaptability is crucial, as preemption patterns can vary, requiring modifications to our instance selection strategy. By continuously updating this approach, INCL aims to strike a balance between cost-efficiency and the reliability of training processes, dynamically adapting to changes in the cloud computing environment.</p><h4>Resuming multi-node training in a distributed learning setting</h4><p>Multi-node distributed learning is an effective method for accelerating deep learning model training, particularly beneficial for large datasets or complex models. By distributing the computational workload across multiple nodes, this approach significantly enhances training efficiency. While INCL supports this process efficiently, challenges arise when preemptions occur, affecting either the master node or the child nodes.</p><p>In a distributed learning setup, the master node is critical for coordinating the training process, as its address is key to maintaining connectivity with the child nodes. If the master node gets preempted and requires replacement, all child nodes must pause until a new master node is established and assigned a new address. Once the child nodes are updated with this new address, the entire training process across all nodes needs to be restarted. Similarly, if a child node is preempted, it must be promptly replaced, necessitating a restart of the training process on all nodes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*oiuidiL7rrvKPhhP6lFv5w.png" /><figcaption>Handling master node preemptions in distributed learning</figcaption></figure><p>To efficiently handle these scenarios, INCL is designed to automatically address such disruptions. Upon detecting a preemption, whether of the master or a child node, INCL swiftly provisions new instances and reinstates the DDP training setup. For master node preemption, it quickly establishes a new master node and updates the child nodes with the new address. In cases where multiple nodes are preempted, INCL coordinates the restoration of all affected nodes. This process may involve determining the order in which nodes are restored and ensuring their synchronization once back online. This not only reduces downtime but also helps maintain the continuity of the training process.</p><h3>Conclusion</h3><p>In summary, this blog post has delved into the use of spot instances particularly within the context of deep learning training in INCL. We’ve discussed the cost-effectiveness of spot instances, their inherent challenges, and INCL’s approach to managing these challenges. We’ve explored how INCL navigates spot instance preemptions and maximizes their use, balancing cost-efficiency with consistent training reliability. Key topics included the strategic decision-making between using spot or on-demand instances, guided by INCL’s use of empirical data, and the challenges of resuming multi-node training in distributed learning setups. There are still many areas where we could improve deep learning process in Lunit. If you’re passionate about building and optimizing deep learning system and want to work on cutting-edge technology that’s making a big impact in the industry, consider joining Lunit’s team!</p><p>Explore the full spectrum of our Intelligent Cloud (INCL) series. You can easily navigate through the entire series here:</p><ul><li><a href="https://medium.com/lunit/intelligent-cloud-part-1-introduction-to-lunits-cloud-deep-learning-platform-for-efficient-94fd2da2a3f2">Intelligent Cloud — Part 1: Introduction to Lunit’s Cloud Deep Learning Platform for Efficient Model Training</a></li><li><a href="https://medium.com/lunit/intelligent-cloud-part-2-a-deep-dive-into-the-architecture-and-technical-details-of-incl-b808b39f9f9f">Intelligent Cloud — Part 2: A Deep Dive into the Architecture and Technical Details of INCL</a></li><li><a href="https://medium.com/@hyunjae.lee410/optimizing-gpu-costs-by-leveraging-spot-instances-189e5dfc17ee">Intelligent Cloud — Part 3: Optimizing GPU Costs by Leveraging Spot Instances</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=189e5dfc17ee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lunit/optimizing-gpu-costs-by-leveraging-spot-instances-189e5dfc17ee">Intelligent Cloud — Part 3: Optimizing GPU Costs by Leveraging Spot Instances</a> was originally published in <a href="https://medium.com/lunit">Lunit Team Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intelligent Cloud — Part 2: A Deep Dive into the Architecture and Technical Details of INCL]]></title>
            <link>https://medium.com/lunit/intelligent-cloud-part-2-a-deep-dive-into-the-architecture-and-technical-details-of-incl-b808b39f9f9f?source=rss-b5de61fddc69------2</link>
            <guid isPermaLink="false">https://medium.com/p/b808b39f9f9f</guid>
            <category><![CDATA[research]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[HyunJae Lee]]></dc:creator>
            <pubDate>Sun, 02 Apr 2023 05:13:35 GMT</pubDate>
            <atom:updated>2024-02-13T06:09:09.629Z</atom:updated>
            <content:encoded><![CDATA[<h3>Intelligent Cloud — Part 2: A Deep Dive into the Architecture and Technical Details of INCL</h3><h3>Introduction</h3><p>In our previous <a href="https://medium.com/@hyunjae.lee410/intelligent-cloud-part-1-introduction-to-lunits-cloud-deep-learning-platform-for-efficient-94fd2da2a3f2">blog post</a>, we discussed how INCL has enhanced our research capabilities. In this post, we’ll dive into the architecture of INCL and explain how it works.</p><p>INCL has been designed with several key components to ensure scalability, high performance, and a user-friendly experience. It provides a distributed and fault-tolerant training environment that can handle large number of experiments at the same time. Moreover, INCL automates nuisance tasks with minimal code modification and configuration required. Our focus is to provide a flexible, efficient, and user-friendly platform for deep learning research on the cloud. In the following sections, we will explore the technical details of each component and how they work together to provide a seamless and scalable deep learning training environment.</p><h3>Workflow of Running an Experiment in INCL</h3><p>INCL consists of three main components: INCL client, INCL backend, and job instance. INCL client communicates with INCL backend to run, manage and track experiments, while the backend handles requests from clients and manages the resources needed to run experiments. Each experiment runs on a job instance, which is a virtual machine provisioned by the backend.</p><p>Note that the term “experiment” is used interchangeably with “job” throughout this post. It’s worth noting that a job in INCL is not limited to training a model; it can also include running an inference for a trained model or any other script that can be run on an on-premise machine. This kind of feature enhances the flexibility of INCL and allows researchers to easily adapt the platform to their specific needs.</p><p>Before diving into the technical details of INCL’s architecture, it’s important to understand the workflow of running an experiment. This high-level overview provides an insight into the underlying architecture and how the different components work together to provide a seamless and scalable environment. A general workflow of running an experiment in INCL is as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fOhn4MxZp-AiPGIEdqgniw.png" /><figcaption>A general workflow of running an experiment in INCL</figcaption></figure><ol><li><strong>The client requests a job run to the INCL backend</strong>. An user requests a job run, specifying the script and the required resources.</li><li><strong>Experiment code is uploaded to object storage. </strong>Code in the working directory is synced to object storage to be run on the cloud.</li><li><strong>The backend provisions a virtual machine and sets up the environment. </strong>Based on the resource requirements specified in the job request, the backend provisions a job instance and sets up the environment by installing the required software packages and dependencies.</li><li><strong>The job instance downloads the experiment code from the object storage. </strong>Once the job instance is ready, it syncs the experiment code from the object storage to block storage which is high-performance storage.</li><li><strong>The model is trained on the job instance. </strong>With the experiment code and input data in place, the job instance starts training the deep learning model. The training and validation data is stored in file storage storage which is mounted to the job instance as a network file system.</li><li><strong>After the training is finished, experiment results are synced to object storage. </strong>Once the training is completed, the output data (such as trained model checkpoints) are uploaded to the object storage for further analysis or deployment.</li><li><strong>The job instance reports termination to the backend.</strong> Finally, the virtual machine reports back to the backend that the job has completed, and the backend deallocates the resources and schedule a new job.</li></ol><p>The components of INCL work together seamlessly to create an efficient and effective cloud-based training environment. In the next section, we’ll examine each component in detail and explore how they interact with each other to provide a comprehensive view of INCL’s architecture.</p><h3>Key components of the INCL architecture</h3><p><strong>INCL Client<br></strong>INCL client is the interface that users interact with to run, monitor, and track their experiments. It provides two interfaces: a command-line interface (CLI) and a web user interface (UI). The CLI is built using Click, a Python package for creating command-line interfaces. It allows users to easily interact with the INCL backend from the command line, such as submitting jobs, checking job status, and retrieving results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*uPt8GLTiigH4AlmdEy28PA.png" /><figcaption>Example command-line interface (CLI) usage in INCL</figcaption></figure><p>On the other hand, the web UI is built using React, MobX, and Material UI, which provide a modern and intuitive graphical user interface. Users can access the INCL web UI through a web browser and monitor, track and manage their jobs in real-time through rich visualizations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*s0bLgv4zUz1bMvmxPnj8uQ.png" /><figcaption>Analyzing experiments through rich visualizations in INCL web UI</figcaption></figure><p>Having both a CLI and a web UI in INCL offers users flexibility in how they interact with the platform. The web UI provides a user-friendly interface for visualizing training progress and results through metric graphs, allowing users to easily monitor their experiments. On the other hand, the CLI provides a command line interface that can be used for scripting and automation, allowing users to handle INCL on a terminal and easily integrate it into their existing workflows. This combination of a web UI and a CLI allows users to choose the most convenient way to interact with INCL based on their specific use case and preferences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*S2TEWqXOzyePONDXmrDyxw.png" /><figcaption>Interaction between INCL client and backend</figcaption></figure><p>The communication between the INCL client and backend is facilitated through a set of RESTful APIs exposed by the API and logging server. The API server is responsible for handling requests from the client, which includes job submission, status queries, and model registry. This server is connected to an object storage system that handles the storage of code and models, and a relational database that stores various metadata. On the other hand, logging server is responsible for handling log and metric data in real-time. It is connected to a NoSQL database that stores logs and metrics generated during the course of the experiment. In the following section, we will delve into the specific components of the INCL backend and their respective functionalities.</p><p><strong>INCL Backend</strong></p><p>The INCL backend, which runs on the Kubernetes cluster, serves as the backbone of the platform, responsible for managing and executing the various tasks associated with deep learning experiments. It is comprised of several key components, such as the API server, scheduler, job runner, and logging server, that work together seamlessly to provide an efficient and effective training environment.</p><p><strong>API server</strong> is responsible for handling requests from the client, which includes job submission, status queries, and model registry. The API server is built on top of a Django REST framework and is connected to an object storage system that handles the storage of code and models, and a relational database that stores various metadata. It is responsible for tasks such as authenticating and authorizing users, serving model artifacts for jobs, storing and retrieving job metadata, handling status queries from the client, and serving APIs for the client.</p><p><strong>Scheduler </strong>is responsible for managing the job queue to ensure that jobs are run in the correct order. In addition, it manages both global and user resource quotas to distribute resources fairly and prevent monopolization. The scheduler also determines whether to run a job on an on-demand or spot instance based on resource usage and preemption patterns. Maximizing the utilization of spot instances can lead to significant budget savings, which we’ll discuss in more detail in an upcoming blog post.</p><p><strong>Job runner</strong> is responsible for executing the job on a virtual machine and ensuring that it runs smoothly to produce the expected results. It uses Celery worker to execute tasks asynchronously and handle a large number of jobs efficiently. Job runner is designed to be highly scalable and fault-tolerant. It performs various tasks, including provisioning a virtual machine, copying code and model artifacts, installing dependencies, and setting up the environment. Additionally, it monitors the progress of the job and handles any errors that may occur during execution to ensure the job completes successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F6o6HomhnUoXMB7xng3orw.png" /><figcaption>Interaction between API server, scheduler, job runner and job instance</figcaption></figure><p>The API server, scheduler, and job runner interact in a tightly integrated system for managing jobs. When a user initiates a new job, the API server adds the job to the job queue. Scheduler selects jobs from the queue based on resource usage and quotas, and sends the selected job to job runner, which runs the job on a job instance. After the job is finished, the job instance reports its termination to the job runner, which requests to schedule a new job since allocated resources have been freed. If a client requests to stop a running job, the API server directly requests the job runner to stop the job. The job runner gracefully requests to stop the job to the job instance and syncs the results. Throughout the job execution, the backend manages the job’s lifecycle and informs the user of any status changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jxicJngox4raQ3TKf1i2pQ.png" /><figcaption>A lifecycle of an INCL experiment</figcaption></figure><p><strong>Logging server</strong> is responsible for handling log and metric data in real-time. Training a deep learning model can include heavy metric write requests, with one model potentially requiring multiple metric writes per second. Given that our application could have near a hundred of jobs running simultaneously, this could result in several hundreds to thousands write requests per second. To handle this large amount of log writes, we developed a designated logging server with Gin. By using a lightweight and highly efficient framework like Gin, we were able to create a logging server that is optimized for high concurrency and low latency, allowing it to handle large volumes of logs and metrics with ease. Job instances write logs and metrics to the logging server during experiments in real-time, which can then be easily accessed by users to track and analyze their models. By offloading the task of logging from the main API server developed with Django, we were able to improve the performance, scalability, and maintainability of our application.</p><p><strong>Job Instance<br></strong>A job instance is a virtual machine that runs the job that the user has requested. It includes a job executor, the INCL Python SDK, a metric collector, and a log collector. A job executor runs the job in a Docker image that the user has specified. INCL Python SDK can be used within the job instance to log configuration details, experiment metrics, and model artifacts. With a few lines of code, it allows user to easily analyze and reproduce experiments in the future. For example:</p><pre>import incl<br><br>config = {<br>    &#39;dataset&#39;: &#39;cifar10&#39;,<br>    &#39;hyperparamter&#39;: {<br>        &#39;lr&#39;: 0.001,<br>        &#39;epochs&#39;: 20,<br>    },<br>}<br>incl.config.init(config)<br><br>for epoch in range(incl.config[&#39;hyperparamter&#39;][&#39;epochs&#39;]):<br>    for iter, data in enumerate(trainloader):<br>        loss = train(data)<br>        if (iter + 1) % 1000 == 0:<br>            incl.log({ &#39;train/loss&#39;: loss })</pre><p>The log collector plays an important role in providing users with visibility into the job&#39;s progress. It collects the output of the job executor, including any error messages or other diagnostic information generated by the job. This allows the user to quickly track progress and troubleshoot any issues that may have occurred during the job&#39;s execution. Meanwhile, the metric collector collects system-level performance data, such as CPU and GPU utilization. If the average GPU utilization falls below a specified threshold, the job instance is automatically requested to terminate by the backend. This prevents the instance from continuously running when the job hangs due to unexpected issues.</p><h3>Choosing the Proper Storage</h3><p>Choosing the proper storage for each situation was an important consideration when designing the INCL architecture. There are three types of storage available: object storage, block storage, and file storage. Each type of storage has its own advantages and disadvantages, and it is important to understand the performance-cost trade-offs associated with each type of storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*39b-WnUsdCkArmlo.jpeg" /><figcaption>Image source : <a href="https://cloud.google.com/blog/topics/developers-practitioners/map-storage-options-google-cloud?hl=en">Google Cloud</a></figcaption></figure><p>Object storage is slow but cheap and is therefore well-suited for storing code and model artifacts that need to be saved in the long-term. When a job is running, the job instance utilizes block storage, which is faster but more expensive. After the training is finished, the job results, such as the checkpoint, are synced from block storage back to object storage, and the block storage is then deleted. Block storage is used during training to ensure high storage performance so that it does not become the bottleneck of performance. However, it is deleted after training is done for cost efficiency.</p><p>While block storage has good performance, it has a limit on the number of multiple readers and writers that can access the storage simultaneously. This could limit the scalability of the system. File storage, on the other hand, is more expensive but allows multiple readers and writers to access the storage simultaneously. It is used for storing all the training data and is mounted to the job instance as a network file system. We allow users to manage their training and validation data in file storage via the INCL client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ouyCiE2l0Q0UTsthYBw1BQ.png" /><figcaption>Various storages used in INCL architecture</figcaption></figure><p>Choosing the appropriate storage for each situation is important to ensure that the system operates efficiently and cost-effectively. INCL is carefully designed with the choice of storage with respect to the trade-off between performance and cost.</p><h3>Conclusion</h3><p>In conclusion, building a cloud-based deep learning platform is a complex task that requires careful consideration of various technical details and design choices. INCL has been designed with scalability, performance, and ease of use in mind. By addressing key technical challenges and providing a robust and scalable platform, INCL enables users to focus on their deep learning research and development without having to worry about the underlying infrastructure. There are still many areas where we could improve deep learning process in Lunit. If you’re passionate about building and optimizing deep learning system and want to work on cutting-edge technology that’s making a big impact in the industry, consider joining Lunit’s team!</p><p>Explore the full spectrum of our Intelligent Cloud (INCL) series. You can easily navigate through the entire series here:</p><ul><li><a href="https://medium.com/lunit/intelligent-cloud-part-1-introduction-to-lunits-cloud-deep-learning-platform-for-efficient-94fd2da2a3f2">Intelligent Cloud — Part 1: Introduction to Lunit’s Cloud Deep Learning Platform for Efficient Model Training</a></li><li><a href="https://medium.com/lunit/intelligent-cloud-part-2-a-deep-dive-into-the-architecture-and-technical-details-of-incl-b808b39f9f9f">Intelligent Cloud — Part 2: A Deep Dive into the Architecture and Technical Details of INCL</a></li><li><a href="https://medium.com/@hyunjae.lee410/optimizing-gpu-costs-by-leveraging-spot-instances-189e5dfc17ee">Intelligent Cloud — Part 3: Optimizing GPU Costs by Leveraging Spot Instances</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b808b39f9f9f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lunit/intelligent-cloud-part-2-a-deep-dive-into-the-architecture-and-technical-details-of-incl-b808b39f9f9f">Intelligent Cloud — Part 2: A Deep Dive into the Architecture and Technical Details of INCL</a> was originally published in <a href="https://medium.com/lunit">Lunit Team Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intelligent Cloud — Part 1: Introduction to Lunit’s Cloud Deep Learning Platform]]></title>
            <link>https://medium.com/lunit/intelligent-cloud-part-1-introduction-to-lunits-cloud-deep-learning-platform-for-efficient-94fd2da2a3f2?source=rss-b5de61fddc69------2</link>
            <guid isPermaLink="false">https://medium.com/p/94fd2da2a3f2</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[HyunJae Lee]]></dc:creator>
            <pubDate>Sat, 01 Apr 2023 23:36:05 GMT</pubDate>
            <atom:updated>2024-05-13T06:18:26.352Z</atom:updated>
            <content:encoded><![CDATA[<h3>Intelligent Cloud — Part 1: Introduction to Lunit’s Cloud Deep Learning Platform for Efficient Model Training</h3><h3>Introduction</h3><p>In Lunit, we train a large number of deep learning models on a daily basis. This process is highly computationally intensive, requiring powerful hardware to keep up with the demands of training model. While we originally relied on on-premise servers to provide the necessary resources, these servers often encountered various issues. To better support our expanding research team, we decided to migrate our training infrastructure to the cloud. However, we soon realized that training models on the cloud required numerous manual processes, which were time-consuming and prone to errors.</p><p>To enable our team to fully leverage the advantages of cloud computing and efficiently train models at scale, we decided to develop a deep learning training platform, INtelligent CLoud (INCL). This platform has been a game-changer for our research process, providing the necessary resources and automating manual processes, allowing researchers to focus on developing new models and algorithms. In this blog post, we will delve into why we chose to migrate to the cloud and how INCL has enhanced our research capabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UqA8GR8Bre3xEE-F.jpg" /><figcaption>Image source: <a href="https://www.eginnovations.com/blog/cloud-migration-best-practices/">eginnovations</a></figcaption></figure><h3>Why did we migrate to cloud?</h3><p>There were several issues with on-premise servers, but two of the most important were scalability and hardware issues.</p><p><strong>Scalability Issues<br></strong>One of the most significant issues with on-premise servers is that they can be challenging to scale. As the number of team member increases, so too does the need for more resources. Furthermore, we frequently face situations where there is a sudden surge in demand for training resources, particularly close to deadlines for product development or paper writing. In an on-premise server environment, scaling up can be difficult and expensive. It often requires purchasing new hardware, which can be costly and time-consuming. Additionally, it can be challenging to predict how much hardware will be needed for future projects, which can lead to either under or over-investing in resources.</p><p><strong>Hardware Issues<br></strong>Another issue with on-premise servers is that they often suffer from hardware problems as the servers age. This can be particularly problematic for deep learning applications, which require powerful hardware such as GPUs to perform computationally intensive tasks. Over time, the GPUs may become outdated or start to malfunction, leading to reduced performance or even hardware failure. This can result in significant downtime and maintenance costs for organizations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*y9YblbHzxd1fHcZsBF0siw.png" /><figcaption>Requesting for server maintenance due to hardware issues</figcaption></figure><p><strong>Cloud Computing to the Rescue!<br></strong>Cloud migration can solve the aforementioned issues by take advantage of powerful computing resources on-demand, without the need for significant hardware investments. Cloud providers offer access to powerful GPUs, and users only pay for what they use, eliminating the need for significant upfront hardware investments. Additionally, cloud computing provides nearly limitless scalability, making it easy to expand the resources as needed.</p><h3>New challenges on the cloud environment</h3><p>While the cloud offers significant advantages over on-premise servers, training a model on the cloud requires many manual processes. Typical process for training a deep learning model includes:</p><ol><li>Creating a virtual machine</li><li>Setting up environment for training (e.g. data, code, etc.)</li><li>Training a deep learning model</li><li>Saving outputs to cloud storage</li><li>Deleting the virtual machine</li></ol><p>While training one model might be manageable, it can involve a significant amount of manual processes when training hundreds of models. In addition, new challenges arise when training deep learning models on the cloud, such as:</p><ul><li>Managing the results of experiments</li><li>Monitoring the experiment logs</li><li>Handling errors</li><li>Scaling infrastructure for multi-node distributed training</li></ul><p>As manual processes on the cloud are time-consuming and error-prone, we needed a more efficient solution that could automate these nuisance tasks and provide additional features to enhance the training process.</p><p>While there exists open-source platforms that handles similar problems like <a href="https://github.com/spotty-cloud/spotty">Spotty</a>, we found that they lacked some of the important features we required. For example, they typically only support cloud storage for data storage, which can be too slow for medical images and becomes the bottleneck for training. Additionally, many platforms did not support multi-node distributed learning. We also required features like GPU quota management, low GPU utilization detection, and support for team collaboration, which were not available on most platforms we tried. That’s why we developed our custom deep learning training platform, INtelligent CLoud (INCL).</p><h3>INtelligent CLoud (INCL) Platform</h3><p>INCL is designed to enable deep learning practitioners to make the most of the cloud computing environment and efficiently train models at scale. To achieve this goal, INCL offers various features as follows:</p><ul><li><strong>Automating manual processes</strong> involved in the training process on the cloud</li><li><strong>Experiments tracking and management</strong>, making it easy to monitor and analyze results</li><li><strong>Easy multi-node distributed learning</strong> which helps to speed up training times and enable large batch-size for self-supervised learning</li><li><strong>Automated hyperparameter optimization</strong>, reducing the need for manual tuning and increasing the efficiency of training</li></ul><p>Let’s take a closer look at each feature!</p><p><strong>Automating manual processes<br></strong>INCL is designed to make training deep learning models on the cloud as effortless as possible. By automating the manual processes involved in training, researchers can focus on developing new models and algorithms. So how can we run an experiment through INCL? All you need to do is specify the script that runs your experiment, the docker image and instance information, and INCL takes care of the rest. This can be done easily like the example shown below.</p><pre>cd ${PATH_TO_YOUR_EXPERIMENT_REPO}<br><br>incl run --script &quot;python cifar.py --lr 0.1&quot; \ # Run script<br>         --name cifar100-lr-0.1 \  # Experiment name<br>         --docker-image pytorch/pytorch:1.12.0 \ # Docker image<br>         --gpu-type t4 --gpu-num 4 \    # Type and number of GPU<br>         --machine-type n1-standard-32 \    # Instance type<br>         --disk-size 20 \   # Disk size (GB) required for experiment</pre><p>INCL uploads the code to the current working directory, spins up the instance, sets up the environment, and runs the experiments without requiring any manual intervention. Moreover, it handles various errors that could occur during this process, freeing up time and resources for researchers to focus on more important tasks.</p><p><strong>Experiments tracking and management<br></strong>Experiment tracking and management are essential when training a model on the cloud, especially when working on complex deep learning projects. Without a proper system in place, it can be challenging to keep track of the experiments, manage them efficiently, and monitor their progress. INCL understands this need and provides a comprehensive experiment tracking and management system that is accessible through both the command-line interface (CLI) and web UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*-TZlqd4YzvZ7j9GFq0e8-g.png" /><figcaption>Detailed information, log, metric graph and file of an experiment are easily manageable in INCL</figcaption></figure><p>INCL’s experiment management system provides users with a clear worklist of their experiments, including their status, configuration, and other important details. It also allows users to monitor the experiment logs, and the system automatically saves the results of the experiments. Users can download the results at any time, making it easy to share them with others. INCL also provides real-time updates on the experiment’s progress and sends notifications when the status changes. The system also supports Slack notifications to keep users informed about the experiments’ status and progress.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*nWYgvwVqOmo6TG8o-vLc_A.png" /><figcaption>INCL worklist allows user to easily manage their experiments</figcaption></figure><p>INCL’s experiment tracking system includes visualization of live metrics, making it easy for researchers to track the model’s performance during the training process. This feature provides the ability to monitor various performance metrics, such as loss, accuracy, and other custom metrics, making it easy to assess the model’s performance and make necessary adjustments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s0bLgv4zUz1bMvmxPnj8uQ.png" /><figcaption>Various experiments can be easily compared using the INCL analyzer</figcaption></figure><p>Finally, INCL’s experiment tracking system includes a model registry feature, making it easy to manage models throughout their lifecycle. The system allows researchers to register models, add metadata, and keep track of versions, making it easy to manage and deploy models in production. All these features make INCL an ideal platform for deep learning researchers looking to streamline their work and improve their productivity.</p><p><strong>Multi-node distributed learning<br></strong>Multi-node distributed learning is a powerful technique for accelerating deep learning training times and is particularly useful when dealing with large datasets or complex models. By distributing the computation across multiple nodes, researchers can take advantage of parallel processing to speed up training times and tackle larger problems. Moreover, in recent years, self-supervised learning has emerged as a promising approach for training deep learning models. It requires training on large amounts of data and a large batch size is often necessary for good performance. Multi-node distributed learning is an essential tool for enabling this type of training, as it allows researchers to scale up the batch size and process large amounts of data efficiently.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*vIGB3JirJDRDvDXus2oGQg.png" /><figcaption>Distributed learning accelerates deep learning training times (from <a href="https://arxiv.org/pdf/1706.02677.pdf">arxiv</a>)</figcaption></figure><p>INCL provides a seamless way to use multi-node distributed learning, making it easier for researchers to focus on developing new models and algorithms rather than worrying about the technical details of training on the cloud. All you need to do is specify the number of nodes you want to use to scale your experiments. INCL automatically provisions and sets up the environment required for the distributed learning, as well as sets the necessary environment variables. You can simply pass these variables to your running script, and INCL will handle the rest. This means that you can easily run large-scale distributed learning experiments with a simple commands as below.</p><pre>incl run --node-num 4 \       <br>         --name multi-node-experiment \<br>         --script &quot;python -m torch.distributed.launch  \<br>                          --nnodes=$NUM_NODES  \<br>                          --nproc_per_node=$NUM_GPU_PER_NODE  \<br>                          --node_rank=$NODE_RANK \<br>                          --master_addr=$MASTER_ADDR \<br>                          --master_port=$MASTER_PORT \<br>                          train.py&quot;</pre><p><strong>Automated hyperparameter optimization<br></strong>Automated hyperparameter optimization (HPO) is crucial in reducing the manual work of researchers in training deep learning models. Traditionally, hyperparameters need to be manually tuned by researchers, which can be a time-consuming and labor-intensive task. With automated HPO, INCL automatically searches through a range of hyperparameters to find the optimal configuration, freeing up researchers’ time and resources to focus on developing new models and algorithms. By automating HPO, INCL maximizes the efficiency of training deep learning models on the cloud, making it easier for researchers to achieve state-of-the-art results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PsuqQ2uMAzdRQf0efNE9Gg.png" /><figcaption>Multiple charts are provided to enable meaningful insights into hyperparameter optimization</figcaption></figure><p>Among various HPO algorithms, INCL’s HPO module is built on top of the Tree-structured Parzen Estimator (TPE) algorithm, which has proven to be highly effective. However, INCL further improves upon the original TPE algorithm to boost the performance which will be further introduced in another post. INCL allows for the parallelization of hyperparameter optimization to reduce the time it takes to find the optimal set of hyperparameters. This is achieved by distributing the evaluation of hyperparameters across multiple nodes, which significantly speeds up the process compared to running the evaluations sequentially</p><p>INCL also allows researchers to easily specify the hyperparameter space, providing flexibility in the optimization process. All you need to do is specifying the hyperparameter space as an example below. INCL will inject each suggested hyperparameter as environment variable with the name you specified. To utilize INCL’s HPO feature, only a minor code modification is required. Researchers need to log the metric they want to optimize with the specified name in the configuration file by using the incl.log method. This logs the metric value during the experiment, which INCL uses to search for the optimal hyperparameters. With this straightforward modification, researchers can easily leverage the power of automated HPO without needing to write complex code or set up additional infrastructure.</p><pre>hpo_meta:<br>  name: cifar-hpo<br>  num_total_trial: 128<br>  num_parallel: 8<br>  metric:<br>    name: loss<br>    goal: minimize<br>  search_space:<br>  - name: lr<br>    distribution: log_uniform<br>    min: 1e-5<br>    max: 1e-1<br>  - name: optim<br>    distribution: categorical<br>    values:<br>    - adam<br>    - sgd<br><br>job_meta:<br>  script: &quot;python cifar.py --learning-rate=${lr} --optimizer=${optim}&quot;<br>  gpu_type: t4<br>  gpu_num: 1<br>  machine_type: n1-standard-4</pre><h3>How INCL Improved Our Research Process</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lQbDqJyNvEWPgzhrTq93qQ.png" /></figure><p>INCL has revolutionized the research process for our team. With INCL’s streamlined process for running, tracking, and managing experiments, every researchers can quickly and easily set up and run experiments. This has greatly reduced the amount of time and resources required for managing the infrastructure and allowed researchers to focus more on developing new models and algorithms.</p><p>When approaching deadlines for product development, INCL has easily scaled up infrastructure to hundreds of GPUs to accelerate the training process. The easy-to-use multi-node distributed learning feature has also been actively explored. This feature has enabled us to train models on larger datasets and with larger batch sizes, which has led to significant improvements in performance. Automated hyperparameter optimization with INCL has also been a game-changer for our team. By using INCL’s HPO feature, we have been able to achieve state-of-the-art performance on several products with minimal manual effort.</p><p>Overall, INCL has transformed the way our team conducts research by providing an easy-to-use and powerful platform for managing infrastructure, running experiments, and optimizing hyperparameters. It has enabled us to be more productive and achieve better results in less time.</p><h3>Conclusions</h3><p>Migrating to the cloud has been a critical decision for our research team, allowing us to address the challenges of scaling our training infrastructure. We have found that cloud computing provides us with the necessary computational resources and flexibility to support our expanding research team. Moreover, our development of INCL has further enhanced our capabilities, providing an easy-to-use and efficient platform for managing infrastructure, running experiments, and optimizing hyperparameters. There are still many areas where we could improve deep learning process in Lunit. If you’re passionate about building and optimizing deep learning system and want to work on cutting-edge technology that’s making a big impact in the industry, consider joining Lunit’s team!</p><p>Explore the full spectrum of our Intelligent Cloud (INCL) series. You can easily navigate through the entire series here:</p><ul><li><a href="https://medium.com/lunit/intelligent-cloud-part-1-introduction-to-lunits-cloud-deep-learning-platform-for-efficient-94fd2da2a3f2">Intelligent Cloud — Part 1: Introduction to Lunit’s Cloud Deep Learning Platform for Efficient Model Training</a></li><li><a href="https://medium.com/lunit/intelligent-cloud-part-2-a-deep-dive-into-the-architecture-and-technical-details-of-incl-b808b39f9f9f">Intelligent Cloud — Part 2: A Deep Dive into the Architecture and Technical Details of INCL</a></li><li><a href="https://medium.com/@hyunjae.lee410/optimizing-gpu-costs-by-leveraging-spot-instances-189e5dfc17ee">Intelligent Cloud — Part 3: Optimizing GPU Costs by Leveraging Spot Instances</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94fd2da2a3f2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lunit/intelligent-cloud-part-1-introduction-to-lunits-cloud-deep-learning-platform-for-efficient-94fd2da2a3f2">Intelligent Cloud — Part 1: Introduction to Lunit’s Cloud Deep Learning Platform</a> was originally published in <a href="https://medium.com/lunit">Lunit Team Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>