Artificial Intelligence 7 min read

Unlocking Google’s Gemma 3: Multimodal Power, 128k Context & Local Deployment Guide

This article introduces Google’s open‑source Gemma 3 model, highlighting its multimodal capabilities, massive 128k token context window, multilingual support, and provides step‑by‑step instructions for installing Ollama, pulling the model, and running local tests with code examples.

Java Architecture Diary
Java Architecture Diary
Java Architecture Diary
Unlocking Google’s Gemma 3: Multimodal Power, 128k Context & Local Deployment Guide

Background

Google recently released Gemma 3, the latest addition to its open‑source model family, marking a significant milestone for large language models (LLMs) with multimodal processing, a huge context window, and enhanced language support. Its open‑source nature gives developers and researchers unprecedented opportunities to explore advanced AI capabilities across diverse applications.

1742114815
1742114815

Core Features

Multimodal Processing

Gemma 3 excels at understanding and linking text, images, and video, making it ideal for data‑intensive fields such as medical diagnosis, media content analysis, and complex scientific research. The model extracts information from multiple sources and builds correlations to deliver comprehensive insights.

Expanded Context Window

The model’s context window has been dramatically increased to up to 128 k tokens, enabling coherent handling of long documents like legal texts, academic papers, or scientific publications, and improving long‑text understanding and continuity.

Globalization and Multilingual Support

Gemma 3 supports more than 140 languages and includes an enhanced tokenizer optimized for multilingual use. Its scalability ranges from 1 B to 27 B parameters, allowing small versions to run efficiently on mobile or edge devices while larger variants serve enterprise‑level applications and research.

1742117948
1742117948

Ollama Installation Guide

To run Gemma 3 locally, first install Ollama, a powerful local LLM runtime.

<code># Download and install
curl -fsSL https://ollama.com/install.sh | sh

# Start the service
ollama serve</code>

After installation, pull the desired model version:

<code># Pull the 27B parameter version
ollama pull gemma3:27b

# Or pull a smaller version
ollama pull gemma3:2b</code>

Local Installation Test

<code>lengleng@huawei  ~  ollama run gemma3:27b
>>> 请问tes 赢了吗? /Users/lengleng/Downloads/lol.png
Added image '/Users/lengleng/Downloads/lol.png'
从图片上可以看出,TES 以 0:3 输给了 HLE。所以 TES 没有赢。

>>> 这场比赛的时间是?
根据图片显示,比赛时间是 03-15 17:00。 也就是3月15日 17点。</code>
1742115776
1742115776

Code Invocation Test

Add Dependency

<code>&lt;dependency&gt;
  &lt;groupId&gt;dev.langchain4j&lt;/groupId&gt;
  &lt;artifactId&gt;langchain4j-open-ai-spring-boot-starter&lt;/artifactId&gt;
  &lt;version&gt;1.0.0-beta2&lt;/version&gt;
&lt;/dependency&gt;</code>

Configure Parameters

<code>langchain4j.open-ai.chat-model.api-key=local-ollama
langchain4j.open-ai.chat-model.model-name=gemma3:27b
langchain4j.open-ai.chat-model.base-url=http://localhost:11434/v1</code>

Test Code

<code>@Autowired
private ChatLanguageModel chatLanguageModel;

@Test
void contextLoads() throws IOException {
  // Load image file
  File file = new File("/Users/lengleng/Downloads/lol.png");

  // Convert image to Base64
  String image = Base64.getEncoder().encodeToString(Files.readAllBytes(file.toPath()));

  // Create user message with text and image
  UserMessage userMessage = UserMessage.from(
          TextContent.from("请问 tes 赢了吗?"),
          ImageContent.from(image, MediaType.IMAGE_PNG_VALUE));

  // Send request and get response
  ChatResponse chatResponse = chatLanguageModel.chat(userMessage);

  // Output model reply
  System.out.println(chatResponse.content().text());
}</code>

Conclusion

Google Gemma 3 represents a major advance in open‑source AI models. Its multimodal abilities, expanded context window, and extensive multilingual support make it a powerful, flexible tool. With Ollama, developers can deploy and use the model locally, preserving data privacy and reducing operational costs.

multimodal AIlarge language modelAI modelLocal DeploymentOllamaGemma 3
Java Architecture Diary
Written by

Java Architecture Diary

Committed to sharing original, high‑quality technical articles; no fluff or promotional content.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.