BAR

BAR-2x7B-Code

BAR-2x7B-Code is Ai2’s open-weight coding model built with the Branch-Adapt-Route method. It combines two active FlexOlmo experts, offers a 65,536-token context window, and is designed for local code generation, private deployment, and research rather than a managed API.

Text Reasoning Coding
BAR-2x7B-Code is Ai2’s code-specialized Branch-Adapt-Route model for developers and researchers who want an openly available coding checkpoint they can run and adapt themselves. It combines two active experts in a FlexOlmo mixture-of-experts design, uses code-focused post-training that includes reinforcement learning from verifiable rewards, and provides a long 65,536-token context window. The trade-off is that it requires self-managed infrastructure: Ai2 does not document a first-party hosted API, token pricing, or enterprise service for this exact checkpoint.
Outputs

What BAR-2x7B-Code can produce

Text
Inputs

What it can understand

Text
Model profile

Performance characteristics

5/10 Reasoning
8/10 Coding
5/10 Speed
8/10 Cost efficiency
Specifications

Technical details

Family BAR
Type Coding
Context window 66K tokens
Max output tokens tokens
Release date 2026-04-19
Status Current open-weight model
Knowledge cutoff notes

No authoritative knowledge-cutoff date is published for this exact checkpoint.

Model notes

BAR-2x7B-Code is an open-weight FlexOlmo causal language model in Ai2's Branch-Adapt-Route suite. It is built on Olmo 2 7B and trained as a code expert through mid-training, supervised fine-tuning, and reinforcement learning from verifiable rewards. The model has two experts with both active per token, approximately 12 billion parameters, 32 transformer layers, a hidden size of 4096, and a 65,536-token context window. The repository is released under Apache 2.0 and provides local Transformers, vLLM, and SGLang usage examples. No official hosted token pricing or provider-managed inference API is documented for this exact checkpoint. Evaluation values reported by Ai2 include an overall score of 38.8 and a code-category score of 50.4; these are research benchmark aggregates, not standardized commercial ratings. The exact model's knowledge cutoff is not documented in the authoritative model materials.

Model guide

BAR-2x7B-Code: Ai2’s Open-Weight Model for Local Coding

BAR-2x7B-Code is an open-weight coding model from the Allen Institute for AI (Ai2). It uses the Branch-Adapt-Route method and a two-expert FlexOlmo mixture-of-experts architecture built on Olmo 2 7B. With approximately 12 billion parameters, a 65,536-token context window, Apache 2.0 licensing, and support for local Transformers, vLLM, and SGLang deployment, it is aimed at code generation, programming assistance, and research rather than managed API workloads.

What is BAR-2x7B-Code?

BAR-2x7B-Code is an open-weight causal language model developed by the Allen Institute for AI, commonly known as Ai2. It is designed specifically for programming and software-development tasks, including code generation, code completion, explanation, and transformation.

The model belongs to Ai2’s Branch-Adapt-Route, or BAR, research series. BAR separates domain-specific post-training into branches and then combines those branches in a mixture-of-experts model. In practical terms, Ai2 can develop a code-focused expert independently and integrate it with another expert rather than producing only one conventional dense checkpoint.

The published checkpoint is available as allenai/BAR-2x7B-Code on Hugging Face. It is released under the Apache 2.0 license, making it suitable for local experimentation, inspection, quantization, and adaptation subject to the license terms.

How the model is built

BAR-2x7B-Code is built on Olmo 2 7B and uses Ai2’s FlexOlmo causal-language-model architecture. It has two experts, and both experts are active for each token. The “2x7B” name describes the underlying expert arrangement, while the repository identifies the complete model as having approximately 12 billion parameters.

This architecture is different from a model that activates only one expert for each token. Because both experts are active, the full model weights need to be available during inference. The mixture-of-experts design therefore does not automatically make deployment as light as running a single small 7-billion-parameter dense model.

Ai2 describes the Code branch as having gone through code-focused mid-training, supervised fine-tuning, and reinforcement learning from verifiable rewards. The reinforcement-learning stage is an important distinction from the separate BAR Code SFT checkpoint, which does not include that later stage. BAR-2x7B-Code should therefore be evaluated as the reinforcement-learning code checkpoint, not as an interchangeable name for every BAR coding release.

Technical specifications and context window

SpecificationBAR-2x7B-Code
ProviderAllen Institute for AI (Ai2)
Model familyBAR
Model typeOpen-weight coding language model
ArchitectureFlexOlmo mixture of experts
Experts2 total, with both active per token
Approximate parameter count12 billion
Base modelOlmo 2 7B
Transformer layers32
Hidden size4,096
Attention heads32 query heads and 32 key/value heads
Context window65,536 tokens
Tensor typebfloat16
LicenseApache 2.0

The 65,536-token context window is useful for tasks that involve several source files, long functions, technical documentation, or large error logs. It is a maximum context specification, not a guarantee that every deployment will have enough memory to use the full window efficiently. Available memory, inference-engine settings, quantization, and concurrent workloads can affect practical limits.

The supplied model materials do not document a separate maximum output-token limit. Applications should therefore avoid assuming that the entire 65,536-token allowance can be used for generated output; the context window includes the relevant input and output context handled by the deployment.

Coding performance and capabilities

BAR-2x7B-Code is primarily a code-generation model rather than a general-purpose assistant with a broad set of hosted product features. It is intended for programming tasks such as producing snippets, transforming existing code, explaining implementation choices, and assisting with private development workflows.

Ai2’s published evaluation reports an overall score of 38.8 and a code-category score of 50.4 for BAR-2x7B-Code. The code-category result is higher than the 49.3 reported for the BAR Code SFT checkpoint in the same table. These figures are provider-reported research evaluation aggregates, not universal measures of programming quality or guarantees for a particular repository. Results may change with prompts, language, task type, decoding settings, and evaluation methodology.

There is no evidence in the supplied materials that BAR-2x7B-Code is a dedicated reasoning model with a separate reasoning mode or hidden chain-of-thought product feature. Its reinforcement learning from verifiable rewards may improve performance on some code tasks, but that should not be interpreted as a documented general reasoning capability.

In editorial terms, its strongest differentiator is the combination of code specialization, open weights, a long context window, and a permissive license. Its coding focus makes it more directly relevant to local developer assistance than a similarly sized general language model, while its architecture and hardware requirements make it less convenient than a lightweight dense checkpoint.

Deployment and API availability

Ai2 provides usage examples for loading the model with Hugging Face Transformers. The repository also documents serving options involving vLLM and SGLang, including OpenAI-compatible local endpoints. These tools can make the model easier to integrate into applications, but they are deployment frameworks rather than an Ai2-managed service.

No official hosted inference API, token-based price, subscription plan, or uptime commitment is documented for this exact checkpoint in the supplied research. The price of using BAR-2x7B-Code therefore depends on the operator’s own hardware, cloud instance, storage, electricity, and engineering costs. The Apache 2.0 license can reduce software licensing friction, but it does not eliminate infrastructure costs.

The repository size is approximately 23.3 GB in bfloat16 according to the supplied research. Full-precision operation can consequently require substantial memory, especially when the long context window and multiple concurrent requests are included. Quantization may reduce the hardware burden, but the research does not specify a single supported quantization format or a guaranteed performance level for quantized deployments.

Inputs, outputs, and tool support

BAR-2x7B-Code accepts text and produces text. It does not natively accept images, audio, or video, and it does not generate non-text media. This makes it appropriate for source code, prompts, documentation, and text-based logs, but not for workflows that require visual understanding, speech processing, or media generation.

The model card does not document a provider-managed web-search tool, native function-calling contract, JSON-schema structured-output API, official batch API, or official prompt-caching service for this checkpoint. Developers can build application-level wrappers around a local endpoint, but such wrappers should not be confused with capabilities guaranteed by the model itself.

Streaming behavior, fine-tuning support as a managed feature, and structured-output guarantees are not documented as official features for this exact checkpoint. A local serving framework may expose additional transport or generation options, but those are properties of the chosen deployment stack and should be verified separately.

Main strengths and limitations

Strengths

  • Code specialization: The model is trained and evaluated for programming-oriented use rather than being only a general language model.
  • Open availability: Developers can inspect and run the weights locally instead of depending on a hosted provider endpoint.
  • Long context: The 65,536-token window can accommodate substantial code and documentation inputs.
  • Permissive licensing: Apache 2.0 supports many commercial and research deployment patterns, subject to the license terms.
  • Deployment flexibility: Transformers, vLLM, and SGLang usage paths support different local or self-hosted setups.

Limitations

  • Infrastructure responsibility: Users must provide and operate the inference environment because no first-party managed API is documented.
  • Memory requirements: Both experts are active and the bfloat16 checkpoint is approximately 23.3 GB, before accounting for runtime overhead and long-context memory.
  • No multimodal support: The documented model interface is text in and text out.
  • No documented native tools: Web search, function calling, JSON-schema output, caching, and batch APIs are not established features for this checkpoint.
  • Unspecified knowledge cutoff: Ai2 does not publish an authoritative knowledge-cutoff date for the exact model.
  • No managed service guarantees: Pricing, availability, latency, support, and uptime depend on the operator’s deployment.

When to choose BAR-2x7B-Code

Choose BAR-2x7B-Code when you need an openly available coding model that can run in a private or offline environment. It is a reasonable candidate for local code generation, programming explanations, code transformation, repository-level experiments, and research into modular post-training or mixture-of-experts systems.

It is especially attractive when control over model weights and data matters more than turnkey hosting. Teams can inspect the checkpoint, choose an inference engine, tune the deployment, and potentially adapt the model without sending source code to a third-party API. The long context window may also help with tasks involving multiple related files, although actual usefulness will depend on available hardware and prompt construction.

A hosted coding service or smaller dense model may be more appropriate when the priority is simple integration, predictable per-request billing, low operational overhead, or very low latency. A multimodal model is a better fit for applications that must inspect screenshots, diagrams, audio, or video. A model with documented tool calling or structured-output guarantees is preferable when reliable orchestration, schema validation, or web retrieval is central to the application.

BAR-2x7B-Code is therefore best viewed as a self-hosted research and development checkpoint, not as a drop-in replacement for a managed production coding API. Its value comes from the balance of code specialization, open licensing, and deployment control; its costs come from hardware, operations, and the absence of provider-managed features.


Answers to Frequently Asked Questions

What are the main limitations of BAR-2x7B-Code?
The model requires substantial memory because both experts are active and the bfloat16 checkpoint is approximately 23.3 GB before runtime overhead. It supports text input and text output only, and there are no documented native guarantees for web search, function calling, JSON-schema outputs, prompt caching, batch APIs, or managed production support.
Can BAR-2x7B-Code be run locally, and is there an official API?
BAR-2x7B-Code can be run locally or in a self-hosted environment using tools such as Hugging Face Transformers, vLLM, and SGLang. No official Ai2-managed hosted API, pricing plan, uptime commitment, or token-based service is documented for this checkpoint, so users must provide and operate the required infrastructure.
How long is BAR-2x7B-Code’s context window?
BAR-2x7B-Code has a maximum context window of 65,536 tokens. This can support large source files, multiple related files, documentation, and lengthy error logs, although practical usage depends on available memory, quantization, inference settings, and concurrent workloads.
What is BAR-2x7B-Code?
BAR-2x7B-Code is an open-weight causal language model from the Allen Institute for AI (Ai2) designed for programming tasks such as code generation, completion, explanation, and transformation. The published checkpoint is available as allenai/BAR-2x7B-Code on Hugging Face under the Apache 2.0 license.
What does the 2x7B architecture of BAR-2x7B-Code mean?
BAR-2x7B-Code uses Ai2’s FlexOlmo mixture-of-experts architecture with two experts based on Olmo 2 7B. Both experts are active for every token, and the complete model contains approximately 12 billion parameters, so it does not have the same deployment requirements as a single 7-billion-parameter dense model.


Sources 5
AI Provider

About Allen Institute for Artificial Intelligence (Ai2)