Views
No views yet

rnj-1 refers to the base model, while rnj-1-instruct refers to the post-trained instruction tuned model.rnj-1
rnj-1-instructrnj-1-instruct is strong at code, math, and STEM tasks. It also performs well within agentic frameworks such as mini-swe-agent and has stellar tool use abilities.
rnj-1 and rnj-1-instruct models are being made available for the community to extend and build upon. We deliberately kept post-training limited to allow for further specialization by the community. As an indicator of the untapped potential of the models we report pass@{1,2,4,8} (with T=0.2, n=8 generations) for hard codegen, agentic, and math benchmarks on rnj-1-instruct. These illustrate the model’s potential for test-time scaling and for further domain-specialization. The base model is similarly capable of specialization to other domains different from our post-training if needed.
rnj-1-instruct helping us make an early version of this chart.rnj-1-instruct and rnj-1 demonstrate strong code generation abilities as measured on tasks like HumanEval+, MBPP+, BigCodeBench, and LiveCodeBench v6. Both models compete with the strongest open weight models, sometimes outperforming even larger models such as GPT OSS 20B. We measured code comprehension abilities using the task of predicting inputs given outputs and vice-versa, Crux-IO. We find our models outperform comparable baselines. For multi-lingual code generation capabilities across programming languages we measure MultiPL-E on 6 languages (C++, TypeScript, Java, JavaScript, Shell, PHP) and we find performance close to the strongest model.rnj-1-instruct dominates the pack on agentic coding, one of our target abilities. SWE-bench performance is indicative of the model’s ability to tackle everyday software engineering tasks. The model is an order of magnitude stronger than comparably sized models on SWE-bench and approaches the capabilities available in much larger models. It scores 20.8% on SWE-bench Verified in bash-only mode, which is higher than Gemini 2.0 flash and Qwen2.5-Coder 32B Instruct under the same agentic framework (leaderboard).rnj-1-instruct is able to use a profiler to iteratively improve the performance of the code it writes. For instance, on Enamel, which measures abilities to write efficient solutions to algorithmic problems, the model outperforms all other models under the same setting.rnj-1-instruct surpasses comparable models in tool use performance as measured by the Berkeley Functional Calling Leaderboard (BFCL).rnj-1 exhibits strong infilling abilities, which have been further enhanced during post-training. The base model rnj-1 scores highly on HE-FIM-Python (avg) at 82.49% and rnj-1-instruct achieves 86.21%.rnj-1-instruct shows strong mathematical abilities across several levels of difficulty from elementary math (GSM8k), high school and undergraduate math (Minerva-MATH), and competition math (AIME ‘24 and ‘25). On harder subjects, it outcompetes or is on par with the strongest model in the pack.rnj-1-instruct exhibits long-context reasoning abilities that are needed to solve hard science and technical questions in GPQA-Diamond and SuperGPQA.rnj-1-instruct can operate in agentic mode to create a playable game in a single shot inside of Cline: screen recording.rnj-1-instruct functions seamlessy within the agentic framework of mini-swe-agent. Given a task such as fixing an issue described in a pull request (PR), fixing a security vulnerability, or writing performant code, it is able to reason across its full context across multiple turns to solve the task. These lead to “trajectories” which are pairs of “Assistant” and “User” turns. Here are a few recordings that show the model’s reasoning abilities across these turns: 1) a SWE task of identifying coding convention violation: screen recording, 2) fixing a security vulnerability: screen recording, 3) diagnosing code performance bottlenecks by running a profiler in the environment and iteratively improving the code: screen recording.rnj-1-instruct can work in interactive chat mode to solve a data analysis and visualization task: screen recording.| Hyperparameter | Value |
|---|---|
| Total Parameters | 8.3B |
| Number of Layers | 32 |
| Model Dimension | 4096 |
| MLP Dimension | 16384 |
| Number of Attention Heads | 32 |
| Number of Key-Value Heads | 8 |
| Attention Head Dimension | 128 |
| Vocabulary Size | 128K |
| Pretrain Context Length | 8K |
| Context Length | 32K |
| Activation Function | GeGLU |
| Tied Embeddings? | Yes |
rnj-1 was pre-trained on 8.4T tokens with an 8K context length, after which the model’s context window was extended to 32K through an additional 380B-token mid-training stage. A final 150B-token SFT stage completed the training to produce rnj-1-instruct.config.json:1@@
2- "max_position_embeddings": 32768,
3+ "max_position_embeddings": 131072,
4
5@@
6- "sliding_window": 32768,
7+ "sliding_window": 131072,
8
9@@
10 "rope_scaling": {
11 "attn_factor": 1.0,
12 "beta_fast": 64.0,
13 "beta_slow": 1.0,
14 "extrapolation_factor": 1.0,
15- "factor": 4.0,
16+ "factor": 16.0,
17 "original_max_position_embeddings": 8192,
18 "rope_type": "yarn"
19 },| Category | Evals | Rnj-1-instruct | Rnj-1-instruct (128k) |
|---|---|---|---|
| Coding | MBPP+ | 75.7 | 75.7 |
| Coding | HE+ | 83.5 | 82.3 |
| Coding | BigCodeBench-full | 57.1 | 55.3 |
| Math | AIME 25 | 43.3 | 53.3 |
| Math | GSM8k | 92.6 | 91.1 |
| Math | Minerva-MATH-500 | 88.4 | 89.4 |
| Science | MMLU-STEM | 81.8 | 69.4 |
| Science | GPQA-Diamond | 38.9 | 41.4 |
| Env evals | SWE-bench (bash) | 20.8 | 20.1 |
| Env evals | Performance: Enamel | 49.0 | 39.9 |
| FIM | HE single-line | 94.9 | 93.5 |
| FIM | HE multi-line | 77.6 | 76.5 |
| FIM | HE random-span | 86.1 | 85.1 |
You are a helpful assistant. is a good default prompt to use.rnj-1-instruct.rnj-1-instruct if the system prompt is omitted. Provide an appropriate system prompt, e.g., “You are a helpful assistant”, along with global task needs to steer the model’s responses in the desired direction.4.51.21import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3import os
4
5model_id = "EssentialAI/rnj-1-instruct"
6os.environ["HF_TOKEN"] = <YOUR-HF-TOKEN>
7
8print(f"Loading model: {model_id}...")
9model = AutoModelForCausalLM.from_pretrained(
10 model_id,
11 dtype=torch.bfloat16,
12 device_map="auto",
13)
14tokenizer = AutoTokenizer.from_pretrained(model_id)
15
16print("Model and tokenizer loaded successfully.")
17
18messages = [
19 {"role": "system", "content": "You are a helpful AI assistant."}, # Optional system message
20 {"role": "user", "content": "Who are you?"}
21]
22
23input_ids = tokenizer.apply_chat_template(
24 messages,
25 add_generation_prompt=True,
26 return_tensors="pt"
27).to(model.device)
28
29# --- Generate Prediction --- #
30print("Generating prediction...")
31output_ids = model.generate(
32 input_ids,
33 max_new_tokens=50,
34 pad_token_id=tokenizer.eos_token_id,
35 do_sample=True,
36 temperature=0.2,
37 top_p=0.95
38)
39
40response = tokenizer.decode(output_ids[0][input_ids.shape[-1]:], skip_special_tokens=True)
41print(response)hermes tool-call parser. The tool calls are formatted inside <tool_call> and </tool_call> tags.
An example usage is as follows:1tools = [
2 {
3 "type": "function",
4 "function": {
5 "name": "get_weather",
6 "description": "Get the current weather in a given location",
7 "parameters": {
8 "type": "object",
9 "properties": {
10 "location": {"type": "string", "description": "City and state, e.g., 'San Francisco, CA'"},
11 "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
12 },
13 "required": ["location", "unit"],
14 },
15 },
16 },
17]
18
19messages = [
20 {"role": "system", "content": "You are a helpful AI assistant."}, # Optional system message
21 {"role": "user", "content": "What is the weather in San Francisco, CA in Celsius?"}
22]
23
24input_ids = tokenizer.apply_chat_template(
25 messages,
26 tools=tools,
27 add_generation_prompt=True,
28 return_tensors="pt"
29).to(model.device)
30
31# --- Generate Prediction --- #
32print("Generating prediction...")
33output_ids = model.generate(
34 input_ids,
35 max_new_tokens=200,
36 pad_token_id=tokenizer.eos_token_id,
37 do_sample=True,
38 temperature=0.2,
39 top_p=0.95
40)
41
42response = tokenizer.decode(output_ids[0][input_ids.shape[-1]:], skip_special_tokens=False)
43# NOTE: skip_special_tokens is set to False.
44print(response)1PRE = "<|pre_fim|>"
2MID = "<|mid_fim|>"
3SUF = "<|suf_fim|>"
4
5prefix = """def binary_search(arr, target):
6 lo = 0
7 hi = len(arr) - 1
8
9 while lo <= hi:
10"""
11
12suffix = """
13 return -1
14"""
15
16input = PRE + prefix + SUF + suffix + MID
17
18messages = [
19 {"role": "system", "content": "You are a helpful AI assistant."},
20 {"role": "user", "content": input}
21]
22
23input_ids = tokenizer.apply_chat_template(
24 messages,
25 tools=tools,
26 add_generation_prompt=True,
27 return_tensors="pt"
28).to(model.device)
29
30# --- Generate Prediction --- #
31print("Generating prediction...")
32output_ids = model.generate(
33 input_ids,
34 max_new_tokens=100,
35 pad_token_id=tokenizer.eos_token_id,
36 do_sample=True,
37 temperature=0.2,
38 top_p=0.95
39)
40
41response = tokenizer.decode(output_ids[0][input_ids.shape[-1]:], skip_special_tokens=False)
42print(response)vllm serve EssentialAI/rnj-1-instructvllm serve EssentialAI/rnj-1-instruct --enable-auto-tool-choice --tool-call-parser hermespython3 -m sglang.launch_server --model EssentialAI/rnj-1-instructvirtualenv:1git checkout eai
2pip install -e .
3export TOGETHER_API_KEY="..." # set this to your Together.AI access key
4
5# use EssentialAI/rnj-1-instruct to solve a performance optimization task
6mini-extra perf-single [--instance <k>]
7# use EssentialAI/rnj-1-instruct to resolve a SWE PR description
8mini-extra swebench-single [--instance <k>]1@misc{rnj1_instruct,
2 title = {{Rnj-1-Instruct}},
3 author = {Ashish Vaswani and Mike Callahan and Adarsh Chaluvaraju and Aleksa Gordić and Devaansh Gupta and Yash Jain and Divya Mansingka and Philip Monk and Khoi Nguyen and Mohit Parmar and Michael Pust and Tim Romanski and Peter Rushton and Ali Shehper and Divya Shivaprasad and Somanshu Singla and Kurt Smith and Saurabh Srivastava and Anil Thomas and Alok Tripathy and Yash Vanjani and Ameya Velingker and {{Essential AI}}},
4 year = {2025},
5 url = {https://huggingface.co/EssentialAI/rnj-1-instruct},
6 note = {Instruction-tuned model release}
7}