Views
No views yet

| Model | Easy Tasks | Hard Tasks |
|---|---|---|
| Qwen3-4B-Instruct-2507 (Base) | 44.0% | 2.1% |
| Jupyter Agent Qwen3-4B Instruct | 70.8% | 3.4% |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "jupyter-agent/jupyter-agent-qwen3-4b-instruct"
4
5# Load model and tokenizer
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForCausalLM.from_pretrained(
8 model_name,
9 torch_dtype="auto",
10 device_map="auto"
11)
12
13# Prepare input
14prompt = "Analyze this sales dataset and find the top 3 performing products by revenue."
15messages = [
16 {"role": "user", "content": prompt}
17]
18
19text = tokenizer.apply_chat_template(
20 messages,
21 tokenize=False,
22 add_generation_prompt=True
23)
24model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
25
26# Generate response
27generated_ids = model.generate(
28 **model_inputs,
29 max_new_tokens=16384
30)
31output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()1response = tokenizer.decode(output_ids, skip_special_tokens=True)
2print("Response:", response)1tools = [
2 {
3 "type": "function",
4 "function": {
5 "name": "execute_code",
6 "description": "Execute Python code in a Jupyter environment",
7 "parameters": {
8 "type": "object",
9 "properties": {
10 "code": {
11 "type": "string",
12 "description": "Python code to execute"
13 }
14 },
15 "required": ["code"]
16 }
17 }
18 },
19 {
20 "type": "function",
21 "function": {
22 "name": "final_answer",
23 "description": "Provide the final answer to the question",
24 "parameters": {
25 "type": "object",
26 "properties": {
27 "answer": {
28 "type": "string",
29 "description": "The final answer"
30 }
31 },
32 "required": ["answer"]
33 }
34 }
35 }
36]
37
38# Include tools in the conversation
39messages = [
40 {
41 "role": "system",
42 "content": "You are a data science assistant. Use the available tools to analyze data and provide insights."
43 },
44 {"role": "user", "content": prompt}
45]assistant_loss_only=True)

1@misc{jupyteragentqwen3instruct,
2 title={Jupyter Agent Qwen3-4B Instruct},
3 author={Baptiste Colle and Hanna Yukhymenko and Leandro von Werra},
4 year={2025},
5 publisher={Hugging Face},
6 url={https://huggingface.co/jupyter-agent/jupyter-agent-qwen3-4b-instruct}
7}