Learn More

Try out the world’s first micro-repo!

Learn More

How Developers are Using Offline AI Tools for Air-Gapped Security

How Developers are Using Offline AI Tools for Air-Gapped Security
How Developers are Using Offline AI Tools for Air-Gapped Security.

Artificial Intelligence has experienced a remarkable surge recently, marked by the emergence of platforms such as OpenAI's ChatGPT, Google Bard, and others. It is no surprise, these platforms have gained significant attention, captivating billions of users worldwide. In a 2023 survey sponsored by GitHub, it was found that 92% of developers are already using AI tools for development.

AI assists developers by automating tasks, improving code quality through bug detection and optimization, enhancing collaboration, and providing personalized development experiences/ While we can say that AI makes our lives as developers easier, we also need to consider the data and code security issues with these cloud-based models.

Code and Data Security Concerns Regarding Cloud-Based Models

ChatGPT, developed by OpenAI, is an example of a cloud-based model. Instead of running on an individual's computer, ChatGPT operates on powerful servers hosted on the cloud. Users interact with the model via the ChatGPT API (Application Programming Interface) over the internet. When a user sends a prompt or query, it is transmitted to the cloud servers where the model processes the input, generates a response, and sends it back to the user.

Unfortunately, using cloud-based models like ChatGPT endangers your data and code privacy as a developer.

According to the Open AI privacy policy, collected data includes a long list, but these two are our strongest concerns in this article:

  • Usage data: This includes how you use and engage with the service. Your software version, connection information, and so on.
  • User content: Every conversation that you have with ChatGPT is stored by Open AI.

Open AI says that ChatGPT is also trained using data it receives, including potentially sensitive code, data confidential to your company, or intellectual property that you may wish to keep private. There is a possibility that ChatGPT could potentially share such information with vendors, service providers, legal entities, and so on upon request, unless users opt out of sharing personal information. But then how does it define ‘personal’? Is it a risk worth taking?

In a recent occurrence, three Samsung employees leaked sensitive data to ChatGPT. Consider the significant repercussions a major company could encounter by entrusting sensitive information to a model that isn’t air-gapped. Samsung has allegedly restricted the usage of ChatGPT on company devices to the bare minimum, and is working on building its own chatbot to minimize these risks. Other companies like Amazon, Verizon, and JP Morgan have also restricted the use of ChatGPT in their daily operations due to security concerns.

An earlier incident occurred when individuals on social media platforms such as Twitter and Reddit reported instances of viewing chat histories that did not belong to them. These occurrences raised significant concerns regarding the sharing of sensitive data with cloud-based models.

Even as recent as Tuesday, ChatGPT was found to have revealed a real email address and phone number after researchers asked it to repeat the word "poem" forever."

Think about your chat history showing up on someone else's device, along with a sensitive code or important company info. Sounds risky, doesn't it? Italy, France, and Spain have also expressed their concerns regarding data privacy issues. So is the problem with this particular set of models? Or are all cloud-based LLMs at risk?

Introducing Offline AI as a Solution

Offline AI, also known as on-device AI or Local LLMs (LLLMs), refers to artificial intelligence systems that operate locally on a device without the need for a continuous internet connection. Unlike cloud-based AI models that require internet access to process data on remote servers, offline AI tools function independently on the device where it is installed.

What are the Challenges of Cloud-Based Models?

The need for solutions beyond cloud-based models in terms of data and code privacy arise from several critical considerations:

  1. Enhanced Security: Cloud-based models involve transmitting data to external servers for processing, which raises security concerns. Storing and processing sensitive information locally, as in on-device solutions, can significantly reduce the risk of unauthorized access and potential data breaches. Understand the guidelines to secure AI from design to maintenance.
  2. Regulatory Compliance: Different regions and industries have varying data protection regulations. Some regulatory frameworks require certain data to be stored and processed within specific geographic boundaries. On-device solutions provide a way to comply with these regulations without relying on external cloud infrastructure.
  3. User Privacy and Control: Storing and processing data locally gives users more control over their information. With on-device solutions, users can have increased confidence that their data remains on their own devices, addressing concerns related to privacy and the potential misuse of personal information.
  4. Protection of Intellectual Property: For organizations dealing with proprietary code and intellectual property, on-device solutions provide an additional layer of protection. Keeping sensitive code and algorithms within the organization's control helps mitigate the risk of unauthorized access or intellectual property theft.
  5. Customization and Adaptability: On-device solutions offer more flexibility for customization. Organizations can tailor models and algorithms to specific needs without relying on third-party cloud services, allowing for greater adaptability to unique requirements and use cases.

Solutions beyond cloud-based models are essential to address diverse needs related to security, compliance, user privacy, and operational efficiency, providing organizations with more comprehensive options to protect sensitive data and code.

How Do Offline AI Tools Solve Code Security Issues?

Using AI offline resolves code and data privacy concerns by prioritizing local processing on the user's device, mitigating the need for external data transmission and dependence on cloud-based services. This approach ensures that sensitive code and data remain within the confines of the device, minimizing the risk of unauthorized access during data transmission.

With limited exposure to external networks, offline AI software enhances overall security, grants users greater control over their data, and aids in compliance with data protection regulations.

Introducing Pieces as a Solution for Code Security

In the tech space driven by data and code privacy concerns, we recognize the need for a robust solution that operates independently on developers' devices. Our free offline AI features tackle these issues head-on by ensuring local processing, reducing exposure to external networks, and fostering greater control over sensitive code and data.

Elevate your development workflow with Pieces for Developers, where innovation meets security, providing a seamless and private coding experience for developers.

How does Pieces achieve this?

Pieces has some technologies and infrastructure that enable offline AI functionality, and we are going to look at the most important factors that you should know about.

Local Large Language Models

Large language models are artificial intelligence models trained on a vast amount of data and parameters to enable natural language processing. Local large language models are ones that, despite robust complexity similar to other popular large language models, can operate within a local environment.

Meta has introduced local large language models like Llama 2 and CodeLlama (Large language Model Meta AI) that can run on a single GPU with smaller weights and fewer parameters, enabling them to operate on local devices, PCs, and smartphones.

Llama2, which is one of Meta's most recent models, is open source, pre-trained, and fine-tuned with parameters ranging from 7B to 70B. Compared to GPT-3, this model is relatively lighter in weight by parameters but is more efficient on most benchmarks and also outperforms other open-source models.

Pieces uses Local LLMs like Llama 2 to power its on-device AI usage of the Pieces Copilot which offers unique features extending beyond mere code generation or question and answering. It revolves around comprehending your workflow with retrieval augmented generation, understanding team dynamics with related-people metadata, and connecting your toolchain with various integrations.

This involves capturing and accessing the context, allowing the AI copilot to deliver information in a natural conversational format, all while upholding code and data privacy which is demonstrated through the execution of large language models locally with Pieces, directly on the device.

Small Language Models for Enterprises

Small language models refer to artificial intelligence models designed with fewer parameters and less computational complexity compared to their larger counterparts. These diluted models offer a solution to the limitations of large language models, including their size, computational requirements, and high operational costs.

Small language models are easier to train, as they consume less data and fewer parameters, resulting in lower hardware consumption costs and more effective expense management for enterprises. Due to their relative size, they are easily customizable to the organization's needs through targeted training, enhancing accuracy and reducing bias.

Edge learning machine models, also known as small language models, can run on-device due to their compact size, ensuring the data and code security of your organization are prioritized and maintained.

On-Device Pieces Copilot Features

The models discussed earlier make Pieces able to do a lot of helpful things for developers locally on-device, boosting their productivity in their work and maintaining privacy. Some of these include:

  1. On-Device Auto-Enrichment: When you save code snippet to Pieces, we use fine-tuned models to instantly detect the language, add syntax highlighting, and augment your code snippet with useful AI context and metadata such as a title, description, tags, related links, and related people. This helps developer’s stay more organized, streamlining sharing and reuse.
  2. Optional Character Recognition (OCR) Technology: It involves recognizing printed or handwritten texts from digital images or printed documents. This technology is used to convert code snippets or text from screenshots instantly. For example, you could take a screenshot of code from YouTube and decide to extract the code text. Not only are we doing OCR, but we have on-device ML models to auto-correct any potential defects in the code.
  3. On-Device features on Pieces desktop app, VS Code and Obsidian: Whether you’re chatting with Pieces Copilot on the desktop app, VS Code, IntelliJ, Obsidian, or another tool, you can now choose to opt-in to on-device LLMs for code generation and other features. With this option, you can make the right choice according to your environment.

Benefits of Offline Generative AI for Developers

  1. Enhanced Privacy: Using an AI chatbot offline contributes to enhanced privacy. By processing sensitive data locally, it eliminates the need to transmit information over the internet. This not only mitigates concerns about potential data breaches or unauthorized access, but also empowers users with greater control over their personal information.
  2. Reduced Latency: Offline AI tools typically exhibit reduced latency as they don't rely on a constant internet connection for computations. Processing data locally leads to quicker response times.
  3. Operability in Limited Connectivity Environments: One of the significant advantages of offline AI tools is the ability to operate in environments with limited or no internet connectivity. This ensures the continuity of AI-driven services in remote areas or situations where establishing a stable internet connection is challenging.


We've explored the implications of cloud-based models on our data and code privacy, underscoring the significant role offline AI plays as a remedy to these vulnerabilities. To experience the benefits firsthand, download the Pieces desktop app and leverage its features to mitigate risks, ensuring enhanced data and code security. By doing so, you not only safeguard your privacy, but also cultivate a personalized and optimized development environment tailored to your unique needs and preferences. Not sold on cloud vs local LLMs? See what the best LLM for coding is.


Table of Contents

No items found.
More from Pieces
Subscribe to our newsletter
Join our growing developer community by signing up for our monthly newsletter, The Pieces Post.

We help keep you in flow with product updates, new blog content, power tips and more!
Thank you for joining our community! Stay tuned for the next edition.
Oops! Something went wrong while submitting the form.