· Local AI · Benchmarks
I ran deep research locally on a Mac with a 4B model
Andrey Chmerev
On my M4 Max, Ai2’s DR Tulu 2 4B in BF16 decoded at 52.5 tokens per second on a short prompt. I set the context window to 65,536 tokens for everyday use.
Changing the system prompt moved the model’s score from 8.25 to 8.85 out of 10 on eight research tasks. On a new set of questions, I tried three ways to make the model work in two passes. The single pass beat all three. On tasks where I could specify the formula, letting Python do the math helped.
Get it running

My M4 Max has 48 GB of unified memory. I used oMLX 0.7.3 and OpenCode 1.18.16. The official weights took about 8.5 GiB on disk. Ai2 release notes · Model weights
- Download the weights with the Hugging Face CLI. The command pins the revision I tested and saves it to the default oMLX model directory. If you changed that directory, use your path. Hugging Face CLI guide
hf download allenai/DR-Tulu2-4B \
--revision bde87918a2252548660c1ed7cdb46bc87fc341d9 \
--local-dir "$HOME/.omlx/models/DR-Tulu2-4B-BF16"
-
Start oMLX on
127.0.0.1:8000. In the model settings, select the text LLM override. Set the alias todr-tulu2-4b-bf16and the context limit to 65,536. I turned thinking off for document analysis. Check that/v1/modelslists the alias. oMLX setup -
Add oMLX to OpenCode as an OpenAI-compatible provider at
http://127.0.0.1:8000/v1. Use the same model alias, with 65,536 tokens of context and 4,096 for output. Enable tool calls for web research. You can keep the provider key in an environment variable or a local credential file. Selectomlx/dr-tulu2-4b-bf16in/models. OpenCode v1 provider configuration
Save this config as opencode.json for OpenCode 1.x. Put the V2 prompt in the same folder and set OMLX_API_KEY to your server’s key in the shell that launches OpenCode.
{
"$schema": "https://opencode.ai/config.json",
"instructions": ["./system-v2.txt"],
"provider": {
"omlx": {
"npm": "@ai-sdk/openai-compatible",
"name": "oMLX Local",
"options": {
"baseURL": "http://127.0.0.1:8000/v1",
"apiKey": "{env:OMLX_API_KEY}"
},
"models": {
"dr-tulu2-4b-bf16": {
"name": "DR Tulu 2 4B BF16",
"limit": { "context": 65536, "output": 4096 },
"tool_call": true
}
}
}
}
}
Once you have the weights, you can analyze documents and generate text offline. For live research, I started OpenCode v1 with OPENCODE_ENABLE_EXA=1 and enabled websearch and webfetch. Search sends queries to a search service, and fetch reads pages over the network. OpenCode v1 web tools
Speed and context on the M4 Max

For each weight format, I ran the same short Russian prompt three times in MLX after warm-up. Temperature was 0 and the output cap was 256 tokens. The table gives median decode speed and peak MLX memory.
| Weight format | Decode speed | Peak MLX memory |
|---|---|---|
| BF16 | 52.5 tok/s | 8.56 GB |
| Q8 | 91.5 tok/s | 4.72 GB |
| Q4 | 149.4 tok/s | 2.63 GB |
These measurements come from one 48 GB Mac. Leave room for longer prompts and the rest of macOS when you choose a context limit.
At 32,768 input tokens, BF16 took 24.2 seconds to produce its first token. MLX peaked at 13.02 GB. I tried an 8-bit KV cache too. It used 12.52 GB and took 26.1 seconds to get to the first token. I kept the standard cache.
Ai2 trained and evaluated at 128K context. The checkpoint config lists a 262,144-token ceiling. My own test was just a lookup. I placed three markers near the beginning, middle, and end of inputs of 61,440 and 124,000 tokens. The model found all three in both runs. The 124,000-token run took about three times as long, which is why I stayed at 64K. Ai2 technical report · Checkpoint config
What I tested

I started with one question across all three weight formats. I asked for annual births in Russia from 1990 to 2025, how Rosstat and UN figures compare, what drove changes, and projections to 2050. Each format got the same source extracts with temperature 0, thinking off, and an output cap of 6,144 tokens. BF16 scored 43/70. Q8 and Q4 both scored 37/70. All three got the 71 reference values right and mislabeled the unit. I kept BF16 for the rest of the tests.
The eight-task suite covered quantitative claims, conflicting revisions, causality, whether two benchmarks could be compared, missing inputs, and finding facts in long documents. One task used live search to compare NASA and NOAA. I scored each answer by hand, with equal weight for accuracy, sources, depth, completeness, logic, unsupported claims, and how current the evidence was.
I ran the seven document tasks through the local API at temperature 0, with thinking off and a 1,024-token output cap. For the NASA and NOAA task, OpenCode had up to two searches and two page reads. I averaged three live runs per instruction and ran the baseline once. NASA release · NOAA release
In a separate live run, I asked whether models under 8B outperform leading closed models. It took 235 seconds. The model searched four times, opened zero pages, and ran into the output cap.
The instruction that worked best

V2 asks the model to write down where each number came from, what it measures, and what period it covers. On the benchmark comparison, V1 pulled scores from different reports. With V2 it compared 62 and 58 from the same evaluation. It also used the right records for the calculation in the long archive.
The model still drew too strong a conclusion from a confidence interval. On the live web task, V2 scored 44, 42, and 62 out of 70. I’d used the errors from this suite to write the prompt variants, so the 8.85 came from retesting the same questions.
Use the text below as the system message for direct API calls. In OpenCode, save it as system-v2.txt and add it to the project’s instructions array. OpenCode instruction files
Answer in the user's language. Follow their requested format, tool limits, and length. Use the following procedure when applicable.
1. Evidence first. Make a short private list of the requested outputs and the exact records that support them. Keep one row per source, version, or experimental condition. Copy each number with its unit, denominator, date, and source label before using it. Treat dates of publication and revisions separately. When records disagree, keep their values separate, explain which governs the question, and account for any conflicting or secondary record the user named.
2. Compare like with like. Take both sides of any scored comparison from the same matched evaluation. Check metric, attempt budget, tools, sample and scale before comparing. Keep mismatched scores attached to their own reports. State the tested scope. Missing uncertainty means uncertainty is unknown.
3. Calculate before concluding. Use the requested metric and show the short equation. State the subtraction direction and check its sign against the inputs. For rate comparisons, distinguish percentage points from relative percent. If some inputs are missing, still give every requested quantity you can compute and name the inputs needed for the remaining quantities.
4. Calibrate the verdict. For an experiment, report the observed estimate and the interval separately. If the interval contains the null, report that the data leave the effect inconclusive, even when the design is randomized. List alternative explanations only when the evidence supports them. Match the verdict to the precise claim and scope.
5. In live research, open the relevant primary pages within the allowed tool budget. Take values, periods and dates from the opened page itself. Preserve its wording of baselines when useful. Cite the direct pages you used next to their claims. If a necessary page fails, state what remains unverified.
6. Final check: cover every requested item. Re-read all copied values, signs, source labels and links against their own records. Delete explanations, precision, and causal claims that have no evidence. Give the user the concise answer, calculations, citations, and material limitations.
What helped on seven new questions

I gave each workflow the same source material for seven new questions. The tasks covered an aggregation paradox, an equivalence test, missing revenue, report revisions, BEA GDP releases, UN population projections, and a long billing archive. It took 45 calls to the model, and I graded 31 final answers. The token counts include input and output for every call the workflow made. BEA initial release · BEA third release · UN 2022 release · UN 2024 release
| Workflow | Score /10 | Median time | Median tokens |
|---|---|---|---|
| V2, one pass over the source documents | 7.59 | 4.79 s | 937 |
| Two passes with a model-generated evidence table | 6.41 | 13.52 s | 2,246 |
| Two passes with a script checking that table | 5.96 | 11.63 s | 2,006 |
| Two passes with numbered references to source values | 7.27 | 12.16 s | 2,010 |
On the equivalence test, the model said the threshold came from the experiment report. It was in the trial plan. The checker caught the bad citation and dropped the row, so the second pass never saw the threshold.
On the billing task, the model found the right records and wrote the right formula. It still got 15,808 RUB. The correct total was 35,360 RUB. When Python did the math, the model reported the correct subtotal, fee, and total. I wrote the formulas by hand for that task and two others. Across those three cases, the average rose from 5.81 to 8.76/10.
The model got the cost per delivery right and still made a call about profitability without revenue data. When I know which inputs a report requires, I’d have the code check those too. If revenue is missing, I’d have Python mark profitability as unknown.
For my next research run, I’d use BF16 at 65,536 tokens and give V2 the original documents in one pass. For recurring reports, I’d put the formulas and required fields in Python, then have the model explain the result and cite the records.