I use Gemma 4 31B with Open WebUI to provide a browser-based local LLM environment for research work. I also deployed similar environments to two research laboratories. The goal is straightforward: give researchers access to a large model without requiring them to install inference software on their own computers.

In Part 1: Running Ollama on AMD Ryzen AI Max+ 395 with ROCm and Docker, I covered the GPU runtime, Docker containers, and model installation. Here I focus on Open WebUI administration and the model settings I use for research tasks.

1. Check the Ollama connection

My setup uses two Docker containers: ollama for inference and open-webui for the browser interface. The Open WebUI container connects to http://ollama:11434 over their Docker network.

On the Ubuntu host, check the model and container status:

docker ps --format 'table {{.Names}}\t{{.Status}}' docker exec ollama ollama list docker exec ollama ollama show gemma4:31b 

The model should appear as gemma4:31b. My installation uses a 31.3B-parameter, Q4_K_M-quantized variant. If it has not been installed, download it with:

docker exec ollama ollama pull gemma4:31b 

Open Open WebUI at http://localhost:3000 on the host, or through the access method configured for your network. Sign in with an administrator account. Under Settings → Admin → Connections, confirm that the Ollama connection is enabled and the model appears in the selector. Menu labels may differ slightly between Open WebUI versions.

2. Configure Open WebUI for laboratory use

I keep optional external integrations and unnecessary sharing features disabled in this environment.

Location in Admin settings Setting Value
General → Features Community Sharing Off
General → Features Notes Off
General → Features Memories Off
General → Features User Webhooks Off
Connections OpenAI API Off
Web Search Enable Web Search Off

Save the changes in each section. Under the model settings, also leave the Web Search capability or default feature disabled for Gemma 4 31B.

I disable Web Search because search queries can be sent to external services. Disabling the OpenAI API connection keeps Open WebUI focused on the local Ollama backend. These settings do not, by themselves, make the entire computer or network offline; other integrations and network access must be controlled separately.

3. Set the Gemma 4 31B parameters

Open Settings → Admin → Models (or Workspace → Models, depending on the version) and edit gemma4:31b. If the raw Ollama model is not directly editable, create an Open WebUI model preset with Base Model set to gemma4:31b and configure that preset instead.

Expand Advanced Params and set:

Parameter Value Purpose
Temperature 0.25 Less variable wording for research-oriented text tasks
Max Tokens (max_tokens) 12288 Maximum generated tokens per response
Context Length (num_ctx) 65536 Context budget for prompts and conversation history
Batch Size (num_batch) 256 Prompt-processing batch size
Keep Alive (keep_alive) 3m How long Ollama keeps the model loaded after a request

Save the model with Save or Save & Update, then reopen it to confirm the values. If your version does not expose num_batch or keep_alive as a standard field, use Add Custom Parameter in Advanced Params, retaining the exact parameter names and types (256 as a number; 3m as text).

I keep temperature at 0.25 for research-oriented writing and translation. It reduces sampling variability but does not guarantee factual accuracy or identical responses. I leave other sampling parameters at the model's defaults; ollama show gemma4:31b reports top_p=0.95 and top_k=64 in my installation.

A few details matter when these settings reach Ollama:

  • Open WebUI's max_tokens maps to Ollama's num_predict generation limit.
  • num_ctx overrides Ollama's server-side default when Open WebUI sends it.
  • num_batch is an Ollama inference option; its memory and performance effects depend on the model and hardware.
  • keep_alive is a request-level setting, not part of the model's weights.

The model reports a maximum context length of 262,144 tokens, but I use a 65,536-token setting for this workload. This number is a configuration choice, not a claim that every 65,536-token request or 12,288-token response has been successfully tested.

Open WebUI also allows users to override model defaults through their account or individual chat controls. When consistency matters, check these overrides before comparing results.

4. Manage accounts and network access

The first account created on a new Open WebUI installation receives administrator privileges. For a shared research environment, I keep administrative access separate from normal user access.

In Settings → Admin → Authentication, control whether new users can register. For an approval-based workflow, use the Pending default role and approve accounts through Admin Panel → Users. Give administrator privileges only to people who maintain the service.

The Docker example in Part 1 binds the Web UI to 127.0.0.1:3000, so other computers cannot reach it directly. An administrator who has SSH access can use a local tunnel from a client computer:

ssh -N -L 3000:127.0.0.1:3000 USER@SERVER 

Then open http://localhost:3000 on that client. Replace USER and SERVER with the SSH account and server address. For routine multi-user access, use a network-restricted Web UI endpoint, preferably behind HTTPS. Do not expose the unauthenticated Ollama API to untrusted clients; Open WebUI login does not protect direct connections to port 11434.

5. Work with research documents

One use case is reading or translating long research documents. The 65,536-token context and 12,288-token output limit are intended to provide room for longer inputs and responses, but PDF length in pages is not a reliable measure of token count.

For a document-based task:

  1. Start a new chat and select the configured Gemma 4 31B model or preset.
  2. Upload a non-confidential test PDF and check that the text was extracted correctly.
  3. For a document that fits the available context, choose Using Entire Document if full-text processing is needed. Otherwise, use the default focused retrieval mode and check which passages were retrieved.
  4. Ask a question with a verifiable answer, or translate a defined section and compare it against the source.

Full-document mode consumes context for the extracted text, instructions, and conversation history. A higher num_ctx does not guarantee good PDF extraction, complete translations, or accurate citations. Scanned PDFs may also require a configured extraction or OCR engine.

6. Verify the configuration

After saving the settings, I check the following using a regular user account:

  • The intended Gemma 4 31B model is available and returns a response.
  • Web Search and external API connections are not available for the intended workflow.
  • The model's Advanced Params show the chosen values; no chat-level overrides are active.
  • A short non-confidential document can be uploaded, read, and used to answer a verifiable question.

While an inference request is running, I also check Ollama on the host:

docker exec ollama ollama ps 

The PROCESSOR column indicates whether the loaded model is running on the GPU, CPU, or both. I use this check alongside the browser test rather than assuming that an installed model is necessarily running on the GPU.

This setup keeps the Open WebUI configuration focused on local inference, controlled access, and document-oriented research tasks. Kernel and ROCm compatibility, updates, backups, and recovery are separate operational concerns covered in the maintenance article.

References

AI disclosure: This article documents my own technical setup and results. An LLM was used to help draft, organize, and edit the English text. I remain responsible for its technical accuracy.