Urgent.News

What's breaking now, across thousands of outlets.

Tech

I got a RAG app running on a 512 MB free server. The trick was not running the embedding model at all.

Most "build a RAG app" tutorials work fine in a notebook. Then you try to put one online on a free host, and it falls over. I wanted a document Q&A app that answers from my own files, cites its sources, refuses when the answer isn't there, and runs entirely on free tiers with no credit card . Here's what broke along the way, and the setup that finally worked. Live demo: https://rag-0.onrender.com…

Here is the story written in my own words:

Building a RAG (retrieval-augmented generation) application that runs entirely on free services and tiers is challenging, but it can be done. The main issues are the limited resources available on free web hosting services and the limitations of free LLM APIs.

The first problem is that the embedding model used to convert text into vectors does not fit into the 512 MB of RAM and 0.1 CPU provided by many free web services. Instead of running an embedding model on your own server, use a cloud inference service like Qdrant Cloud. This service can embed text for you, so your server only needs to send plain text.

To store documents and retrieve them for answering questions, use Qdrant's free cluster with the cloud inference feature enabled. The sentence-transformers/all-minilm-l6-v2 model is listed as free for use. The app's Flask server only needs to send text to Qdrant, while Qdrant handles the embedding.

One challenge is that LangChain's QdrantVectorStore expects a local embeddings object, which goes against the goal of using free services. A custom LangChain retriever was created to pass raw text to Qdrant's query_points method instead.

A second issue is that Groq, a popular free LLM API, shut down its llama-3.1-8b-instant model for free and developer-tier accounts. The recommended replacement, openai/gpt-oss-20b, is a reasoning model that thinks before answering. However, its thinking tokens count toward the max_tokens limit, so a lower cap like 512 tokens can lead to cut-off or empty answers. To mitigate this, use a higher max_tokens limit like 1024 and a low reasoning_effort setting.

Another limitation is the token limits of Groq's free tier. Each question sent to Groq carries the retrieved chunks, so the token usage adds up quickly. Even with short documents and answers, a single question can cost about 600-700 tokens, allowing roughly 280 questions per day before hitting the daily token cap. This is sufficient for a demo or portfolio project but not for real public traffic.

To prevent the app from dying due to inactivity, a free weekly GitHub Actions job was set up to hit a deep health endpoint. This endpoint performs a cheap Qdrant read and never calls the LLM, so it can't consume the token budget. The job runs on a schedule and checks the health of the Qdrant cluster.

Lastly, a bug was encountered where a trailing newline in the Qdrant API key caused every Qdrant call to fail and print the full key in the logs. To fix this, every environment setting read from the settings was stripped of whitespace using the .strip() method.

The final stack includes Groq's openai/gpt-oss-20b model, which is a free reasoning LLM. By addressing these challenges, it's possible to build a RAG application that runs entirely on free services and tiers.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Skip intro from your server's markers and a community database

A Skip intro button is a small thing to see and a surprisingly fussy thing to build. The button is easy. The hard questions are where the times come from, and what to do when two places have an…

  • Skip intro button enhances Android TV viewing experience
  • Server markings take precedence over community database
  • User can toggle lookup feature in settings

More from Saturday 14 November →