Guest mode. You can read posts without signing up. Comments, ratings, job contacts and your own posts open after you sign up and accept the rules. What is Kommit →

Редакция КоммитРедакция портала
commit a63aa22 · 19 days ago

Neural networks at work, part 2: local models and RAG — searching through your documents

🌐 Machine-translated from Russian. Show original

In this part:

When a local model is needed#

  • data cannot be sent to external services (trade secrets, personal data);
  • need to work without the internet;
  • a large volume of similar tasks, where API fees become noticeable.

The price is hardware: for comfortable work, you need a video card with a large amount of memory or a computer with a large amount of shared memory. Small models run on regular PCs as well, but the response quality is lower than that of large cloud ones.

Quick start#

Tools like Ollama or LM Studio download and run open models (families Qwen, Llama, Mistral, DeepSeek, etc.) with a single command and provide a local API compatible with the OpenAI format. About open models — a post about Qwen from the Vibcoding series.

What is RAG#

Retrieval-Augmented Generation — the model responds not "from memory," but based on found fragments of your documents:

  1. Indexing: documents (regulations, instructions, knowledge base) are cut into fragments, each counted as embedding — a numerical vector of meaning.
  2. Search: the user's question also turns into a vector, finding the most similar fragments.
  3. Answer: the model passes the question and the found fragments with the instruction "answer only based on these materials and indicate the source."

Simple RAG architecture#

ComponentVariants
Vector storagePostgreSQL with the pgvector extension, specialized vector databases,
Embedding modellocal or cloud-based, with support for Russian and Kazakh
Language modelon-premises or cloud-based—according to data requirements
Interfacechat on the internal portal, bot in messenger,

What is important for quality#

  • Document quality is more important than model: outdated and contradictory regulations will give incorrect answers.
  • Slicing: fragments by semantic sections, with the document and section title in each fragment.
  • Source references in each response — the user should be able to verify.
  • Access rights: search only by documents the user can see. Otherwise, RAG will become a way to read other people's documents.
  • The answer 'I don't know' is better than fiction: explicitly instruct the model to refuse if there is no answer in the materials.

Assessment#

Collect 30–50 real employee questions with correct answers and check the system on them after each change — it shows whether things have improved or worsened.

Comments 00 участников · 0 гостей🔒 Rate and discuss after signing up

Comments · 0

No comments yet.Sign in to comment, rate and see all comments.