<?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>Forem: Michał</title>
    <description>The latest articles on Forem by Michał (@rebuss).</description>
    <link>https://forem.com/rebuss</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2572969%2F323f2a5f-d606-45c2-9881-1e5e3a0b25b8.png</url>
      <title>Forem: Michał</title>
      <link>https://forem.com/rebuss</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/rebuss"/>
    <language>en</language>
    <item>
      <title>From Writing Code to Writing Prompts</title>
      <dc:creator>Michał</dc:creator>
      <pubDate>Tue, 10 Mar 2026 13:32:24 +0000</pubDate>
      <link>https://forem.com/rebuss/from-writing-code-to-writing-prompts-2d4k</link>
      <guid>https://forem.com/rebuss/from-writing-code-to-writing-prompts-2d4k</guid>
      <description>&lt;p&gt;Not long ago, most of my working day was spent writing code.&lt;/p&gt;

&lt;p&gt;Today, a large part of it is spent writing… prompts.&lt;/p&gt;

&lt;p&gt;Ever since AI appeared in programming, I’ve been a big supporter of it. At first, it was mostly simple features like autocomplete, suggesting more or less accurately what I needed. Then came generating unit tests, writing simple functions through an agent, and similar things.&lt;/p&gt;

&lt;p&gt;On a daily basis I work with a solution that contains hundreds of projects, each with hundreds of source files. Some of those files are hardcore legacy code, often thousands of lines long. Because of that, I started using AI for a new kind of task — describing what a given class or project actually does, or locating places in the code that might interest me so I can inject my own implementation.&lt;/p&gt;

&lt;p&gt;Today I catch myself mainly writing prompts rather than code. I review the output produced by AI, and if I modify it, it’s usually just a few lines. The actual implementation mostly comes down to writing the prompt correctly, which an agent can then implement much faster than I could myself.&lt;/p&gt;

&lt;p&gt;My role is to review the results, test the changes manually, and sometimes write one or two additional prompts that slightly adjust the solution. I rarely need to write code if I have good instructions and I know what I want.&lt;/p&gt;

&lt;p&gt;When it comes to code review, it often means reading a report generated by AI, approving a few remarks that are actually relevant to the project, and rejecting the rest. Then I jump on a call with a colleague and we discuss some of the details.&lt;/p&gt;

&lt;p&gt;AI has had a significant impact on the way I work. I now spend much more time thinking about how something should work before implementing it. More time on conceptual work. Of course, part of it might simply be professional maturity that comes with experience. In the past I would just start writing code and modify it along the way. Today it’s quite satisfying to delegate the implementation itself to artificial intelligence and get a result within a few or a dozen minutes.&lt;/p&gt;

&lt;p&gt;The transition from one way of working to another was completely smooth. It wasn’t an “aha” moment or an overnight switch. Over time I simply started using it more and more, building new tools that automate parts of my workflow. At some point I realized that I had moved from being a Senior .NET Developer to something closer to a Senior Prompt Engineer :D&lt;/p&gt;

&lt;p&gt;A few things definitely contributed to that shift. MCP certainly played a big role. But beyond the different factors that make AI genuinely useful and capable of doing real work, I see a big difference in the way prompts themselves are written.&lt;/p&gt;

&lt;p&gt;The foundation of the AI world is the prompt.&lt;/p&gt;

&lt;p&gt;At the beginning I talked to AI almost like I would talk to a colleague at work, giving it plenty of room to guess and interpret what I meant. Today, every prompt that instructs AI to generate code is created with the help of a dedicated agent designed specifically for that purpose. In its own way, it keeps the more “creative” tendencies or hallucinations in check.&lt;/p&gt;

&lt;p&gt;With this approach, GitHub Copilot has a much harder time drifting away from the path I want it to follow. It stopped adding code in classes I have no intention of modifying, it gets lost less often, and it’s much easier for me to land on a good solution almost immediately.&lt;/p&gt;

&lt;p&gt;What still feels a bit annoying is the manual flow. It usually means talking to one agent that generates a prompt, then copy-pasting it into another one, and so on. Often the first agent needs a fairly extensive description of the task’s context — something that theoretically AI could just read on its own.&lt;/p&gt;

&lt;p&gt;My goal is to connect everything into a single flow: writing everything in the Copilot window inside Visual Studio, where it would be instructed to transform my input into a well-structured, professional prompt that I would only need to approve.&lt;/p&gt;

&lt;p&gt;Maybe after working like this for some time I’ll eventually reach a point where I can trust the implementation plan proposed by AI from the very beginning.&lt;/p&gt;

&lt;p&gt;The difference between prompts I write myself and those created by an agent is quite significant. The agent often adds various warnings and instructions: what the coding agent should not do and what it should do. It lays everything out clearly, step by step.&lt;/p&gt;

&lt;p&gt;For me, most of these things usually seemed obvious. I simply don’t have the habit of writing instructions that precisely. Because of that, I often ended up going down the wrong path — AI would follow a direction different from the one I intended.&lt;/p&gt;

&lt;p&gt;Today, what I bring into this workflow is direction. Decision-making. Connecting solutions within a broader context. I need to know what I want. And in the end, validation of results and evaluation of what actually makes sense.&lt;/p&gt;

&lt;p&gt;Statistically, I usually close an implementation within a few iterations. Sometimes fewer, sometimes more. The more precisely I describe the task, the better the results. If I approach the planning carefully, or if the task itself is relatively simple, the implementation often finishes in a single iteration and I get exactly what I wanted.&lt;/p&gt;

&lt;p&gt;Now I’m going to say something that many people might disagree with — especially those who are strongly attached to the role of the expert.&lt;/p&gt;

&lt;p&gt;I have the impression that remembering various technical nuances is becoming less important. Copilot already has that knowledge built in.&lt;/p&gt;

&lt;p&gt;More and more I find myself thinking at a higher level — how to connect things, which algorithm or design pattern will solve a problem — rather than how exactly to implement something or which method to call.&lt;/p&gt;

&lt;p&gt;Even though this trend clearly moves toward the total automation of a developer’s work, for now I’m not particularly worried about AI replacing me.&lt;/p&gt;

&lt;p&gt;I use it a lot, and I see how much effort still goes into guiding it properly and how precisely I need to explain the expected outcome.&lt;/p&gt;

&lt;p&gt;Without that — at least for now — AI struggles when it comes to working in large organizations and massive codebases.&lt;/p&gt;

&lt;p&gt;Maybe at some point in the future I’ll revise that opinion.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>githubcopilot</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>GitHub and SeaGOAT: A Quick Guide to Code Search Solutions</title>
      <dc:creator>Michał</dc:creator>
      <pubDate>Thu, 26 Dec 2024 12:02:57 +0000</pubDate>
      <link>https://forem.com/rebuss/github-and-seagoat-a-quick-guide-to-code-search-solutions-2820</link>
      <guid>https://forem.com/rebuss/github-and-seagoat-a-quick-guide-to-code-search-solutions-2820</guid>
      <description>&lt;p&gt;As a developer fascinated by artificial intelligence, I have embarked on a new journey to deepen my knowledge of NLP and the problem of code search. After a preliminary analysis of CodeBERT solutions, I remain skeptical as to whether a single AI model can generate embeddings that work equally well for both programming languages (PL) and natural languages (NL). These two domains differ vastly in semantics, with each following its own rules, deeply tied to their unique use cases.&lt;/p&gt;

&lt;p&gt;In this post, I want to share some of my thoughts and findings, particularly regarding open-source tools like &lt;a href="https://github.blog/ai-and-ml/machine-learning/towards-natural-language-semantic-code-search/" rel="noopener noreferrer"&gt;SeaGOAT&lt;/a&gt; and GitHub’s approach to code search as described in &lt;a href="https://github.blog/ai-and-ml/machine-learning/towards-natural-language-semantic-code-search" rel="noopener noreferrer"&gt;their blog&lt;/a&gt; and &lt;a href="https://wandb.ai/github/codesearchnet/benchmark" rel="noopener noreferrer"&gt;here&lt;/a&gt;. &lt;/p&gt;




&lt;h3&gt;
  
  
  A Look at SeaGOAT: Combining Simplicity with Functionality
&lt;/h3&gt;

&lt;p&gt;SeaGOAT is an open-source tool written in Python that employs two “engines” for code search. The first is &lt;code&gt;ripgrep&lt;/code&gt;, a traditional text-searching tool. In essence, it works by breaking a user’s query into individual words and then retrieving every line from the repository containing at least one of those words. The simplicity here is notable: it relies on the assumption that, for example, a function handling map rendering will likely include the word "map," which a user might also use in their search.&lt;/p&gt;

&lt;p&gt;The second mechanism is &lt;code&gt;chromadb&lt;/code&gt;, a database designed to store embeddings. SeaGOAT uses the &lt;code&gt;all-MiniLM-L6-v2&lt;/code&gt; model to generate these embeddings, which is the default model used by &lt;code&gt;chromadb&lt;/code&gt;. While this model performs well in generating vector representations, it wasn’t trained on code, and therein lies the problem. It faces the same semantic challenges I mentioned earlier: trying to generate consistent vector embeddings for both natural and programming languages. Because of this, I chose to skip further tests with SeaGOAT and instead turn my attention to GitHub’s approach.&lt;/p&gt;




&lt;h3&gt;
  
  
  GitHub’s Solution: A Two-Model System
&lt;/h3&gt;

&lt;p&gt;GitHub is a huge company that operates commercially, and the problem of code search is one of the most important challenges they have had to face. Initially, GitHub’s search relied on keyword matching—a straightforward approach similar to ripgrep. But their latest innovations present a much more nuanced solution.&lt;/p&gt;

&lt;p&gt;Their system uses two AI models in tandem:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The Documentation Model&lt;/strong&gt;: This model is trained on the task of generating documentation for code. It takes programming language (PL) as input and maps it into an embedding space tied to natural language (NL). &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;The Search Query Model&lt;/strong&gt;: This model is tuned to the same embedding space but works in the opposite direction. It takes natural language (NL) queries as input and generates embeddings in the same vector space as the documentation model.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The brilliance of this system lies in its duality. Both models process entirely different types of input, yet their outputs exist within the same semantic vector space. This allows for meaningful matches between user queries and code fragments, despite the inherent differences in the languages being processed.&lt;/p&gt;

&lt;p&gt;This approach, in my opinion, feels far more intuitive and semantically accurate than other solutions I’ve encountered. By allowing each model to specialize in its domain while sharing a unified embedding space, GitHub has created a system that respects the nuances of both natural and programming languages.&lt;/p&gt;




&lt;h3&gt;
  
  
  Closing Thoughts
&lt;/h3&gt;

&lt;p&gt;The more I explore, the more I realize the depth of the code search problem. While tools like SeaGOAT offer valuable insights, the sophistication of GitHub’s solution sets a high bar for others. Their two-model approach, bridging the gap between PL and NL, seems like a step in the right direction.&lt;/p&gt;

&lt;p&gt;As I continue my exploration, I’m eager to delve deeper into these dual-model architectures and understand how they might be adapted or extended for even more effective code search solutions.&lt;/p&gt;

&lt;p&gt;For now, this journey remains ongoing, and I’m grateful for the learning opportunities it provides. If you’ve worked on similar problems or have insights to share, I’d love to hear your thoughts in the comments below.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>codesearch</category>
      <category>github</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Exploring GraphCodeBERT for Code Search: Insights and Limitations</title>
      <dc:creator>Michał</dc:creator>
      <pubDate>Sat, 21 Dec 2024 13:47:38 +0000</pubDate>
      <link>https://forem.com/rebuss/exploring-graphcodebert-for-code-search-insights-and-limitations-4jm</link>
      <guid>https://forem.com/rebuss/exploring-graphcodebert-for-code-search-insights-and-limitations-4jm</guid>
      <description>&lt;p&gt;As a professional developer working daily with a massive codebase containing millions of lines of code and over 1,000 C# projects, finding the right pieces of code to modify can often be a time-consuming task. Recently, my interest has revolved around solving the problem of code search, and I was particularly intrigued by the potential of GraphCodeBERT, as outlined in the research paper &lt;a href="https://arxiv.org/abs/2009.08366" rel="noopener noreferrer"&gt;GraphCodeBERT: Pre-training Code Representations with Data Flow&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Encouraged by the promising results described in the paper, I decided to evaluate its capabilities. The pretrained model is available &lt;a href="https://drive.google.com/file/d/1ZO-xVIzGcNE6Gz9DEg2z5mIbBv4Ft1cK/view" rel="noopener noreferrer"&gt;here&lt;/a&gt;, with a corresponding demo project hosted in the GitHub repository: &lt;a href="https://github.com/microsoft/CodeBERT/blob/master/GraphCodeBERT/codesearch/README.md" rel="noopener noreferrer"&gt;GraphCodeBERT Demo&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Diving Into Code Search
&lt;/h2&gt;

&lt;p&gt;Initially, I went all in and vectorized the SeaGOAT repository, resulting in 193 Python function records stored in my Elasticsearch database. Using natural language queries, I attempted to find relevant functions by comparing their embeddings via cosine similarity. Unfortunately, I noticed that similar results were returned across multiple, distinct queries.&lt;/p&gt;

&lt;p&gt;This led me to believe that the model likely requires fine-tuning for better performance. To test this hypothesis, I decided to take a simpler approach and use the demo project provided with the pretrained model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing with a Controlled Dataset
&lt;/h2&gt;

&lt;p&gt;The demo focuses on three Python functions:&lt;/p&gt;

&lt;p&gt;1) download_and_save_image&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;f&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;output_dir&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;requests&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output_dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;wb&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2) save_image_to_file&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;f&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;output_dir&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output_dir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;wb&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3) fetch_image&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;f&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;output_dir&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;requests&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;image_url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Modified Query Results
&lt;/h2&gt;

&lt;p&gt;Below is the table reflecting my findings when testing slightly modified queries against the three functions. It represents the similarity between the user query vectors and the function vectors.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;User Query&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;1&lt;/th&gt;
&lt;th&gt;2&lt;/th&gt;
&lt;th&gt;3&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Download an image and save the content in output_dir&lt;/td&gt;
&lt;td&gt;0.97&lt;/td&gt;
&lt;td&gt;9.7e-05&lt;/td&gt;
&lt;td&gt;0.03&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Download and save an image&lt;/td&gt;
&lt;td&gt;0.56&lt;/td&gt;
&lt;td&gt;0.0002&lt;/td&gt;
&lt;td&gt;0.44&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Retrieve and store an image&lt;/td&gt;
&lt;td&gt;0.004&lt;/td&gt;
&lt;td&gt;7e-06&lt;/td&gt;
&lt;td&gt;0.996&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Get a photo and save it&lt;/td&gt;
&lt;td&gt;0.0001&lt;/td&gt;
&lt;td&gt;4e-08&lt;/td&gt;
&lt;td&gt;0.999&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Save a file from URL&lt;/td&gt;
&lt;td&gt;0.975&lt;/td&gt;
&lt;td&gt;6e-07&lt;/td&gt;
&lt;td&gt;0.025&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Process downloaded data and reshape it&lt;/td&gt;
&lt;td&gt;0.025&lt;/td&gt;
&lt;td&gt;0.0002&lt;/td&gt;
&lt;td&gt;0.975&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Go to the moon and back as soon as possible&lt;/td&gt;
&lt;td&gt;0.642&lt;/td&gt;
&lt;td&gt;0.006&lt;/td&gt;
&lt;td&gt;0.353&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Observations
&lt;/h2&gt;

&lt;p&gt;From the table, it’s evident that the model correctly identifies the function only when the query is very specific and closely matches the original wording. When queries are slightly modified or synonyms are used, the results seem almost random. The same issue occurs with abstract queries or those unrelated to any function in the database.&lt;br&gt;
It’s also evident that for 2 of the functions, every query returns very low similarity scores, which seems suspicious. This raises questions about whether the model is properly capturing meaningful distinctions for these cases or if there's an issue with the embeddings or similarity calculations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Concluding Thoughts
&lt;/h2&gt;

&lt;p&gt;After experimenting with the demo version, I concluded that further exploration of this model for code search in larger repositories may not be worthwhile—at least not in its current form. It appears that code search based on natural language queries cannot yet be solved by a single AI model. Instead, a hybrid solution might be more effective, grouping classes or functions based on logical and business-related criteria and then searching these groups for code that addresses the specified problem.&lt;/p&gt;

&lt;p&gt;I plan to continue exploring this area further. If you have any insights, suggestions, or experiences with code search models or techniques, please don’t hesitate to share them in the comments. Let’s discuss and learn together!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>nlp</category>
      <category>microsoft</category>
      <category>codesearch</category>
    </item>
    <item>
      <title>Exploring Code Search with CodeBERT – First Impressions</title>
      <dc:creator>Michał</dc:creator>
      <pubDate>Wed, 18 Dec 2024 22:38:49 +0000</pubDate>
      <link>https://forem.com/rebuss/exploring-code-search-with-codebert-first-impressions-418b</link>
      <guid>https://forem.com/rebuss/exploring-code-search-with-codebert-first-impressions-418b</guid>
      <description>&lt;p&gt;Recently, I’ve been exploring AI models that aim to solve the code search problem, and I came across CodeBERT from Microsoft. The repository can be found here: &lt;a href="https://github.com/microsoft/CodeBERT/tree/master" rel="noopener noreferrer"&gt;https://github.com/microsoft/CodeBERT/tree/master&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The project approaches the code search task in two ways, but today I want to focus on the first approach I looked into: using the basic CodeBERT model.&lt;/p&gt;

&lt;p&gt;In the paper "CodeBERT: A Pre-Trained Model for Programming and Natural Languages," the authors highlight their achievements, claiming state-of-the-art results for code search tasks. Naturally, I was curious to see how it works.&lt;/p&gt;

&lt;p&gt;The approach is based on binary classification:&lt;/p&gt;

&lt;p&gt;The model takes two inputs: a natural language query as the first part of the vector and a code snippet as the second.&lt;/p&gt;

&lt;p&gt;It outputs either 0 (no match) or 1 (match).&lt;/p&gt;

&lt;p&gt;For this to work in a code search software:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The code needs to be split into smaller fragments, such as functions or methods.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A user provides a query describing the function they’re looking for.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The algorithm iterates through all code fragments, combining the query with each fragment to create input vectors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;These vectors are passed through the model, which determines whether the query matches a particular fragment.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The output is a list of code fragments that align with the user’s query.&lt;/p&gt;




&lt;p&gt;While this approach works conceptually, it’s not particularly efficient for larger repositories, nor practical for real-world problems. Iterating over each fragment and classifying it one by one can be time-consuming and impractical at scale. It might be a helpful solution for smaller projects, but I don’t see much value in implementing a code search engine for small repositories where traditional search methods often suffice.&lt;br&gt;
I wonder if there are more advanced methods out there.&lt;/p&gt;

&lt;p&gt;Next, I plan to take a closer look at GraphCodeBERT, hoping it might offer a different perspective on the problem.&lt;/p&gt;

&lt;p&gt;I’d love to hear from you:&lt;/p&gt;

&lt;p&gt;Are there any tools or models you’ve used for code search that integrate well into real-world workflows?&lt;/p&gt;

&lt;p&gt;Are there solutions you’ve been curious to explore but haven’t had the time to test yet?&lt;/p&gt;

&lt;p&gt;Any suggestions or experiences you’re willing to share would be greatly appreciated.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>nlp</category>
      <category>microsoft</category>
    </item>
  </channel>
</rss>
