<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Satwik Sai Prakash Sahoo</title>
    <description>The latest articles on DEV Community by Satwik Sai Prakash Sahoo (@satwiksps).</description>
    <link>https://dev.to/satwiksps</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3961574%2Fc4fb0477-7b62-40cb-acfb-060625f7a454.jpeg</url>
      <title>DEV Community: Satwik Sai Prakash Sahoo</title>
      <link>https://dev.to/satwiksps</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/satwiksps"/>
    <language>en</language>
    <item>
      <title>Merging My First PR for GSoC!</title>
      <dc:creator>Satwik Sai Prakash Sahoo</dc:creator>
      <pubDate>Mon, 15 Jun 2026 13:12:48 +0000</pubDate>
      <link>https://dev.to/satwiksps/merging-my-first-pr-for-gsoc-542h</link>
      <guid>https://dev.to/satwiksps/merging-my-first-pr-for-gsoc-542h</guid>
      <description>&lt;p&gt;Hey everyone! The official coding period for Google Summer of Code (GSoC) has begun, and I am thrilled to share that my very first Pull Request (PR) for the &lt;strong&gt;sbi&lt;/strong&gt; (Simulation-Based Inference) repository has been officially merged! &lt;/p&gt;

&lt;p&gt;These first two weeks have been packed with writing code, writing tests, and most importantly, going through an incredibly insightful code review process with my mentors. &lt;/p&gt;

&lt;p&gt;Here is a breakdown of what I worked on, the technical challenges I faced, and the best practices I learned along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Laying the Foundation (&lt;a href="https://github.com/sbi-dev/sbi/pull/1872" rel="noopener noreferrer"&gt;PR #1872&lt;/a&gt;)
&lt;/h2&gt;

&lt;p&gt;My GSoC project is focused on refactoring the Neural Network (NN) Builder API. Before we can build the new, shiny network builders, we need a solid foundation. This first PR was all about setting up the necessary data structures and renaming existing protocols to make room for the new architecture.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The New &lt;code&gt;build_context.py&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;I created a new file to house the core pieces needed to set up a neural network. This centralizes how the data is prepared before it hits the network:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ZScoreConfig&lt;/code&gt;&lt;/strong&gt;: Tracks how the user wants to preprocess data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ZScoreStats&lt;/code&gt;&lt;/strong&gt;: Holds the calculated mean and standard deviation for the data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;BuildContext&lt;/code&gt;&lt;/strong&gt;: Bundles everything required to build a network (shapes, device, dtype, and z-score stats) into a single, clean dataclass.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;compute_z_score_stats()&lt;/code&gt;&lt;/strong&gt;: A helper function to calculate these statistics directly from the training tensors.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Clearing the Naming Space
&lt;/h3&gt;

&lt;p&gt;To make the codebase more intuitive, I had to rename a few core components across 16 different trainer files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Changed &lt;code&gt;ConditionalEstimatorBuilder&lt;/code&gt; to &lt;code&gt;ConditionalEstimatorBuildFn&lt;/code&gt;. This clarifies that the protocol is actually a function, not an object, and frees up the "Builder" name for upcoming classes.&lt;/li&gt;
&lt;li&gt;Changed &lt;code&gt;_EstimatorConfigBase&lt;/code&gt; to &lt;code&gt;_EstimatorBuilderBase&lt;/code&gt;, giving it an empty &lt;code&gt;build()&lt;/code&gt; method to prepare for the next phase.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Big Takeaways from Code Review
&lt;/h2&gt;

&lt;p&gt;Getting the code working was only half the battle. The review process with my mentor, taught me several advanced Python and PyTorch practices. &lt;/p&gt;

&lt;h3&gt;
  
  
  Managing Tensor Devices
&lt;/h3&gt;

&lt;p&gt;When creating the &lt;code&gt;BuildContext&lt;/code&gt;, the data (&lt;code&gt;x&lt;/code&gt; and &lt;code&gt;theta&lt;/code&gt;) are passed in as PyTorch tensors. My mentor pointed out that if &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;theta&lt;/code&gt; accidentally end up on different devices (e.g., one on CPU, one on GPU), it will cause runtime failures. I updated the code to explicitly check that both tensors share the same device and added GPU-specific pytest runs to ensure everything handles device placement gracefully.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dataclasses and Tensor Equality
&lt;/h3&gt;

&lt;p&gt;I originally set up my statistics classes as &lt;code&gt;@dataclass(frozen=True)&lt;/code&gt;. However, because they hold PyTorch tensors, this creates a subtle bug. PyTorch's implementation of equality (&lt;code&gt;==&lt;/code&gt;) for tensors returns a boolean tensor, not a single boolean value, which breaks the dataclass equality checks. &lt;/p&gt;

&lt;p&gt;The fix was simple but crucial:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@dataclass&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frozen&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;eq&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ZScoreStats&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;theta_mean&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Tensor&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
    &lt;span class="n"&gt;theta_std&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Tensor&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
    &lt;span class="n"&gt;x_mean&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Tensor&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
    &lt;span class="n"&gt;x_std&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Optional&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Tensor&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By adding &lt;code&gt;eq=False&lt;/code&gt;, equality becomes identity-based, completely bypassing the PyTorch tensor comparison crash.&lt;/p&gt;

&lt;h3&gt;
  
  
  Graceful Deprecation with PEP 562
&lt;/h3&gt;

&lt;p&gt;Since &lt;code&gt;ConditionalEstimatorBuilder&lt;/code&gt; was used by the community, we couldn't just delete the name and break everyone's code. Instead of leaving a dummy class, I learned how to use module-level &lt;code&gt;__getattr__&lt;/code&gt; to intercept the import and throw a &lt;code&gt;FutureWarning&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__getattr__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ConditionalEstimatorBuilder&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;warnings&lt;/span&gt;
        &lt;span class="n"&gt;warnings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;warn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;`ConditionalEstimatorBuilder` has been renamed to &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;`ConditionalEstimatorBuildFn`. The old name still works but will be &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;removed in a future release. Update your import to: &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
            &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;`from sbi.neural_nets.estimators.base import ConditionalEstimatorBuildFn`.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nb"&gt;FutureWarning&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;stacklevel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ConditionalEstimatorBuildFn&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;AttributeError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;module &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="si"&gt;!r}&lt;/span&gt;&lt;span class="s"&gt; has no attribute &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;!r}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Refactoring Tests
&lt;/h3&gt;

&lt;p&gt;I used Claude Opus to help generate initial test coverage for the new context types. It gave me class-based tests. However, the &lt;code&gt;sbi&lt;/code&gt; standard relies heavily on function-based tests and &lt;code&gt;pytest&lt;/code&gt; fixtures. I completely refactored the test suite to use &lt;code&gt;@pytest.mark.parametrize&lt;/code&gt; to test valid combinations of inputs, ensuring maximum coverage with minimal, highly readable code.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;With the foundation types successfully merged into the &lt;code&gt;gsoc-2026&lt;/code&gt; branch, the groundwork is officially laid out! Up next is &lt;a href="https://github.com/sbi-dev/sbi/pull/1877" rel="noopener noreferrer"&gt;PR #1877&lt;/a&gt;, where I will be adding the actual &lt;code&gt;DensityEstimatorBuilder&lt;/code&gt; with dynamic &lt;code&gt;build()&lt;/code&gt; dispatching.&lt;/p&gt;

&lt;p&gt;Stay tuned for week 3 and 4 updates!&lt;/p&gt;

</description>
      <category>gsoc</category>
      <category>ai</category>
      <category>python</category>
      <category>opensource</category>
    </item>
    <item>
      <title>GSoC Community Bonding Period: Getting Ready to Code</title>
      <dc:creator>Satwik Sai Prakash Sahoo</dc:creator>
      <pubDate>Thu, 04 Jun 2026 06:51:17 +0000</pubDate>
      <link>https://dev.to/satwiksps/gsoc-community-bonding-period-getting-ready-to-code-5hl9</link>
      <guid>https://dev.to/satwiksps/gsoc-community-bonding-period-getting-ready-to-code-5hl9</guid>
      <description>&lt;p&gt;Hey everyone! Welcome back to my Google Summer of Code (GSoC) journey.&lt;/p&gt;

&lt;p&gt;In my last post, I shared the story of how I got into open source and was selected for GSoC with NumFOCUS to work on the &lt;strong&gt;&lt;a href="https://summerofcode.withgoogle.com/programs/2026/projects/P5QOhl9F" rel="noopener noreferrer"&gt;Neural Network Builder API Refactor&lt;/a&gt;&lt;/strong&gt; project for &lt;strong&gt;sbi&lt;/strong&gt; (Simulation-Based Inference).&lt;/p&gt;

&lt;p&gt;Since the official announcement, the past three weeks have been dedicated to the &lt;strong&gt;Community Bonding Period&lt;/strong&gt;. It is designed to help contributors get to know their mentors, understand the community culture, and familiarize themselves with the codebase and tools.&lt;/p&gt;

&lt;p&gt;Here is exactly what I did during these past three weeks to get ready for the main coding phase!&lt;/p&gt;

&lt;h2&gt;
  
  
  The Kickoff Meeting
&lt;/h2&gt;

&lt;p&gt;We started the bonding period with a great kickoff call on Google Meet. It was a joint meeting that included the mentors for both of the selected sbi projects, the selected GSoC candidates. We were also joined by the mentee who successfully completed the GSoC project for sbi last year!&lt;/p&gt;

&lt;p&gt;Everyone introduced themselves, and it was incredibly inspiring to meet the team face-to-face (virtually!) and hear about everyone's backgrounds. Having a former GSoC student there was a huge bonus, as they shared some great insights into what to expect in the coming months.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up the Machine
&lt;/h2&gt;

&lt;p&gt;A big part of getting started is making sure the development environment is properly configured. During our meetings, we discussed the machine setup in detail to ensure both candidates had everything required to run and test the sbi codebase locally without any hiccups.&lt;/p&gt;

&lt;h2&gt;
  
  
  Embracing AI Coding Assistants
&lt;/h2&gt;

&lt;p&gt;One of the most interesting discussions we had was about using AI coding assistants. In the modern development world, tools like these are becoming standard, and our mentors actually encouraged us to use them!&lt;/p&gt;

&lt;p&gt;However, they emphasized using them carefully and strictly following project guidelines. To help us get the most out of these tools without compromising code quality, the mentors shared some excellent Claude code tutorials and provided us with resources to level up our AI coding skills. It is all about using AI to augment our capabilities, not to blindly write code for us.&lt;/p&gt;

&lt;h2&gt;
  
  
  Diving into the Codebase and Planning
&lt;/h2&gt;

&lt;p&gt;With the setup out of the way, the rest of the three weeks was all about reading. I spent a lot of time diving deep into the sbi codebase and reading through the documentation properly.&lt;/p&gt;

&lt;p&gt;Understanding the architecture is critical for my API refactor project. To keep everything organized and on track, we were provided with a &lt;code&gt;plan.md&lt;/code&gt; file. This document serves as our roadmap, outlining exactly what needs to be tackled, the skills required, and the milestones we need to hit.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;The community bonding period was incredibly helpful. It gave me the time to get comfortable with the team, set up my workflow, and build a solid foundation before the heavy lifting begins.&lt;/p&gt;

&lt;p&gt;Now, the official coding phase is here! I am beyond excited to start pushing commits and working on the Neural Network Builder API Refactor.&lt;/p&gt;

&lt;p&gt;Thanks for reading, and stay tuned. I will be sharing more technical updates and lessons learned as I start writing code for GSoC!&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>gsoc</category>
      <category>machinelearning</category>
      <category>python</category>
    </item>
    <item>
      <title>How I Got Selected for GSoC: My Journey with sbi</title>
      <dc:creator>Satwik Sai Prakash Sahoo</dc:creator>
      <pubDate>Sun, 31 May 2026 19:55:27 +0000</pubDate>
      <link>https://dev.to/satwiksps/how-i-got-selected-for-gsoc-my-journey-with-sbi-56g5</link>
      <guid>https://dev.to/satwiksps/how-i-got-selected-for-gsoc-my-journey-with-sbi-56g5</guid>
      <description>&lt;p&gt;Hey everyone! I am super excited to share that I have been selected for &lt;strong&gt;Google Summer of Code (GSoC)&lt;/strong&gt; with &lt;strong&gt;NumFOCUS&lt;/strong&gt;. I will be working on the &lt;strong&gt;&lt;a href="https://summerofcode.withgoogle.com/programs/2026/projects/P5QOhl9F" rel="noopener noreferrer"&gt;Neural Network Builder API Refactor&lt;/a&gt;&lt;/strong&gt; project for the organization &lt;strong&gt;sbi (Simulation-Based Inference)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you are wondering how to get started with open source or what the GSoC process is really like, here is the story of how I got here. Stay tuned, because I will keep updating you on my GSoC journey and sharing my experiences as I get deeper into the project!&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Started Open Source
&lt;/h2&gt;

&lt;p&gt;Being a fan of Linus Torvalds, I was always fascinated by open source. Also, I wanted to test my coding skills. I wanted to know: &lt;em&gt;Is my code actually good enough for the real world?&lt;/em&gt; In my first year of college, I spent a lot of time doing competitive programming. At the same time, I was teaching myself machine learning and mathematics, working mostly with Python and PyTorch. &lt;/p&gt;

&lt;h2&gt;
  
  
  Finding the Right Project
&lt;/h2&gt;

&lt;p&gt;When I decided to try open source, I wanted to find an organization that actually matched what I was learning. Because I was already into machine learning and PyTorch, I went looking for something in that space.&lt;/p&gt;

&lt;p&gt;That is how I found &lt;strong&gt;sbi&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Making my first Pull Request (PR) was a little scary, but the maintainers at sbi were incredibly welcoming. They patiently guided me through my early, beginner-level PRs. Thanks to their feedback, I learned so much about how to write clean, high-quality code. &lt;/p&gt;

&lt;h2&gt;
  
  
  The GSoC Surprise
&lt;/h2&gt;

&lt;p&gt;After a few months of fixing bugs and contributing, I found out from the maintainers that sbi would be participating in GSoC this year. They encouraged me and appreciated the work I had done over the past few months, for which I will be forever grateful.&lt;/p&gt;

&lt;p&gt;But there was one problem: I hadn't researched GSoC at all. I had no idea what the requirements were or how to write a project proposal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Help with the Proposal
&lt;/h2&gt;

&lt;p&gt;Writing the proposal was tough since it was my first time. Luckily, I didn't have to do it alone. &lt;/p&gt;

&lt;p&gt;The maintainers also stepped up to mentor me. They reviewed my proposal drafts, gave me detailed feedback, and helped me improve it step by step until it was ready.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;All that hard work and community support paid off, and I got accepted! &lt;/p&gt;

&lt;p&gt;The GSoC community bonding period just finished up. In my next blog post, I will share exactly what I did during this bonding period to get ready for the main coding phase. &lt;/p&gt;

&lt;p&gt;Thanks for reading, and stay tuned!&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>github</category>
      <category>google</category>
      <category>gsoc</category>
    </item>
  </channel>
</rss>
