<?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[Theator Tech - Medium]]></title>
        <description><![CDATA[Utilizing state-of-the-art Engineering, AI/ML &amp; Computer Vision technology, our platform automatically captures and analyzes surgical video data, providing actionable, real-time insights that can help surgeons improve patient care. We lead the Surgical Intelligence revolution! - Medium]]></description>
        <link>https://medium.com/theator?source=rss----d93a4883f66d---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Theator Tech - Medium</title>
            <link>https://medium.com/theator?source=rss----d93a4883f66d---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 19:30:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/theator" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How we utilize NoCode as a way to increase development velocity]]></title>
            <link>https://medium.com/theator/how-we-utilize-nocode-as-a-way-to-increase-development-velocity-2cab20b0d279?source=rss----d93a4883f66d---4</link>
            <guid isPermaLink="false">https://medium.com/p/2cab20b0d279</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[full-stack]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[no-code]]></category>
            <category><![CDATA[retool]]></category>
            <dc:creator><![CDATA[Galsasson]]></dc:creator>
            <pubDate>Thu, 18 Apr 2024 11:15:25 GMT</pubDate>
            <atom:updated>2024-04-18T11:29:07.052Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XaftyqP00y2G1vx0HkooTw.png" /></figure><p>At Theator, we navigate the rapidly changing tech landscape with the goal of expanding our operations while maintaining our innovative edge. In this journey, Retool has proven indispensable, streamlining our development workflows while fully preserving our operational capabilities and functionality.</p><p><strong>The Shift to NoCode: A Developer’s Perspective</strong></p><p>Transitioning to NoCode wasn’t just a strategic move; it was a necessary evolution to address our growing pains. The diversity of our workload, from enhancing our surgical video annotation platform to squashing bugs and crafting tools for our operations team, began to stretch our capacities thin.</p><p>Initially, we leaned heavily on Jupyter Notebooks for running dedicated scripts — a method that, while flexible, led to an unsustainable cycle of maintenance and error rectification. The need for a more streamlined solution was clear.</p><p><strong>Retooling Development with Retool</strong></p><p>Retool changed the game for us. It wasn’t about abandoning code but about optimizing our approach to development. The platform enabled us to build web applications, execute API calls, and manage data more intuitively.</p><p>Take our demo experience generation, for example. What was once a labor-intensive script in a Jupyter Notebook transformed into a Retool application that could dynamically create and manage demo environments with unprecedented ease. This shift wasn’t just about saving time; it was about enhancing accuracy and reducing cognitive load on our developers.</p><p><strong>The Developer’s Gain: More Time for What Matters</strong></p><p>Embracing NoCode has allowed our developers to reallocate their focus towards deeper, more complex challenges. The platform’s drag-and-drop interface, while not a replacement for the finesse of custom-coded UIs, proved sufficient for our internal tools, striking a balance between functionality and speed.</p><p>Moreover, this transition fostered a culture of empowerment among our non-developer team members, who can now directly engage with our data and backend systems without constant fear of messing up and without demanding excessive time and attention from the developers . This democratization of tool creation and data manipulation has been a game-changer for our operations.</p><p><strong>A Developer’s Reflection</strong></p><p>Personally, the journey into NoCode development with Retool has been refreshing. As developers, we’re often predisposed to believe that more code is the answer. Yet, here we were, finding immense value in a platform that challenged this notion, reminding us that efficiency and impact don’t always require writing more lines of code.</p><p><strong>Looking Forward with NoCode in Our Arsenal</strong></p><p>NoCode platforms, especially in the context of rapid operational scaling and the need for agile development practices, have proven their worth time and again. At Theator, our foray into NoCode with Retool has not only accelerated our development velocity but also broadened our perspective on what it means to build and innovate.</p><p>As we advance, the potential of NoCode to drive both efficiency and innovation remains vast. Our experience has shown that integrating NoCode into our development strategy enables us to concentrate our expertise on creating sophisticated, high-quality solutions, ultimately advancing our mission to transform surgical video annotation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2cab20b0d279" width="1" height="1" alt=""><hr><p><a href="https://medium.com/theator/how-we-utilize-nocode-as-a-way-to-increase-development-velocity-2cab20b0d279">How we utilize NoCode as a way to increase development velocity</a> was originally published in <a href="https://medium.com/theator">Theator Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to avoid React prop drilling]]></title>
            <link>https://medium.com/theator/how-to-avoid-react-prop-drilling-119c767dc2a1?source=rss----d93a4883f66d---4</link>
            <guid isPermaLink="false">https://medium.com/p/119c767dc2a1</guid>
            <category><![CDATA[hooks]]></category>
            <category><![CDATA[props]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[prop-drilling]]></category>
            <dc:creator><![CDATA[Dana Aviv]]></dc:creator>
            <pubDate>Sun, 03 Mar 2024 10:29:52 GMT</pubDate>
            <atom:updated>2024-03-03T12:43:30.816Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*TGaIBeq3jJoS9IFCPI9DOQ.png" /></figure><p>I believe that, like me, most React developers have encountered the problem of prop drilling during their careers.</p><p>Usually, this is not the most severe problem, but it clutters the code, makes it difficult to maintain and read, and most importantly — reduces efficiency. Recently I discovered a very elegant solution that made me think, “How did I not know this before?” so I’ve chosen to share it with you.</p><h3>The famous problem</h3><p>Prop drilling refers to repeatedly transferring data from a parent component to nested child components in order for those child components to use or share data.</p><p>The problems with prop drilling are:</p><ul><li>Bad and unreadable code style.</li><li>Components are used as an information transfer pipe.</li><li>Difficulty in maintaining the code.</li><li>Inefficiency (rendering components unnecessarily).</li></ul><p>Take a look at the example in the following schema (drilled props colored in red):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9UJqpVslljaVBMMEYUF6SQ.png" /></figure><h3>The journey toward the solution</h3><h4>A brief intro to the system</h4><p>Our system displays a video player of a surgical operation. Next to it, there is a timeline of the stages of the operation and additional insights. Below the video player are tabs containing general information about the operation.</p><p>Each part — the video, the timeline, and the tabs below — stands on its own as a component with many children components.</p><h4>Introduction to my feature</h4><p>Here is the feature I was working on, and how prop drilling became a big problem.<br>I needed to create a gallery of screenshots that were taken by a surgeon during an operation. I decided to place it as a new tab under the video player.</p><p>The snapshots needed to be shown in the timeline at the moment they were taken. When clicking on a snapshot image (from a gallery or timeline), the image should have increased to a slider display above the whole screen (like a modal).</p><p>In terms of functionality, it should have supported renaming and downloading the images from any of the indicated sections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y9pQHYxoW9fPbxVAl7ADbw.png" /></figure><p>My implementation at that stage was to insert the data of the snapshots into an existing OperationContext and drill the functions through props from the parent component to the children components (timeline, gallery, slider).</p><p>I had a gut feeling that the code was cumbersome, but the approach was to release an initial version as soon as possible.</p><h4>Possible but less preferable solutions</h4><p>Along the way I tried to solve the problem using <strong>Context</strong>, a common solution to the prop drilling problem. In my opinion, it didn’t simplify the code and even complicated it. Other than that, there were relatively few functions and states and it felt like killing an ant with an elephant.</p><p>Another solution is <strong>Components Composition</strong>,<strong> </strong>which I prefer less because it makes the code more difficult to read and maintain.</p><p>The straw that broke the camel’s back: After the release of the initial version, there was a demand to add additional functions and states that should drill along the way.</p><p>During a joint thought session with a senior team member, he taught me the following method.</p><h3>The solution — customized hook</h3><h3>Creating our own hook: use Snapshots</h3><p>In the following section, I’ll explain how I used the customized hook, and show you how to do it step by step. Before you start, I recommend maintaining the data in a context (assuming it is shared from several places), in order to have one source of truth.</p><p><strong>Step 1: </strong>Create a file that includes all relevant functions, states, and data processing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*IvZMs3qUe86c7Of89fwSJQ.png" /></figure><p><strong>Step 2:</strong> Import and Initialize the hook from the required parts of the application.</p><p><em>Pay attention to the fact that you need to pass props during initialization if you require them in your hook definition.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*zE8hgjP7EasPZEQHqJIbNQ.png" /></figure><p><strong>Step 3: </strong>Use it as needed inside each component.</p><p><em>You can choose which part to use from the hook (here I selected snapshotItems only).</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*xxv8Z24ZbLu0Ztd0ADiQJw.png" /></figure><h3>How does this solve the problem?</h3><p>A. The code is readable and clean — no prop drilling!<br> We can add the ‘useSnapshots’ hook only in relevant components.</p><p>B. Components are not used as an information transfer pipe anymore.</p><p>C. Maintaining the code may be done only in the hook file, so it’s easier.</p><p>D. Components are not rendered unnecessarily since the props are not passed through them.</p><p><em>I like this concept and have been using it quite a lot. What do you think? I would love to hear more solutions, improvements, or other uses in creating your own hook 🙂</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=119c767dc2a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/theator/how-to-avoid-react-prop-drilling-119c767dc2a1">How to avoid React prop drilling</a> was originally published in <a href="https://medium.com/theator">Theator Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Future of Work: How Pod-Based Organization is Changing the Game]]></title>
            <link>https://medium.com/theator/the-future-of-work-how-pod-based-organization-is-changing-the-game-8246a91e6b1c?source=rss----d93a4883f66d---4</link>
            <guid isPermaLink="false">https://medium.com/p/8246a91e6b1c</guid>
            <category><![CDATA[future-of-work]]></category>
            <category><![CDATA[customer-centricity]]></category>
            <category><![CDATA[organizational-change]]></category>
            <category><![CDATA[innovationalthinking]]></category>
            <category><![CDATA[strategic-leadership]]></category>
            <dc:creator><![CDATA[Guy Raviv]]></dc:creator>
            <pubDate>Sun, 03 Mar 2024 10:24:07 GMT</pubDate>
            <atom:updated>2024-03-03T10:24:07.912Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bErr70UVhKAwYsee56ELEw.jpeg" /></figure><p>I firmly believe in the power of sharing knowledge gained through personal experience and I’m eager to share mine with you. As a software developer, what matters most to me is establishing connections with clients and making a meaningful impact on them. Throughout my career, I’ve prioritized engaging closely with clients, understanding their needs deeply, and ensuring that my work delivers significant value. In the traditional R&amp;D teams I’ve worked with, the team’s structure was based on the team’s profession. Examples of such teams are ‘backend’ (developing the infrastructure), ‘frontend’ (developing the platform), ‘product’, and ‘research’. In the traditional R&amp;D I’ve been part of, a noticeable gap often existed between developers and clients. This gap was sometimes bridged by either the curiosity of team members or the strategic direction provided by leadership.</p><p>In this post, I’ll explore how the transition to Pods addressed this gap while bringing attention to other challenges that arose. I’ll share my perspective and experiences during this transformative phase at Theator.</p><p>Theator is a startup pioneering the surgical intelligence revolution. It harnesses advanced AI and computer vision technology to generate actionable insights aimed at enhancing surgical care quality. Given Theator’s presence in the healthcare sector, obtaining timely customer feedback is crucial for delivering a product that truly meets their needs.</p><p>If you’re considering a change in your organizational structure or facing challenges within traditional professional R&amp;D teams, I encourage you to stay tuned!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6tKBxC5lbgjURsOpxCx3tw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NQ9nIdkui2amIvIEapvKxA.png" /></figure><h3>The transformation from classic R&amp;D teams to Pods</h3><p>One of the most important and complex missions of an organization is the ability to focus the R&amp;D in the right direction. From my perspective, focusing on tech tasks and not product goals can lead to working in a less optimal (maybe even wrong) way, one that doesn’t generate the most significant impact for the company and the customer. When the developers are distant from the client, their ideas and creativity may diverge from the main objective that is most important to the customer. It could be developing an infrastructure that can last for years, creating something very efficient, or writing code that fits the vision of the past and not the current vision of the customer that may change and progress.</p><p>When I started working at Theator, I felt so excited to work at an innovative healthcare company that truly creates value for doctors and patients, and improves healthcare quality around the world.</p><p>But there was still a feeling in the background. The classic R&amp;D team structure masks the view of the developers and narrows it to tech tasks instead of focusing on the main product goal.</p><p>A few months after I started working at Theator, the company moved to a new R&amp;D structure, Pods! One of our team leaders described the transition: “We allocated people to Pods based on their respective areas of expertise. Each pod consists of individuals with complementary skills, creating a well-rounded team, capable of delivering comprehensive solutions. Every pod is led by a pod leader who facilitates coordination and decision-making, and guides the team towards meeting specific key performance indicators (KPIs).”</p><p>For me, the transition changed it all!</p><h3>To be (Pods), or not to be, that is the question!</h3><blockquote>It is always a good time for a little inspiration from Shakespeare</blockquote><p>Here, I’ll highlight the pros and cons of our new org proposal so you can make the best data-driven decision — let’s dive in!</p><h3>Advantage: The client in the center</h3><p>Pods have affected our work environment, which now focuses on the clients and their goals rather than on the split technological expertise required to achieve them. Each technological expert has been enabled to have a broad view of the problem and be part of a constant discussion that refers to all fields and not necessarily only to their own field. This has created mutual fertilization, an understanding of edge problems, and an ability to build overall solutions while progressing dynamically.</p><h3>Advantage: Adapting to changes and moving fast</h3><p>Gathering a variety of experts together in a team has made it possible to adapt to changes and provide a quick response to feedback. Organizations that depend on client feedback have to move fast in order to calibrate the perfect solution. Specifically, in the healthcare sector, we need to penetrate the “old shell”, earn the doctor’s trust and prove that our product brings proven value and is both simple and convenient to use. If the product doesn’t give the accurate value that suits the customers, they will not use it.</p><h3>Advantage: Empowering the individual</h3><p>Pods encourage individual team members to take more responsibility, innovate and be creative in their area. Less context switching between different KPIs enables team members to gain knowledge quickly in the specific KPI area, which lets them get the wide view that is required to innovate and take the team to the next level.</p><p>If you want to adopt the Pods organizational structure, it is important to mention that we identified a few areas you must consider and focus on.</p><h3>Disadvantage: Knowledge sharing decreases</h3><p>Shifting from a professional team to a pod decreases knowledge sharing between the original professional team members.</p><p>The solution chosen by Theator has been to keep the original professional team in the background, share PRs and create knowledge-sharing meetings.</p><h3>Disadvantage: The one dependency</h3><p>Another shortcoming that could show up is a dependency on a specific professional team member to accomplish a KPI goal. Previously, in the original team, it was rare that only one team member was familiar with a specific topic. Now, as we have team members from only one profession in a pod, it’s necessary to create knowledge sharing between team members in different Pods to support the lack of team members (due to sickness, vacation, etc).</p><h3>Disadvantage: Personal management and mentoring</h3><p>One of the drawbacks of Pods is that developers may feel like they don’t have someone looking after their personal growth. This could lead to mental fatigue, which could develop into a lack of personal development and frustration. When there is no one taking care of the employee formally and informally, there is a real difficulty in the employee’s ability to advance in the company and develop in the direction that suits them.</p><p>At Theator we are still shaping our solution for this issue. Currently, the professional team lead still takes care of the personal development of the professional team. The team lead faces some difficulties in achieving the same quality of personal mentoring as before, due to the fact that the original team was spread between different Pods.</p><h3>Choose your path but keep your eyes open</h3><p>In a world that is ever-evolving, we must remain adaptable, continuously refining and evolving our organizational structures to meet the demands of the times. My experience has shown that adopting the Pods structure has significantly enhanced Theator’s ability to concentrate on critical company KPIs effectively, while simultaneously fostering a motivated workforce and prioritizing our customers’ needs. Presently, the Pod model stands as a pioneering, customer-centric framework, empowering us to make a meaningful impact on a global scale. This innovative approach not only aligns with our mission but also positions us to lead change in the industry, demonstrating the transformative power of adaptability and focused collaboration.</p><p>In this journey of continuous improvement, it is vital that we keep our eyes open for the next wave of change, ready to embrace new challenges and opportunities that come our way. This mindset ensures we are not just reactive but proactive, staying ahead in a world where adaptability is key to enduring success.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8246a91e6b1c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/theator/the-future-of-work-how-pod-based-organization-is-changing-the-game-8246a91e6b1c">The Future of Work: How Pod-Based Organization is Changing the Game</a> was originally published in <a href="https://medium.com/theator">Theator Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Practical Multitask Learning: My First Steps]]></title>
            <link>https://medium.com/theator/practical-multitask-learning-my-first-steps-6aede40f6982?source=rss----d93a4883f66d---4</link>
            <guid isPermaLink="false">https://medium.com/p/6aede40f6982</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[multi-task-learning]]></category>
            <category><![CDATA[pytorch]]></category>
            <dc:creator><![CDATA[Ziv Nachum]]></dc:creator>
            <pubDate>Sun, 03 Mar 2024 10:21:06 GMT</pubDate>
            <atom:updated>2024-03-03T10:21:06.230Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*kRDLs3zdIGTldoLoUf4OxQ@2x.png" /></figure><p>Multitask learning is a pretty cool buzzword, but a rather complex thing to do. Optimizing a single monstrous model with multiple objectives sounds almost impossible. Even just getting there by building a proper framework, with a dataset that works with very different tasks, is not easy to achieve.</p><p>In my work as a computer vision engineer, I wanted to train a model that performs very different tasks on the same input — image classification, temporal video segmentation, video classification, and temporal action localization, while keeping the code robust and straightforward. I also wanted to finish the coding part quickly and start experimenting with the model and optimizing it.</p><p>In this post, I’ll explain how I built a working multitask learning architecture, and provide practical insights on how you can do it too.</p><h3>What’s the problem?</h3><p>Our model consists of two parts: a feature extractor (backbone) which creates a feature representation from the video input, and task-specific model heads, such as LSTM. These heads get feature representation created in the backbone as an input, and each of them performs a single task like classification, segmentation or detection.</p><p>A big question is how to train such a model.</p><p>One solution for this problem is to run each task separately and iteratively, i.e., given a data sample, pass it through a backbone, then pass the feature vector through the first task while keeping the other task heads frozen, compute the loss, backpropagate and update the model weights. Then do the same thing for the second task, and so on.</p><p>This solution was not good enough since, at each step, the shared part leaned more towards a specific task, rather than stepping into a direction that optimized all tasks at once.</p><p>In this post, I want to offer a different approach that focuses on training the backbone and all task heads. In order to achieve that, we had to build the dataset correctly and ensure it flowed through the different models as we wanted it to.</p><h3>How we tried to slay the multi-headed dragon</h3><p>In multitask learning, the model contains a single shared backbone, which extracts the same features for all tasks.</p><pre>class MultitaskModel(torch.nn.Module):<br>    def __init__(self, shared: nn.Module, tasks: List[Task]):<br>        super().__init__()<br>        self.shared = shared<br>        self.tasks = tasks<br>        self.tasks_heads = torch.nn.ModuleDict(<br>            {task.name: task.generate_task_model() for task in tasks})</pre><p>Our first design choice was to define separate independent tasks. Each task defined a model head, a loss function and metrics. In addition, for each sample from our data, each task defined how to handle input. For example, one task may have reshaped the samples in order to fit them correctly into its model, and another task might have augmented the data before passing it through the model.</p><pre>class Task(ABC):<br>    name = &quot;task&quot;<br><br>    def __init__(self, active: bool, loss_weight: float = 1.0):<br>        self.active = active<br>        self.loss_weight = loss_weight<br><br>    @abstractmethod<br>    def get_label(self, sample: Any, training: bool) -&gt; Any:<br>        pass<br><br>    @abstractmethod<br>    def generate_task_model(self) -&gt; nn.Module:<br>        pass<br><br>    @abstractmethod<br>    def inputs_adapter(self, inputs: Any) -&gt; Any:<br>        pass<br><br>    @abstractmethod<br>    def labels_adapter(self, labels: Any) -&gt; Any:<br>        pass<br><br>    @property<br>    @abstractmethod<br>    def loss(self) -&gt; Union[nn.Module, Callable]:<br>        pass<br><br>    @property<br>    @abstractmethod<br>    def get_pred(self) -&gt; torch.Tensor:<br>        pass</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*65SNy_TwbLd9XmTwZdWurg@2x.png" /><figcaption>A general overview of the described multitask architecture</figcaption></figure><p>Every sample corresponded to a subset of tasks. When initializing the dataset, we generated samples and labels for every task, and kept track of which sample corresponded to which tasks.</p><p>Performing forward() on the model should have been fairly straightforward. Given an input, we ran it through the shared feature extractor, then iterated through the different tasks, modified the feature vector to fit the relevant task head, and then ran the relevant model head. Then all that was left to do was calculate the loss for this batch, which was defined as the weighted sum for each task&#39;s loss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*ef4GLlR7T1xQr79gF5Bk_g@2x.png" /><figcaption>The loss is the weighted sum of each task’s loss.</figcaption></figure><pre>  def forward(self, inputs):<br>      shared_features = self.shared(inputs)<br><br>      outputs_dict = {}<br>      preds_dict = {}<br>      for task in self.tasks:<br>          task_inputs = task.inputs_adapter(shared_features)<br>          outputs_dict[task.name] = self.tasks_heads[task.name](*task_inputs)<br>          preds_dict[task.name] = task.get_pred(outputs_dict[task.name])<br><br>      return outputs_dict, preds_dict<br><br>  def backward(self, outputs, labels):<br>      loss = torch.tensor(1)<br>      for task in self.tasks:<br>          curr_labels = task.labels_adapter(labels)<br>          loss += task.loss_weight * task.loss(outputs[task.name], curr_labels)<br>      return loss</pre><p>When training a model to perform a backward pass, the loss function must be computed by performing a forward pass through all the model parameters. This might have caused an issue if there was a batch with no sample for one task. Technically, we could have just set the loss to zero for this task, but this solution might have caused unwanted behavior, since, in some iterations, we would get losses for all tasks, and in some cases, we wouldn’t.</p><p>A solution for this problem was to define a sampler that ensures, in every batch, that there was at least one sample that corresponded to each task. When creating the dataset, we had the information of which sample was relevant to which of the tasks. Another important consideration in implementing this sampler was making sure that each of the tasks saw as much data as possible in each task, but also saw a very diverse set of data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*XjJOjJa5a8BrII3jVAJFrA@2x.png" /><figcaption>Each batch contains a few samples which must correspond to all participating tasks.</figcaption></figure><h3>What the future holds</h3><p>Once this architecture was designed and implemented, exploring and optimizing this complex model was very easy. Even debugging the whole system was quite simple. The losses and metrics of each task were calculated and reported, which made optimizing the learning policy possible.</p><p>As we move forward, we’re going to face the challenge of optimizing the model for all tasks. This can be tackled using several approaches that require exploration, such as balancing the losses by adjusting their weights, and applying a different learning rate for each part of the model — either model head.</p><p>Training a multitask system probably won’t get each task model to the optimum due to the tension between the different tasks. On the other hand, our backbone network might benefit from the diversity of tasks. In our case, it allowed us not only to enrich our feature representation and shorten our training cycles, but to use a single heavy backbone model (instead of multiple models), which saved us a lot of inference time and memory.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6aede40f6982" width="1" height="1" alt=""><hr><p><a href="https://medium.com/theator/practical-multitask-learning-my-first-steps-6aede40f6982">Practical Multitask Learning: My First Steps</a> was originally published in <a href="https://medium.com/theator">Theator Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Empowering Developers Through Context]]></title>
            <link>https://medium.com/theator/empowering-developers-through-context-ecb651bac923?source=rss----d93a4883f66d---4</link>
            <guid isPermaLink="false">https://medium.com/p/ecb651bac923</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[no-rules-rules]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Gal Saada]]></dc:creator>
            <pubDate>Sun, 03 Mar 2024 10:14:13 GMT</pubDate>
            <atom:updated>2024-03-03T12:50:47.807Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FhLyz5KNH5NuEjzKOj1OuA.jpeg" /></figure><p>When was the last time you asked someone to do a task? Most of the time, you outline the expected deliverable, not the ultimate goal aka the problem we are trying to solve. That’s the definition of leading by control.</p><p>Leading by control was the mainstream management approach in the early twentieth century; a century later, it continues to dominate many tech companies. Most of the time we don’t realize this is the case.</p><p>Leading by context is one principle that became more popular with the book No Rules Rules on the work culture at Netflix. The principle emphasizes equipping team members with the information and resources they need to make decisions and take actions; it’s a more effective and, notably, empowering approach</p><p><strong>You are hiring highly talented people, you’ll benefit by giving them the ability to impact across the board and not only lines of code</strong>.</p><h3>The Netflix way — The fundamentals</h3><p>Leading by context is only one of Netflix’s fundamentals. Let’s try to cover them to have a wider context</p><ol><li>Talent density: If you have a group of high performers, they’ll most likely crave freedom and thrive if you lead with context.</li><li>Candor and open feedback: The company has to encourage candid and direct communication. Open feedback helps identify problems and find solutions quickly, without letting issues fester or hinder progress.</li><li>Context, not control: Instead of imposing strict rules and processes, provide context. Employees can make decisions aligned with the company’s vision by understanding the bigger picture and goals.</li><li>Encouraging risk-taking and innovation: Promote a risk-tolerant culture, where employees are encouraged to take calculated risks and innovate without fear of failure.</li><li>Highly aligned, loosely coupled: Emphasize high alignment around goals while maintaining loosely coupled structures, allowing teams to operate independently and make decisions that serve their specific needs.</li></ol><p>Loose coupling works only if there is a clear, shared context between the management and the team. Context alignment drives employees to make decisions that support the mission and strategy of the organization. This is why the mantra at Netflix is ‘<strong>Highly aligned, Loosely coupled</strong>’.</p><p>After understanding the fundamentals we’ll dive into why context is the primary one to focus on. The rest will follow.</p><h3>Context creates a genuine impact</h3><p>As everything in the world has pros and cons, from my experience leading development teams in several startup companies, the benefits are far greater than the detriments. With a grasp of the broader vision and objectives, employees can make decisions that are aligned with the company’s vision, while taking risks, assuming responsibilities, and being accountable for their work. Some things will improve down the road, and some improve immediately.</p><p>As a developer, you’ll instantly feel more autonomy and empowerment. You can make decisions [right or wrong] and take ownership of your work. Additionally, understanding how your work aligns with the company’s overall goals leads to a sense of purpose and innovation. Knowing the significance of your contributions fosters a strong sense of fulfillment and motivation in your day-to-day tasks. It allows you to explore innovative solutions for problems you might not have considered just minutes ago. You’ll find yourself thinking out of the box and coming up with creative ideas that might lead to breakthroughs in product and technology. Soon any problem won’t feel out of your scope anymore, both technical and non-technical.</p><p>As a manager, be aware that until now, you might have been one of your teammates’ main source of context. It’s critical to challenge this status quo. No one should hold all the context all of the time. The more context your teammates have, the better, more profound, and more complex questions they will ask. For some questions, you won’t have the answers, that’s a great sign for a step in the right direction. Encourage your team to find the answer via anyone they think might know it, product, marketing, or CTO.</p><p>“It made our workforce smarter. When you give all employees access to information that is generally reserved for high-level executives, they get more done on their own. They work faster without stopping to ask for information and approval. They make better decisions without needing input from the top.”</p><p>― <strong>Reed Hastings, </strong><a href="https://www.goodreads.com/work/quotes/74541588"><strong>No Rules Rules: Netflix and the Culture of Reinvention</strong></a></p><p>By trusting and empowering your teammates to make decisions based on their knowledge and context, soon you’ll see them thriving and making more impact every day. Autonomy allows employees to solve problems and accomplish tasks utilizing their expertise.</p><h3>The dark side of the moon</h3><p>Let’s talk about the things no one talks about, the less pleasant parts you’ll have to deal with, and what you can expect.</p><p>This approach doesn’t suit everyone. Some developers perform better and prefer to be told what to do. That doesn’t mean they are not good developers. It means they don’t fit this specific method.</p><p>From my experience, the hardest part of this approach is that you need everyone to be very good at their work and accountable for their actions. This builds trust and is one of the if not the most important part of this approach. You have to trust your teammates, your team leader, and the other pods to make the right decisions. Without that, it won’t work..</p><p>Another significant impact you might notice is that individuals who used to be the one source of truth and context might feel frustrated. They used to be the people in the organization who everything goes through and every decision is discussed with. They held all the context and used to know all the bits and bytes.</p><p>Obviously, it will take time for them to adjust. A great way to handle that is to explain the new approach and the benefits they, as individual contributors, will gain from it. The best tech leads you want around you are those who adapt quickly and see the great opportunities here. Show them that they will have more time to create an impact themselves instead of putting out fires.</p><p><strong>No change comes without some bumps in the road.</strong></p><h3>Now what?</h3><p>By now, I hope I’ve managed to convince you that leading by context is the best approach for your workplace. This will empower your team and give them a better opportunity to solve hard problems, unlock untold potential within your team while fostering a culture of ownership, creativity, and purpose.</p><p>Understanding the concept and agreeing with its merits is only the beginning. The real challenge lies in putting these principles into practice. This transition won’t happen overnight, and it won’t always be easy. There will be obstacles , questions, and moments of uncertainty along the way. That’s a natural part of any change, especially one that involves shifting management style and cultural paradigm.</p><p>I encourage you to take the first step of this journey today. <br>Begin by sharing the idea with your team. Order copies of the book “No Rules Rules” by Netflix and distribute them among your team members for further insight and discussion. Foster open dialogue about the benefits and challenges that this new approach might bring. Most importantly, stay open to feedback and be patient with the process.</p><p>You will know you’re successfully leading with context when your people are moving the team in the desired direction, using the information they’ve received from you and those around you, by making great decisions themselves.</p><p><strong>The talent within your team is vast. Their potential to impact extends far beyond the lines of code. It’s time to leverage that potential and foster an environment where everyone can truly thrive. Start leading by context today.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecb651bac923" width="1" height="1" alt=""><hr><p><a href="https://medium.com/theator/empowering-developers-through-context-ecb651bac923">Empowering Developers Through Context</a> was originally published in <a href="https://medium.com/theator">Theator Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How FlashAttention enables scaling up training and inference with zero cost]]></title>
            <link>https://medium.com/theator/how-flashattention-enables-scaling-up-training-and-inference-with-zero-cost-5d8c22c68838?source=rss----d93a4883f66d---4</link>
            <guid isPermaLink="false">https://medium.com/p/5d8c22c68838</guid>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[inference]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Yiftach Beer]]></dc:creator>
            <pubDate>Sun, 03 Mar 2024 10:10:48 GMT</pubDate>
            <atom:updated>2024-03-03T10:10:48.745Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ewoOmZdVaRjpUPKrzL-a7g.jpeg" /></figure><p>Nowadays, transformers are everywhere — from natural language processing to computer vision to bioinformatics and more. As they are so prominent, we want to make them better — run faster and with lower memory requirements, so that we can fit more work with the same setup.</p><p>When looking for ways to scale up transformers, deep learning engineers are faced with endless suggestions of things to try — inference engines, new shiny optimizers, approximate attention mechanisms, and more. While the list of things to try is endless, they often only give a small boost or come at the cost of accuracy.</p><p>FlashAttention (introduced in <a href="https://arxiv.org/abs/2205.14135">Dao et al. 2022</a>) may seem like yet another “speed up” method. However, it both speeds up models and dramatically lowers memory requirements, and most importantly, produces exactly the same result. All speed-up comes from a hardware-aware implementation and with no cost.</p><p>When I applied this feature in my domain, which is video analysis in long videos, it took a setup that required ~70G GPU memory to ~20G, enabling an increase of batch size x4 while making training x1.5 faster.</p><p>If you are not familiar with FlashAttention, not convinced you should use it or want to understand how it works before you make the switch — read on.</p><h3>Background</h3><p>It is well known that the memory requirements of Attention mechanisms scale quadratically in the number of input tokens. New variants are constantly created to approximate the same result with a cheaper computation. Some of the inefficiencies of the original computation, however, are quite avoidable. For example, consider the following implementation from the <a href="https://github.com/huggingface/pytorch-image-models">timm library</a>, before FlashAttention was introduced:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ee7d0662f095fa47d4a0733fe1a9e30/href">https://medium.com/media/9ee7d0662f095fa47d4a0733fe1a9e30/href</a></iframe><p>In line 12, we take the softmax of the attention tensor. As long as the computation takes place, the memory of the previous tensor cannot be freed, requiring, at peak, double the amount of memory. To avoid this effect, we could compute it row by row, but that would greatly increase the time it takes.</p><p>Additionally, GPU memory is made of a small-but-fast memory unit called Static Random Access Memory (SRAM), and a larger-but-slower memory unit called High Bandwidth Memory (HBM). Both of the aforementioned tensors cannot fit wholly in SRAM, and most of the time is spent not on the computations themselves, but on moving them from HBM to SRAM to perform computations and back. This is inefficient — ideally, we would move them once, perform all computations and then move them back. This is called Operator Fusion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yhMZ_Kp81llyCwxB" /><figcaption><strong>Copyrights for all images in this post belong to the paper’s authors</strong></figcaption></figure><h3>Enter FlashAttention</h3><p>FlashAttention is a hardware-aware implementation of Attention. That means it produces exactly the same results as the vanilla implementation, but does so in a way that reduces overheads such as the ones above.</p><p>To achieve those savings, the authors use a couple of methods:</p><p><strong>Tiling<br></strong>Instead of repeatedly copying memory from HBM to SRAM and back, FlashAttention divides the memory into blocks and fully computes the attention equation on each. This means that we only have to move this memory once from HBM, instead of over and over from HBM to SRAM and back at each step of the computation. While the matrix multiplication can naturally factorize into blocks, the softmax is slightly more tricky and requires storing additional summary statistics for the normalization. Computing the final result in blocks means we never have to create large NxN matrices, removing the need for scaling memory quadratically and saving tons of memory.</p><p><strong>Recomputation<br></strong>Some of the values computed during the forward pass are needed again for the backward computation. The straightforward solution would be to store them during the forward pass and fetch them again. However, it turns out that discarding them at the end of the forward pass and then re-calculating on-demand during the backward pass is cheaper. The memory transfer of the large attention tensor from HBM is much slower than computation on the values that are already in the SRAM. If this sounds familiar, this is exactly what you’d see in Activation Checkpointing, which you can read more about in <a href="https://medium.com/pytorch/how-activation-checkpointing-enables-scaling-up-training-deep-learning-models-7a93ae01ff2d">this post</a>.</p><p>Additionally, the fact that this whole building block is wrapped into a single CUDA kernel reduces the overhead. The time spent running Python/Torch code is minimized and most of the time is spent running a single kernel on the GPU.</p><p>In the end, this is exposed to the user as a Python module/function.</p><h3>Putting FlashAttention to Work</h3><p>If you’re using newer versions of PyTorch you’re in luck — since PyTorch 2.0, FlashAttention is already incorporated into the scaled_dot_product_attention function and will be chosen <a href="https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention.html#torch.nn.functional.scaled_dot_product_attention">when applicable</a>, and since PyTorch 2.2, Flash Attention 2 is built in too. So if you have not yet recently upgraded your PyTorch installation, this might be a good reason to do it. Other libraries such as <a href="https://github.com/huggingface/pytorch-image-models">timm</a> and <a href="https://github.com/huggingface/transformers">transformers</a> are gradually adding support for it for all models too.</p><p>If you need to use older versions of PyTorch or just want to work with the source, use <a href="https://github.com/Dao-AILab/flash-attention">the official implementation</a>. It has a couple of other types of attention types too and is worth checking out.</p><p>The gains we will see in practice depend on many factors such as sequence length, model architecture and GPU type. Here for example are some of the speed improvements reported by the authors on an NVIDIA A100:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Fkrk80RveIwQAe09" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZAc06e96RyiuOtdf" /></figure><p>As we can see, using FlashAttention greatly improves both the speed and memory usage, hardly requiring any changes to the code. Importantly, such a large reduction in the memory footprint allows using cheaper GPUs, which might be more readily available, to train the same models.</p><h3><strong>Final </strong>Thoughts</h3><p>While it is very encouraging that the implementation is a free improvement, it does come with some obvious yet important caveats.</p><p>First, you can’t easily introduce modifications to the implementation yourself, such as other modes of attention.</p><p>Second, as the implementation is a CUDA kernel and fairly new, you might run into bugs, especially when using new hardware <a href="https://github.com/pytorch/pytorch/issues/104766">like we did</a>. An implementation needs to be written and compiled specifically for your hardware — which might limit you if you need to use old or exotic hardware.</p><p>For additional reading, see the <a href="https://arxiv.org/abs/2205.14135">original paper</a>. You might also be interested in further work such as <a href="https://arxiv.org/abs/2307.08691">FlashAttention2</a> and <a href="https://vllm.ai/">PagedAttention</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d8c22c68838" width="1" height="1" alt=""><hr><p><a href="https://medium.com/theator/how-flashattention-enables-scaling-up-training-and-inference-with-zero-cost-5d8c22c68838">How FlashAttention enables scaling up training and inference with zero cost</a> was originally published in <a href="https://medium.com/theator">Theator Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Consolidating AI Performance Measurement in Production]]></title>
            <link>https://medium.com/theator/consolidating-ai-performance-measurement-in-production-8e3605328999?source=rss----d93a4883f66d---4</link>
            <guid isPermaLink="false">https://medium.com/p/8e3605328999</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[metrics-and-analytics]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[error-analysis]]></category>
            <category><![CDATA[metrics]]></category>
            <dc:creator><![CDATA[Omri Bar]]></dc:creator>
            <pubDate>Sun, 03 Mar 2024 10:09:18 GMT</pubDate>
            <atom:updated>2024-03-03T10:09:18.633Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Embracing a Single Holistic Metric</strong></h4><p>This blog post is all about metrics. Metrics are key to a successful machine learning (ML) project. Success is tricky to measure, as outperforming state-of-the-art in an interesting benchmark or publishing a paper on a new method you developed are significant success milestones. But in the scope of this post, I mean a project that reaches the production environment and impacts users in a meaningful way.</p><p>The main takeaway I will try to convey is that metrics used during development phases might not be an optimal representation of production performance. I will also suggest a more consolidated and streamlined approach to quantifying the impact of an ML system on the users in the production environment.</p><p>The transition to a single holistic metric discussed in this blog post is mainly suited to a system that provides many prediction outputs for each input sample, as this case raises a complex environment for measuring the end performance.</p><h3>So what is the problem with the metrics I know and love?</h3><p>When starting to work on a machine learning project, we usually begin with defining the project goal and determining what we want to achieve by setting the main key performance indicators (KPIs). With this goal in mind, we can start exploring two main components of a new problem: <em>what data do I need?</em> and <em>what metrics should I use?</em></p><p>Focusing on metrics, we can roughly state that each machine learning task usually requires 1–3 main measurements of success. Those metrics will be the lighthouse for the researcher to optimize on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pvGHYZUgPmwLfVAF6tJTYw.jpeg" /><figcaption>Image created by <a href="https://clipdrop.co/stable-diffusion">Stable Diffusion</a></figcaption></figure><p>However, lighthouse metrics can be confusing and lead to different research directions. For example, a standard metric in classification problems is accuracy. But during training as part of the back propagation process, a loss function, such as <a href="https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html">cross-entropy loss</a>, is used to adjust the model weights based on gradient information. Now is cross-entropy always a good proxy correlated to accuracy?</p><p>The byproduct of this process yields a model that can operate — at best — on a specific dev dataset in a somewhat sterilized dev environment.</p><p>Note to avoid confusion, I’m not referring directly to a generalization or overfitting issue, as these can be measured and tackled, but more to how a model will act in production when <em>in-the-wild</em> scenarios occur.</p><p>Now let’s consider a complex ML-based system built in a chain manner, particularly in cases when one model’s output is the input of one or many other models. In this setup, the system can fail if one part of the chain fails. This is not a failure as in raising an error, but a failure mode in the quality of the end results. Such degradation impacts the end-user experience in a way that is hard to measure using commonly used metrics.</p><p>With this in mind, I would like to show how to transition to a single holistic metric, called an <em>impact metric</em>, that represents the end performance of your entire AI system as viewed by your designated users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y9LE88rCn0Y5Znz34Es8cg.png" /></figure><h3>Learning by example</h3><p>In order to dive into the impact metric development, I need an example of data and related annotations. I’ll use the following example of data and annotations structure:</p><p>Given a video as input, a team of annotators review the video and tag/mark specific key moments based on designated instructions.</p><p>A single action annotation uses a structure of three elements: [action type, start time, end time]. That is, classifying the action into a specific type while marking its start and end times (in seconds).</p><p>For example, in the following two videos, taken from the <a href="https://arxiv.org/abs/1705.06950v1">Kinetics 400 Dataset</a>, the expected annotations are [throwing_discus, 6, 8] and [throwing_discus, 0, 2].</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FeRJbvUAjsNA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DeRJbvUAjsNA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FeRJbvUAjsNA%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e86158b94689a9286500fd508789d188/href">https://medium.com/media/e86158b94689a9286500fd508789d188/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F5_CCNGezogo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5_CCNGezogo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F5_CCNGezogo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ef28e88a638ef3e3a8a5b6bddd29d9e6/href">https://medium.com/media/ef28e88a638ef3e3a8a5b6bddd29d9e6/href</a></iframe><p>Note that although this is a relatively specific example common in video understanding tasks, the same paradigm works in any setting and setup you might have in your domain, whether video-related or not, as long as the system provides multiple predictions for a given input.</p><p>Now imagine the process of manually annotating a large-scale dataset as described above using [type, start, end] and how lengthy this process would be. This would be even harder when handling videos with an extended duration, for example, in the case of self-driving cars, sports, or the <a href="https://www.nature.com/articles/s41598-020-79173-6">surgical domain</a>.</p><p>To expedite the annotation process and make it faster, more effective, cheaper, and scalable, a computer vision system can be developed to assist the annotators’ workflow. This system can predict these actions as an initial guess and the annotators can then review, fix, add, or delete. As the system improves over time, the entire annotation process can transition into an “only” validation process.</p><p>From a researcher’s point of view, during the development of the model, the focus would be on optimizing specific metrics such as <em>accuracy per second</em> or <em>mean average precision</em> (mAP) — but does this represent well enough the experience that annotators would have once this model is deployed?</p><h3>Developing a single holistic metric - <em>Impact Metric</em></h3><p>Our goal was to develop a metric that could digest two sets of inputs:<br>(1) annotations done manually by annotators and (2) the initial prediction of annotations done by the AI system.</p><p>For simplicity, consider the following two sets of input as an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/0*eQbQ-CT5YqNeWfgp" /></figure><p>Intuitively, we needed to measure how many changes the user made over the AI’s initial predictions and find a way to quantify each type of change. Let’s say that only adjusting an annotation’s end time (1st row above) is less ‘severe’ than deleting a complete annotation that is wrong (4th row above). Also, adding a full annotation that the system missed requires much more manual work than just deleting an incorrect annotation.</p><p>To mimic the annotator’s work and quantify each adjustment, we used a proxy task that was in proportion to the number of clicks required to make adjustments. For example, a simple value <em>fix</em> would equal 1 penalty score. A <em>delete</em> would equal 2 penalty scores, and <em>adding</em> a new annotation would equal 3 penalty scores. Obviously, the penalty mapping depends a lot on your product and application.</p><h3>You’ve got a match!</h3><p>If we look at the example above, we can see that some annotations are of the same type with different timing (1), and some have the exact timing but a different type (2). A tricky point here is how to match pairs, one from each set of annotations (algo and manual), and measure the proper penalty.</p><p>To achieve this, we used the <a href="https://en.wikipedia.org/wiki/Hungarian_algorithm">Hungarian algorithm</a>: “a combinatorial optimization algorithm that solves the <a href="https://en.wikipedia.org/wiki/Assignment_problem">assignment problem</a>”. This <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.linear_sum_assignment.html">method</a> solves the matching problem using bipartite graphs.</p><p>We first needed to define three cost matrices:</p><ul><li>C_type - a cost matrix for the <strong>type</strong> value - a binary matrix with 1 when the type was equal between algo and manual</li><li>C_start - a cost matrix for the <strong>start</strong> value - the absolute difference between the start times of all algo vs. manual (normalized by the video duration)</li><li>C_end - a cost matrix for the <strong>end</strong> value - the absolute difference between the end times of all algo vs. manual (normalized by the video duration)</li></ul><p>For the two sets in the example above, the resultant cost matrices were:</p><pre>C_type = [[0 1 0]<br>          [0 1 0]<br>          [1 1 1]<br>          [0 1 0]]<br>C_start = [[ 0. 7. 16.]<br>           [ 7. 0. 9.]<br>           [16. 9. 0.]<br>           [20. 13. 4.]]<br>C_end = [[ 1. 9. 17.]<br>         [ 8. 0. 8.]<br>         [15. 7. 1.]<br>         [21. 13. 5.]]</pre><p>The final cost matrix was the weighted sum of these three matrices:<br>C = W_type * C_type + W_start * C_start + W_end * C_end<br>where each C[i,j] was the cost of matching <em>i</em> (algo) and <em>j</em> (manual), and all W’s are equal to 1.0.</p><p>Note that you can adjust the cost matrix definition and the weights depending on what is more important in your application.</p><p>Once we had the final cost matrix, the Hungarian algorithm’s goal was to find a complete assignment of algo to the manual. Such assignments achieved minimal cost. Given the matched pairs, we could start accumulating the penalty values:</p><ul><li>For the ones that had a pair - checking the penalty score of <strong>fixes</strong></li><li>For those without a pair in an algo set - treating it as a <strong>delete</strong> penalty</li><li>For those without a pair in a manual set - treating it as an <strong>add</strong> penalty</li></ul><p>Summing up all the penalties gave us the <em>penalty score</em>.</p><h3>Bear with me; we’re almost there</h3><p>Ok, so we had a penalty score, but what does it mean?</p><p>A perfect score is achieved if zero mistakes are made and manual annotations equal algo results. But how should we consider this value and compare different samples that have a different number of annotations?</p><p>To solve this, we also measured the ‘amount’ of work needed if the ML system didn’t provide any initial guess. Let’s call this value the <em>scratch score</em>.</p><p>Dividing the <em>penalty score</em> by the <em>scratch score </em>yielded the final impact metric value:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*v71f2w7lLzrohp8jNof9GA.png" /></figure><p>Now, this final score is a very valuable measurement of our models ‘impact’ on users in production:</p><ul><li><em>impact metric</em> &gt; 1 means AI is only interfering in the work process, as more changes were needed than doing this sample from scratch.</li><li>0 &lt; <em>impact metric</em> &lt; 1 means AI provides value and help, as some changes were needed to adjust algo results but less than doing this sample from scratch.</li><li><em>impact metric</em> = 0 means a perfect match between all algo and manual annotations.</li></ul><h3>Final note: The impact metric for error analysis at a large scale</h3><p>The impact metric results are a good proxy for hunting down problems in the data or annotations. Extreme values that are out of distribution can imply something is wrong with a specific sample or its annotations. It can also help to maintain a data engine loop by surfacing hard or more important samples that can help improve the model’s main failure modes.</p><p>At scale, accumulating the impact metric values over large data can be meaningful in analyzing and understating the system’s performance. Using these results as part of the system error analysis can shed light on the main issues that interpret the annotations process or users’ experience. In addition, periodic impact metric analysis on a known fixed subset of the data can act as a gatekeeper as part of the CD process, similar to how regression tests are used to evaluate new models before deploying them to production.</p><p>Transitioning from focusing on many specific machine learning task metrics to a single holistic measurement allows a unified evaluation of AI performance in production, making it easier to track and assess overall success and overall impact on the system’s end user. Such a transition is not always trivial but contributes significantly to many aspects of the organization, from the individual researcher to end users.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e3605328999" width="1" height="1" alt=""><hr><p><a href="https://medium.com/theator/consolidating-ai-performance-measurement-in-production-8e3605328999">Consolidating AI Performance Measurement in Production</a> was originally published in <a href="https://medium.com/theator">Theator Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Theator Uses NVIDIA Clara AGX to Develop Surgical Analytics]]></title>
            <link>https://medium.com/theator/theator-uses-nvidia-clara-agx-to-develop-surgical-analytics-ffa56b370666?source=rss----d93a4883f66d---4</link>
            <guid isPermaLink="false">https://medium.com/p/ffa56b370666</guid>
            <category><![CDATA[theator]]></category>
            <category><![CDATA[surgery]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[nvidia]]></category>
            <category><![CDATA[gpu]]></category>
            <dc:creator><![CDATA[Dotan]]></dc:creator>
            <pubDate>Mon, 12 Apr 2021 17:57:37 GMT</pubDate>
            <atom:updated>2021-04-12T18:21:32.017Z</atom:updated>
            <content:encoded><![CDATA[<p>In recent years the healthcare industry has applied data analytics to offer higher quality care to patients, but one area that hasn’t yet caught up is the operating room (OR).</p><p>Hospitals and surgeons need better training models, access to experts, and data-based decision-making to level the field and decrease surgical outcome variability — and data analytics and artificial intelligence can help. Hospitals and healthcare systems already sit on tremendous troves of data that, if utilized correctly, can enable more accurate decision-making in the OR and during pre-and post-op treatments. The potential is there, but a major issue still remains — what happens in the OR basically stays in the OR. Intraoperative recordings are not yet mainstream, though we seem to be heading in that direction. But even if you have access to surgical video, it’s a formidable challenge to analyze each video frame by frame to annotate and render them useful for surgeons. The computing power required goes beyond the standard existing capabilities which today’s healthcare organizations possess and requires specialized software expertise for its successful implementation.</p><p>At Theator, we are harnessing the latest trends and technologies in the AI and computer vision space to fill these critical gaps. We look forward to using the <a href="https://developer.nvidia.com/clara-agx-devkit">NVIDIA Clara AGX developer kit</a> to support our platform as we grow and develop.</p><p>Advanced computer vision techniques enable us to implement precise<a href="https://www.nature.com/articles/s41598-020-79173-6.epdf?sharing_token=57pWgB367cI5coHzkZUDR9RgN0jAjWel9jnR3ZoTv0MCV8TIltOg1hyPQGUx3RpjykRBW7tAmqhJCZlzxL0s2NSSWKMZpEM3UFO4sTQKqx7neUFX9oBn_x6p5BDC04YK7SP82L6tnjqWQ_lomdL75_4pkUeZjpjF_9ZzkYi6Fhg%3D"> surgical phase recognition</a>, which can discern relatively small differences throughout operational footage and significantly enhance the quality of surgical reviews. A hybrid AI system processes footage using a hybrid AI system that runs on GPU-powered on-premises edge devices and then uploads it to Theator’s cloud-based library, one of the world’s largest collections of annotated surgical video data, containing more than 10,000 hours of curated surgical video. We apply algorithmic capabilities to create a holistic Surgical Intelligence offering which not only captures surgical steps, events, safety milestones, and complexity levels but also analyzes correlations between operations.</p><p>Our technology can index large-scale surgical datasets with an accuracy rate vastly exceeding that of similar platforms. This creates a practical function for the near-limitless amounts of surgical video footage, which are recorded in the operating room but often remain largely siloed as individual surgeons or departments cannot be expected to analyze and organize this material at scale. Our platform collects insights and conducts edge analytics at scale to tag a large volume of surgeries frame by frame, a process enhanced by Theator’s<a href="https://arxiv.org/abs/2102.00719"> Video Transformer Network (VTN)</a>, a pioneer transformer-based framework in video action recognition. The VTN generates significantly reduced training runtime (16.1X) and an accelerated inference process (5.1X) while maintaining accuracy levels when compared to competitors.</p><p>The advancements that <a href="https://blogs.nvidia.com/blog/2021/04/12/carestream-health-startups-ai-instruments-clara-agx/">NVIDIA Clara AGX</a> offers the medical space are both impressive and necessary. Clara AGX increases efficiency in products and tools being used by people worldwide, remotely or otherwise. Real-time AI and advanced images, videos, and signal processing are essential to improving patient care and therefore saving lives. Securely orchestrating AI application deployments to fleets of medical devices or edge nodes will allow healthcare providers to rely on their equipment more easily and focus more heavily on developing treatment plans or diagnoses, also made more efficient by the implementation of AI.</p><p>To learn more about AI startups revolutionizing healthcare, join <a href="https://www.nvidia.com/en-us/deep-learning-ai/startups/">NVIDIA Inception</a> and me at the <a href="https://www.nvidia.com/en-us/gtc/">NVIDIA GPU Technology Conference</a> on Monday, April 12th, at 10:00 a.m. PDT.</p><p>- <em>Dotan Asselmann, CTO and Co-Founder,</em><a href="https://theator.io/"><em> Theator</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffa56b370666" width="1" height="1" alt=""><hr><p><a href="https://medium.com/theator/theator-uses-nvidia-clara-agx-to-develop-surgical-analytics-ffa56b370666">Theator Uses NVIDIA Clara AGX to Develop Surgical Analytics</a> was originally published in <a href="https://medium.com/theator">Theator Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>