Translating text in camera frames with TranslateGemma 4B in Ollama
- Hardware
- GPU machine: Surface Laptop Ultra, Windows 11 Arm64, NVIDIA RTX Spark N1X, Ollama 0.40.10 Windows ARM64 build using CUDA
Comparison: laptop with Intel Core Ultra 7 258V (CPU, and integrated GPU via Vulkan on Ollama 0.40.11) - Models & engines
- Model: translategemma:4b in Ollama (Q4_K_M, 3.3 GB download)
- Key gotcha
- Ollama's prompt cache: an exact duplicate of image 1 came back in 0.151 s, more than 4x faster than a new image, and the same trap appeared in all four conditions.
What they built
maruhana wanted to translate English text seen through the camera of their XR glasses (VITURE Luma Cyber). One approach was to give each camera frame directly to TranslateGemma 4B running in Ollama, with no OCR step.
On their laptop (Intel Core Ultra 7 258V, CPU only) a new image took 29-34 seconds, mostly spent turning the image into tokens, so they dropped the idea and used OCR plus text translation (about 4 seconds) instead.
They kept the code, prompts and measurement conditions for the dropped approach, and later re-ran it on a Surface Laptop Ultra with an NVIDIA RTX Spark N1X GPU, then again with matched conditions (same machine, same Ollama, GPU on vs. off) after a reader asked how much the graphics card mattered.
Setup
- Model: translategemma:4b in Ollama (Q4_K_M, 3.3 GB download)
- GPU machine: Surface Laptop Ultra, Windows 11 Arm64, NVIDIA RTX Spark N1X, Ollama 0.40.10 Windows ARM64 build using CUDA
- Comparison: laptop with Intel Core Ultra 7 258V (CPU, and integrated GPU via Vulkan on Ollama 0.40.11)
- Test images: synthetic 1920x1080 frames with black English text on white
How it works
- One image per request to the Ollama API, with the same prompt, temperature 0 and keep_alive as in the app.
- Each run used five new images, one exact copy of image 1, one text-only request and one warm-up.
- Besides the round-trip time, every request's server-side breakdown (prompt_eval_duration, eval_duration, prompt_eval_count) was recorded.
Results & numbers
- New images took 0.665-0.698 s each on the RTX Spark GPU, versus 29-34 s earlier on the laptop CPU.
- The prompt was 326 tokens every time; Gemma 3-family image input is a fixed 256 tokens, so only the cost of that fixed step changed.
- With matched conditions on the same Surface, switching only the GPU made about a 25x difference (0.64-0.70 s vs 16.4-17.5 s on CPU).
- On the laptop, the integrated GPU took 16-20 s, about 1.5x faster than its CPU.
Gotchas
- Ollama's prompt cache: an exact duplicate of image 1 came back in 0.151 s, more than 4x faster than a new image, and the same trap appeared in all four conditions.
- The first CPU measurement of 2.7 s was wrong for this reason; the real figure was about 30 s.
- Faster is not better: the output is still a 4B model's translation, and translation quality was not measured.
- The author's own handheld PC has no NVIDIA GPU, so their setup stays OCR plus text translation.
“If you drop an approach, keep its prompts and measurement conditions in code.”— maruhana
Do it yourself
- Install Ollama and pull translategemma:4b.
- Write a script that sends one image per request with a fixed prompt and temperature 0.
- Generate a new test image for every measured request, plus a warm-up request.
- Log prompt_eval_duration, eval_duration and prompt_eval_count from each response, not just the stopwatch time.
- Compare GPU and CPU on the same machine by setting num_gpu: 0 on the request, and confirm with ollama ps.
Similar setups
A €200 mini PC as an offline AI box: a week with Gemma and Qwen
Diogo Soares ran Gemma 4 E4B and Qwen2.5-Coder 7B on a cheap NiPoGi P1 mini PC firewalled off the internet, used it from his Mac for a week, and measured what was fast and what wasn't.
Getting OpenCode to work with a local Ollama model by fixing the 4,096-token context
OpenCode on a local Ollama model ignored files, invented tasks or looped, because each ~23k-token request was silently cut to fit Ollama's default 4,096-token context on a 16 GB GPU.
Local AI: a one-click Windows app that picks a model for your PC and sets up Ollama for friends
Tired of setting up local LLMs for friends, a developer built a free MIT-licensed Windows app that detects your GPU and RAM, installs Ollama without admin rights, pulls a fitting model and opens a private chat.
llama.cpp 1.0 on a handheld PC's integrated GPU: 2x faster long prompts with flash attention
Before-and-after llama.cpp 1.0 tests on an MSI Claw's Intel Arc 140V found long prompts read about twice as fast only with flash attention on, and the new MoE cache lost to full GPU offload.