search
Cloud Blog – Two Heads Are Better than One, or What Is GitLab Duo?
Gitlab

Two Heads Are Better than One, or What Is GitLab Duo?

Artificial intelligence has been drastically expanding its presence across various domains, and development is no exception. In its May 2024 survey of 1,700 members of the dev community, Stack Overflow — the largest Q&A portal in the space — has found that over three-quarters of respondents either already use AI or plan on doing so.

Apart from the academic researchers and, of course, AI engineers themselves, the roles that have demonstrated the highest adoption level include front-end developers (75%), data scientists (67%), and mobile developers (60%).

The variation of AI tooling they equip is called CodeGen and refers explicitly to coding assistants. In this article, we briefly overview one such tool and answer the following questions: What is GitLab Duo, and what are its current functionalities?

Benefits of CodeGen Tools like GitLab Duo

McKinsey, one of the MBB consulting services firms, recently studied the impact of CodeGen on developer productivity. The findings were as follows:

  • 45% to 50% drop in time spent on tasks that involve writing code documentation.
  • 35% to 45% reduction in time spent on tasks involving code generation.
  • 20% to 30% in time savings revolving around code refactoring.
  • ~10% in time saved on highly complex objectives.

It is worth noting, however, that the major factors determining how much of a time-efficiency boost a team can achieve are the difficulty of the task in question and dev experience. McKinsey has seen some instances where junior devs actually had to allocate more time with CodeGen tooling at their disposal.

AI in DevSecOps is more than doable. Book a free call with a GitLab-certified expert to learn how. Book now →

What Is GitLab Duo?

GitLab Duo is an AI-fueled coding assistant from GitLab, which, according to G2, is one of the best CI/CD tools on the market. For each individual feature, it uses the most suitable LLM, with two of the most widely implemented large language models being Google Cloud’s Vertex AI Codey and Anthropic’s Claude.

Moreover, neither GitLab nor its vendors submit your private (i.e., non-public) data for training purposes. Now that we’ve figured that out, let’s take a closer look at how each of these AI capabilities can impact your development process. To begin with, the company has put all features into three distinct categories: generally available, beta, and experimental.

Generally Available GitLab Duo Features

Chat

Chat is a virtual AI assistant readily available to answer questions and explain complex technical concepts in a natural, conversational way.

You may argue there are many regular code assistants, so what is GitLab Duo’s major advantage in this regard? Chat can assist developers with reducing technical debt, improving code maintainability, and enhancing overall code readability through refactoring.

Code Explanation

Code Explanation takes existing code and translates it into clear, natural language, making it easier to understand the logic and functionality behind it.

Imagine you’re working on a legacy codebase with poorly documented functions. Code Explanation would analyze the function and provide a plain-English description of its purpose, parameters, and return values. That way, it would save you the time and effort of manually deciphering the code’s logic.

Code Suggestions

Code Suggestions acts as an AI coding partner (think of it as Copilot for GitLab), anticipating developer’s needs and suggesting secure coding solutions across 14 programming languages.

For example, while writing a new function, GitLab Code Suggestions might recognize a pattern and suggest a pre-built code snippet you can leverage, accelerating cycle times and adhering to industry best practices.

Git Suggestions

We’ve all had those moments when we forget the exact Git command we need. Git Suggestions is a handy in-context reminder that provides relevant Git commands based on the current situation.

Picture this: In the midst of a complex branching operation, Git Suggestions can examine your current structure and suggest the appropriate command, helping you stay productive and avoid workflow disruptions.

Suggested Reviewers

Assigning reviewers to merge requests can be time-consuming. What is GitLab Duo doing to relieve that pain point? The platform leverages machine learning models unique to each project for analyzing code modifications and recommending developers with the most relevant expertise for reviewing one’s work.

Say you’ve made significant changes to a module related to database interactions. Suggested Reviewers would identify engineers who have a history of working with that specific database technology, guaranteeing a more thorough review process.

Test Generation

Test Generation automates repetitive testing tasks, allowing you to focus on writing clean code. It identifies areas where tests might be missing and generates automated tests to cover those scenarios, catching bugs before they become major issues.

For instance, you’re working on a function that manipulates user input. Test Generation might analyze the code and automatically create tests that validate different user input scenarios, ensuring the function handles edge cases and unexpected data. What is GitLab Duo’s competitive advantage? It is compatible with numerous types of QA testing at once.

GitLab Duo Features in Beta

Merge Request Summary

Merge Request Summary comprehends your merge request and returns a clear, concise overview of the changes you’ve made. The summary can then be easily shared with project managers, testers, and other interested parties.

For instance, after completing a complex bug fix, you can utilize Merge Request Summary to automatically generate a description that details the bug being addressed, the specific code changes made, and the expected outcome. Such transparency in communication would ensure that everyone understands the impact of your fix and no misunderstandings arise.

Experimental GitLab AI Features

Code Review Summary

The code review process sometimes feels like a handoff between authors and reviewers. Code Review Summary bridges this gap by analyzing the code changes and highlighting key areas for review.

Let’s say a developer submits a large merge request with numerous code modifications. Code Review Summary might identify critical changes, potential regressions, and areas requiring further discussion, providing reviewers with a focused starting point that would lead to a more efficient and effective process.

Discussion Summary

Keeping everyone on the same page in a lengthy conversation can be challenging. Discussion Summary taps into lengthy discussions and comes up with a concise summary of the key points and decisions made.

Imagine a long array of GitLab comments debating the technical approach for a new feature. Discussion Summary can scan the thread and provide a bulleted list outlining the final decision, rationale, and any action items, promoting transparency for stakeholders and eliminating confusion for team members who may not have been involved in the entire discussion.

Issue Description Generation

Issue Description Generation uses Claude 2.1 to automatically outline a detailed description of the issue you’re facing based on a short summary.

After encountering an unexpected error message, Issue Description Generation might help you populate the issue quickly, paving the way for further diagnosis and resolution.

Vulnerability Explanation

Vulnerability Explanation delves into any potential security weaknesses identified in your code. It explains the vulnerability’s nature, its potential impact, and best practices for remediation.

For example, it might identify a potential SQL injection vulnerability in a function that processes user input and go into how an attacker could exploit it.

Vulnerability Resolution

What is GitLab Duo to offer once the vulnerability has been spotted? Correct: it takes the concept of security a step further by not just explaining it but also automating the process of fixing it.

Following the vulnerability identified by Vulnerability Explanation, Vulnerability Resolution might automatically create a merge request that includes code modifications to sanitize user input and prevent SQL injection attacks, ensuring that the security flaw is addressed promptly.

Root Cause Analysis

Oftentimes, troubleshooting pipeline failures and failed CI/CD builds is frustrating. With Root Cause Analysis, you get sufficient visibility into the logs and data associated with the failure.

Imagine your CI/CD pipeline fails unexpectedly. Root Cause Analysis can identify the specific code change or configuration issue that triggered the failure. This targeted information allows you to pinpoint the exact problem and get your pipeline back on track in no time.

Value Stream Forecasting

Value Stream Forecasting utilizes statistics to inspect your team’s historical data and predict potential bottlenecks or areas for improvement. Armed with such knowledge, you can proactively address issues and optimize your development process for maximum efficiency.

What is GitLab Duo doing to help? For one, Value Stream Forecasting might identify a trend of declining merge request throughput. This could indicate a need for additional reviewers or training on a new codebase. By anticipating this potential roadblock, the team can mitigate its impact and ensure smooth development progress.

From removing communication barriers to automating repetitive tasks and predicting roadblocks, GitLab Duo empowers developers to focus on what they do best: writing innovative and secure code. It is not, however, the only AI-enabled SDLC powerhouse; stay tuned for our GitLab Duo vs GitHub Copilot comparison! For a higher-level overview, please refer to our article on GitHub vs GitLab vs Bitbucket.

Who We Are

With a 1,414-strong customer base, Cloudfresh is a GitLab Professional Services Partner and GitLab Select Partner. Please complete the form below to receive a complimentary workflow optimization assessment from our team. If you haven’t discovered the CI/CD world just yet, you may want to consider purchasing a GitLab license first.

Get in touch with Сloudfresh