Tabnine’s personalization in depth


The main approach Tabnine uses to return code suggestions that are more accurate and relevant for your code is to enrich the context sent to the AI with additional relevant information from the user’s code.

The additional information comes from several sources, including code from the currently open file, related or recently viewed files, chat conversion history, and more, but the most important method is retrieval-augmented generation (RAG). RAG is used both for context through local code awareness and connection to your organization's codebase.

RAG in Tabnine

RAG is a common AI framework for improving the accuracy of LLM-generated answers by adding an information retrieval component that adds data and context to each query of the model.

RAG's implementation has two components:

Indexing: Tabnine builds RAG indices that enable fast and effective retrieval of relevant data. These indices are for code completions and chat, based on local code or global code, and are based on all the code in the IDE workspace or the organization’s global codebase.

Querying: With each user query to Tabnine (explicit or implicit), Tabnine retrieves relevant code context from the RAG index and adds it as a context to the prompt to the AI model. The result is a more accurate code suggestion from Tabnine, which is more relevant to the user codebase.

The following illustrates the process of a user query to Tabnine, with the personalization layer of querying from the RAG indices, in context through local code awareness and connection to your organization codebase.

The RAG index

Types and scope of indices

Tabnine uses RAG for both context through local code awareness and connection to your organization's codebase. There are different RAG indices for code completions and chat. The code representation in each index is different and fits the relevant AI model.

Additionally, the scope of the indices can be local or global. Local means that Tabnine builds the index based on the IDE workspace of each developer. Global means that Tabnine builds the index based on the whole codebase of the organization.

Tabnine’s RAG indices provide:

  • Context through local code awareness for code completions

  • Context through local code awareness for chat

  • Connection to your organization codebase for chat

What files are being indexed?

Tabnine’s RAG indices include all files in the scope that meet these criteria:

  • File extensions from the this table

  • Files not listed in .ignore or .gitignore

  • Files with extensions other than: "md", "yaml", "yml", "json", "lock", "xml", "gradle", "bash", "sh", "txt", "csv"

Index life cycle

The context through local code awareness indices (completions and chat) are created from scratch the first time Tabnine runs on the workspace. After the index is built, changes are monitored and the indexes are incrementally updated.

The connection to your organization codebase index is created after the team admin connects the repos from the customer codebase to Tabnine and is updated regularly.

Indexing process

The RAG indexing applies vector embeddings for each chunk of code in the scope (local or global).

For code completions, the RAG index computation runs locally on the developers’ machines.

For chat, the RAG index computation requires a lot of resources, and as such, requires a GPU, which means it cannot be done locally without stressing the end user’s machine. Tabnine performs just this computation on the Tabnine server GPU (SaaS or the customer's private installation).

To be clear, your code stays private. The chunks of code are sent encrypted, and Tabnibne does not retain your data or share it with third parties. The sole purpose of sending the chunks of code is to compute the vector representation for the index, and the code is deleted immediately after the computation is done.

Index location and persistence

The RAG indices are persisted in a vector database on the end user’s local machine. Specifically, the vector DB used in the end user machine is qdrant.

Integrations for connection to your organization's codebase

Tabnine can integrate with the leading Git hosting platforms such as GitHub, GitLab, or Bitbucket. The integration keeps the existing permission models or the organization so that each user can only retrieve code from repositories that they have access to.

Last updated