Building a Local LLM · 30/30 · Advanced and Operations
Full series and learning sequence · Practice code ZIP
A document Q&A tool needs an update and recovery procedure as well as working search and answer scripts. Test rebuilding the project in a new directory, including the document data and required configuration. Record how to start, update, back up and restore the tool.
It is based on files 16 to 18 and the security check of part 29. After testing restoration with virtual documents, decide how to store the actual data.
Default configuration to continue using
The basic configuration is Windows Ollama and Python search and answer script. Use embeddinggemma:300m for embedding and qwen3:4b-instruct for generation. Choose Open WebUI·Hermes·OpenClaw according to your needs. Having them all resident increases memory and more things to manage.
ollama --version
ollama list
.\.venv\Scripts\python.exe .\semantic_search.py --build
.\.venv\Scripts\python.exe .\rag_answer.py
If you unzipped the ZIP to a new folder, create a .venv like in part 8 and receive the models for parts 2 and 16. The docs in the ZIP are virtual materials. Place the actual document in a separate personal folder and check access permissions and storage location.
Original text and index update
- Saves the current runtime version, model ID, prompts, and scorecard.
- Apply the new version and run the same fixed questions.
- Compare search omissions, numeric errors, rejection behavior, and speed.
- If you deviate from the passing criteria, you will revert to the previous configuration you recorded.
If the original text, embedding model, or chunk conditions change, rebuild the index with –build. This small example makes overall regeneration simple. As you have more documents, you can consider adding file hashes and modification/deletion tracking to update only the changed parts.
Backup settings and restore empty folders
Place the runbook.txt from the ZIP in your working folder and run the command below. Bundles only the specified files and does not include .venv, model weights, or API keys. If the original text of the docs is sensitive, the backups created are also protected to the same level.
$project = (Get-Location).Path
$backupRoot = Join-Path $env:USERPROFILE "llm-lab-backups"
New-Item -ItemType Directory -Force $backupRoot | Out-Null
$names = @("docs", "llm_http.py", "semantic_search.py", "rag_answer.py", "evaluation-template.csv", "runbook.txt")
$files = $names | ForEach-Object { Join-Path $project $_ }
$missing = $files | Where-Object { -not (Test-Path -LiteralPath $_) }
if ($missing) { throw "Required backup files missing: $($missing -join ', ')" }
$stamp = Get-Date -Format "yyyyMMdd-HHmmss"
$archive = Join-Path $backupRoot "llm-lab-$stamp.zip"
Compress-Archive -LiteralPath $files -DestinationPath $archive
Get-FileHash -LiteralPath $archive -Algorithm SHA256
ZIP copied to the same SSD cannot be used as a backup in case the SSD fails. Place a copy on protected external storage or in a separate location. You need to recreate the virtual environment from an empty folder, prepare the model, create the index, and check the fixed questions to ensure that you have restored the tool.
Equipment, power, API costs
Local models also have costs in equipment, power, storage space, and management time. Power is calculated by the increments on the wall meter and the actual hours of use. It does not replace TDP or GPU ratings as actual values for the entire system.
# 계산 방법을 보여 주는 가정: 추가 소비전력 100W, 하루 3시간, 30일
$extraWatts = 100
$hoursPerDay = 3
$days = 30
$kWh = ($extraWatts / 1000) * $hoursPerDay * $days
$kWh
The 9kWh in the example is calculated based on the above assumptions. The results are not measured using specific equipment. The actual electricity price is calculated based on region, contract, and usage conditions, and the external API compares the usage token, unit price, and additional costs.
Operating record and next improvements
Write down on one page the questions that can be answered, the questions that cannot be answered, how to update the original text, and the recovery order. Even after replacing the model, it is easy to find changes in settings by checking the records and evaluation questions.
This is a personal learning example. User authentication, document permissions, and concurrent request/budget limits must be added to team services. When deciding on your next improvement, start by gathering questions that are currently failing you. By looking at the results, you can consider chunk adjustments, keyword/vector mixed search, reranker, and evaluation automation.
reference material
Documentation and model tags checked: October 18, 2026. Primary lab environment: Windows 11 x64.



