DEV Community

Cover image for Long Contexts on Constrained Deployments: Gemma 4 E2B on a 4 GB GTX 1650 Ti
xbill Subscriber for Google Developer Experts

Posted on

Long Contexts on Constrained Deployments: Gemma 4 E2B on a 4 GB GTX 1650 Ti

A 4 GB laptop GPU runs Gemma 4 E2B, Google's smallest Gemma 4 model, as accurately as an 8 GB card, and neither card lets it read a long document well. In a 9,000-word document both find about two hidden codes in three, and the 4 GB card answers in about a minute. In a 68,000-word document both find about one in eight, and the 4 GB card takes 27 minutes to read it.

On a 4 GB GTX 1650 Ti, Gemma 4 E2B holds a 127k-token document in 2,326 to 2,596 MiB of the card. With byte-identical prompts on both cards, as served it found 140 facts against an 8 GB RTX 3050's 138, and no setting differed between the cards beyond chance.

The card changes the wait. A fresh 16k-token document takes 72 seconds to read, and a 127k one 27 minutes, 12.4 to 14.5 times the 3050. Thinking on with Google's sampling settings found 226 facts against 127 with thinking off, as on the 3050, for 8 to 24 seconds more per request.

So the model sets the limit and the card sets the wait. On a 4 GB card, use E2B on documents under 16k tokens, about 9,000 words. For anything longer, cut the document down before E2B sees it: a bigger card reads it faster and finds no more.

This article provides a step by step test of Gemma 4 E2B with long documents on a 4 GB GTX 1650 Ti laptop GPU through llama.cpp, repeating the test run on an 8 GB RTX 3050 with the same documents, facts and seeds. Six server settings at 16k and 32k tokens, four of them out to 127k, 460 requests and 70.9 hours.

https://github.com/xbill9/gemma4-dev/tree/main/docs/gemma4-e2b-long-context-1650ti


The Findings

The 4 GB card finds what the 8 GB card finds. Paired trial by trial with the 3050 run, the largest gap in any setting was thinking on, 226 facts against 264, ahead in 25 trials and behind in 35 (p = 0.245). The setting as served found 140 against 138.

Past 16k tokens, E2B as served finds few facts. At temperature 0 with thinking off it found 51, 14, 9, 4 and 9 of 80 codes at 16k, 32k, 64k, 98k and 127k tokens. The 3050 found 52, 14, 7, 4 and 11.

Thinking on finds about twice as many. 226 facts against 127 with the same sampling and thinking off over 16k to 98k tokens, ahead in 42 trials and behind in 12 (p = 5.21e-5). At 98k its recall fell to 5 of 80, against 13 on the 3050.

A miss is a fact left out. In 1,840 recall answers across all settings, E2B gave no wrong code.

It finds what is near the start. As served, 48 of 111 codes in the first third of the document, 20 of 108 in the middle and 10 of 101 in the last.

Reading the document is the wait. 71.6 seconds for 16k tokens, 184 for 32k, 512 for 64k, 1,048 for 98k and 1,635 for 127k, at 232 down to 78 tokens per second.

What to do with it.

  • 🟢 A 4 GB card holds E2B with a 131k-token context and finds the same facts as an 8 GB card.
  • 🟢 Under 16k tokens, E2B as served finds about two codes in three, a request in 73 seconds from cold.
  • ⚠️ Longer than that, turn thinking on, and expect minutes per new document.
  • ❌ From 64k tokens a new document takes 8.5 to 27 minutes to read, and without thinking E2B finds at most 15% of the facts.

What Was Measured

Model Gemma 4 E2B, exact Q4_0 repack of Google's QAT weights
Card GTX 1650 Ti Max-Q laptop GPU, 4 GB, driver 620.73.04
Host Intel i7-10750H, 16 GB
Server llama.cpp 7182ef7, one request at a time, 131,072-token context
Document lengths 16,384 to 126,976 tokens
Tasks recall (8 codes) and linking (8 cities, two facts each)
Trials 10 per length and task, the same 10 as the 3050 run
Settings 6, listed in Step 2

At This Point You Should Have…

  • An NVIDIA card with 4 GB, here a GTX 1650 Ti laptop GPU
  • llama.cpp built with CUDA, here commit 7182ef7
  • Python 3
  • A clone of gemma4-dev

Step 1 — The Same Test as the 3050

The test is the one from Benchmarking Gemma 4 E2B with Long Contexts. The document is the NVIDIA Linux driver README, cut to each length, with short made-up sentences inserted at line breaks. Recall hides eight access codes and asks for all of them as JSON. Linking hides two sentences per project, its lead and the lead's office, and asks for each project's city.

The access code for project Cobalt is 858622.

Project Ember is led by Mei Chen.

Mei Chen works from the Cusco office.

Each reply is scored by code, 0 to 8 facts per trial, 80 per length and task.

The README is copied from the 3050 host and checked by SHA-256, because this laptop's driver README differs. Every request sent the same number of prompt tokens as its twin on the 3050, so the two runs pair trial by trial. The prompt cache is off, so every request reads its whole document.


Step 2 — Six Settings

Setting Cache Drafter Sampling Thinking
As served f16 1 token temperature 0 off
No drafter f16 none temperature 0 off
q8_0 cache q8_0 1 token temperature 0 off
q4_0 cache q4_0 1 token temperature 0 off
Google's sampling f16 none temperature 1.0, top-k 64, top-p 0.95 off
Google's sampling, thinking on f16 none temperature 1.0, top-k 64, top-p 0.95 on

Two settings follow this card's own serving: the drafter drafts 1 token, where the 3050 drafted 2, and E2B's per-layer table stays in system RAM. The no-drafter and sampled settings match the 3050's exactly, so for them the card is the only difference.

The q8_0 and q4_0 settings ran at 16k and 32k. The other four ran out to 127k; with thinking on, 127k leaves too little room in the context for the thinking, so that setting stops at 98k.


Step 3 — Recall by Length

Codes found, of 80, 1650 Ti / 3050:

Length 16k 32k 64k 98k 127k
As served 51 / 52 14 / 14 9 / 7 4 / 4 9 / 11
No drafter 52 / 49 15 / 20 11 / 11 7 / 5 5 / 8
Google's sampling 49 / 51 20 / 32 7 / 10 10 / 3 10 / 10
Google's sampling, thinking on 🥇 55 / 53 🥇 38 / 38 🥇 30 / 34 5 / 13 not run

At 16k every setting finds about two codes in three on both cards. From 64k on, the settings without thinking find at most 11 of 80. Thinking on still finds 30 at 64k, and drops to 5 at 98k here, below the 10 that thinking off found.


Step 4 — Linking Two Facts

Cities found, of 80, 1650 Ti / 3050:

Length 16k 32k 64k 98k 127k
As served 20 / 21 9 / 14 6 / 1 12 / 11 6 / 3
No drafter 16 / 19 13 / 13 1 / 1 11 / 12 0 / 2
Google's sampling 11 / 12 14 / 12 6 / 3 10 / 9 4 / 7
Google's sampling, thinking on 🥇 35 / 32 🥇 24 / 42 🥇 16 / 32 🥇 23 / 20 not run

Thinking on leads at every length on both cards. Here it found 98 cities against the 3050's 126, ahead in 11 trials and behind in 19 (p = 0.2): fewer, within chance for ten trials per length.


Step 5 — The Two Cards, Trial by Trial

Each trial ran with the same document and facts on both cards. A trial counts as ahead when one card found more of its 8 facts; the p-value is an exact sign test on those trials. All lengths each setting ran, recall and linking together:

Setting Facts, 1650 Ti / 3050 Trials ahead / behind p
As served 140 / 138 +11 / −10 1
No drafter 131 / 140 +10 / −11 1
q8_0 cache 94 / 97 +2 / −5 0.453
q4_0 cache 68 / 70 +6 / −9 0.607
Google's sampling 141 / 149 +16 / −19 0.736
Google's sampling, thinking on 226 / 264 +25 / −35 0.245

None holds after correcting for the 24 tests this article runs (Holm). The settings at temperature 0 agree closely: as served, the two cards differed on 52 of 800 facts.

The sampled settings use the same seed per trial on both cards, and their replies still part ways early, so they agree on fewer facts and pair less tightly.


Step 6 — Thinking, the Drafter and the Cache

The same pairing within the 1650 Ti run:

Comparison Lengths Facts Trials ahead / behind p After correcting for 24 tests
Thinking on vs off, both sampled 16k to 98k 226 / 127 +42 / −12 5.21e-5 holds
Thinking on vs as served 16k to 98k 226 / 125 +47 / −12 5.13e-6 holds
No drafter vs as served all five 131 / 140 +8 / −13 0.383 level
Google's sampling, thinking off, vs as served all five 141 / 140 +20 / −20 1 level
q8_0 cache vs f16 16k, 32k 94 / 94 +3 / −4 1 level
q4_0 cache vs f16 16k, 32k 68 / 94 +3 / −12 0.0352 not beyond chance

The q4_0 cache found fewer facts here as on the 3050, and neither run's gap survives the correction. On memory it saves little: the server started at 2,400 MiB with q4_0, 2,518 with f16 and 2,596 with q8_0.

The drafter's gain shrinks with length on this card: generation 1.24x no drafter at 16k, 1.14x at 64k and 1.01x at 127k.


Step 7 — Time

Medians of the 20 requests at each length, as served:

Length Reading the document Reading speed vs 3050 Generation Whole request
16k 71.6 s 232 tok/s 12.8x 79.7 tok/s 72.7 s
32k 184.3 s 179 tok/s 13.3x 66.4 tok/s 187.9 s
64k 512.4 s 125 tok/s 13.8x 49.7 tok/s 517.3 s
98k 1,047.8 s 94 tok/s 14.0x 36.3 tok/s 1,050.3 s
127k 1,635.1 s 78 tok/s 14.2x 30.5 tok/s 1,638.3 s

Reading is almost the whole wait, and the gap to the 3050 widens with length. Generation runs at 0.36 to 0.49 of the 3050's with the drafter. With thinking on, replies grew to a median of 631 tokens and each request took 8.4 to 24.4 seconds longer than with thinking off. The card drew a median of 39.6 W at the end of a request.

These are cold reads, with the prompt cache off. In a conversation that keeps the document in context, llama.cpp reuses what it has read; how much of the wait that saves on this card was not measured here.


🔎 Tip: Price a Long Document in Minutes Before You Send It

On a small card, the length of the document sets the wait more than the length of the answer. Time one cold request at the length you plan to send: here it was 73 seconds at 16k and 27 minutes at 127k. If the answer needs a fresh document each time, keep it short; if it needs one long document asked many times, keep it in context so it is read once.


Compare and Contrast

1650 Ti, 4 GB 3050, 8 GB
Card memory at start, as served 🥇 2,518 MiB 3,802 MiB
Facts found, as served 140 of 800 138 of 800
Facts found, thinking on 226 of 640 🥇 264 of 640
Reading 16k / 127k 71.6 s / 1,635 s 🥇 5.6 s / 115 s
Generation, 16k, as served 79.7 tok/s 🥇 161.7 tok/s
Drafter at 16k 1.24x, 1 token 🥇 1.68x, 2 tokens

Pros and cons

  • 1650 Ti. 🟢 Holds a 131k-token context in 2,326 to 2,596 MiB and finds the same facts. ❌ 13 to 14 times slower to read a new document, so long documents cost minutes.
  • 3050. 🟢 Reads 127k tokens in under 2 minutes and generates twice as fast. ❌ Twice the card, and no more facts found.

So, Which One?

Under 16k tokens (about 9,000 words): E2B as served, on either card. It finds about two codes in three; on the 1650 Ti a cold request takes about 73 seconds.

Longer documents: cut them down before E2B sees them. From 32k tokens on, E2B as served found at most 14 of 80 codes on either card. Thinking on with Google's sampling settings finds about twice as many and here still missed more than half at every length from 32k; each new document also takes 3.1 to 17.5 minutes to read on this card.

Card: the 4 GB one, for short documents. The 8 GB card reads 12 to 15 times faster and finds the same facts.

Cache: f16. q8_0 and q4_0 save no memory worth having, and q4_0 found fewer facts on both cards.


Summary

The goal of this article was to find whether Gemma 4 E2B uses a long document as well on a 4 GB card as on an 8 GB one. The key to the solution was sending both cards byte-identical documents with the same facts and seeds, and pairing the replies trial by trial. The results were:

  • 🟢 Same facts found: as served 140 against 138, no setting different beyond chance.
  • 🟢 The whole 131k-token context fits in 2,326 to 2,596 MiB of the 4 GB card.
  • 🟢 Thinking on found 226 facts against 127 with thinking off (p = 5.21e-5).
  • ⚠️ As served, E2B found 51 of 80 codes at 16k and 4 to 14 from 32k on.
  • ❌ Reading takes 71.6 seconds at 16k and 1,635 at 127k, 12.8x to 14.2x the 3050.

Scope: one GTX 1650 Ti Max-Q laptop GPU with 4 GB in one laptop, llama.cpp 7182ef7, Gemma 4 E2B as an exact Q4_0 repack of Google's QAT weights, one request at a time, 2026-11-27 to 30. The 3050 figures come from its run of 2026-11-25 and 26 on the same commit, weights and prompts, on a different host and driver. The drafter drafted 1 token here and 2 there, and the per-layer table sat in system RAM here and on the card there; the no-drafter and sampled settings differ only in the card and host. The q8_0 and q4_0 caches ran at 16k and 32k only. One document, the NVIDIA Linux driver README; ten trials per length and task. The article runs 24 paired tests; corrected for that number (Holm), the gains from thinking on hold and nothing else does. "Level" means no gap beyond chance.

The strategy for testing a small model with a long document on a 4 GB GPU was validated with an incremental step by step approach.


References

Hope you enjoyed it!

Top comments (0)