오픈소스 AI 커뮤니티(레딧)에서 'Qwen3.6 35B A3B Heretic'라는 이름의 비공식 파인튜닝(미세조정) 모델이 공개되어 화제입니다. 특히 데이터셋 유사도를 나타내는 지표인 KLD(쿨백-라이블러 발산) 값이 0.0015로 극도로 낮아 원본 모델의 성능을 매우 충실히 보존하면서도 특정 분야에서 강력한 성능을 발휘하는 것으로 평가받고 있습니다. 공유된 코드를 보면 이 모델은 복잡한 채팅 템플릿과 이미지·비디오 처리, 함수 호출(Function Calling) 기능을 완벽하게 지원하도록 고도화된 것으로 확인됩니다.
번역된 본문
이 게시글은 사용자가 레딧에 공유한 새로운 AI 모델 'Qwen3.6 35B A3B Heretic'의 소스 코드 일부입니다.
공유된 코드는 모델이 사용자와 상호작용하는 방식을 정의하는 '채팅 템플릿(Chat Template)'의 핵심 로직을 담고 있습니다. 이 템플릿은 시스템 메시지, 사용자 질문, AI 답변을 구조적으로 처리하며, 텍스트뿐만 아니라 이미지와 비디오 입력도 원활하게 처리할 수 있도록 설계되었습니다.
또한, AI가 스스로 외부 도구나 API를 호출할 수 있게 해주는 함수 호출(Function Calling) 기능이 정교하게 구현되어 있습니다. 사용 가능한 도구 목록을 인식하고, 사용자의 요청이 들어오면 정해진 XML 형식에 맞춰 필요한 매개변수를 채워 함수를 실행하는 고급 추론 과정을 거치도록 유도합니다. 예외 처리(에러 방지) 로직도 매우 꼼꼼하게 작성되어 있어, 개발자들이 이 모델을 다양한 서비스에 안정적으로 연동할 수 있도록 배려한 흔적이 돋보입니다.
","pad_token":"<|endoftext|>","unk_token":null},"chat_template_jinja":"{%- set image_count = namespace(value=0) %}\r\n{%- set video_count = namespace(value=0) %}\r\n{%- macro render_content(content, do_vision_count, is_system_content=false) %}\r\n {%- if content is string %}\r\n {{- content }}\r\n {%- elif content is iterable and content is not mapping %}\r\n {%- for item in content %}\r\n {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}\r\n {%- if is_system_content %}\r\n {{- raise_exception('System message cannot contain images.') }}\r\n {%- endif %}\r\n {%- if do_vision_count %}\r\n {%- set image_count.value = image_count.value + 1 %}\r\n {%- endif %}\r\n {%- if add_vision_id %}\r\n {{- 'Picture ' ~ image_count.value ~ ': ' }}\r\n {%- endif %}\r\n {{- '<|vision_start|><|image_pad|><|vision_end|>' }}\r\n {%- elif 'video' in item or item.type == 'video' %}\r\n {%- if is_system_content %}\r\n {{- raise_exception('System message cannot contain videos.') }}\r\n {%- endif %}\r\n {%- if do_vision_count %}\r\n {%- set video_count.value = video_count.value + 1 %}\r\n {%- endif %}\r\n {%- if add_vision_id %}\r\n {{- 'Video ' ~ video_count.value ~ ': ' }}\r\n {%- endif %}\r\n {{- '<|vision_start|><|video_pad|><|vision_end|>' }}\r\n {%- elif 'text' in item %}\r\n {{- item.text }}\r\n {%- else %}\r\n {{- raise_exception('Unexpected item type in content.') }}\r\n {%- endif %}\r\n {%- endfor %}\r\n {%- elif content is none or content is undefined %}\r\n {{- '' }}\r\n {%- else %}\r\n {{- raise_exception('Unexpected content type.') }}\r\n {%- endif %}\r\n{%- endmacro %}\r\n{%- if not messages %}\r\n {{- raise_exception('No messages provided.') }}\r\n{%- endif %}\r\n{%- if tools and tools is iterable and tools is not mapping %}\r\n {{- '<|im_start|>system\\n' }}\r\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n<tools>\" }}\r\n {%- for tool in tools %}\r\n {{- \"\\n\" }}\r\n {{- tool | tojson }}\r\n {%- endfor %}\r\n {{- \"\\n</tools>\" }}\r\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\r\n {%- if messages[0].role == 'system' %}\r\n {%- set content = render_content(messages[0].content, false, true)|trim %}\r\n {%- if content %}\r\n {{- '\\n\\n' + content }}\r\n {%- endif %}\r\n {%- endif %}\r\n {{- '<|im_end|>\\n' }}\r\n{%- else %}\r\n {%- if messages[0].role == 'system' %}\r\n {%- set content = render_content(messages[0].content, false, true)|trim %}\r\n {{- '<|im_start|>system\\n' + content + '<|im_end|>\\n' }}\r\n {%- endif %}\r\n{%- endif %}\r\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\r\n{%- for message in messages[::-1] %}\r\n {%- set index = (messages|length - 1) - loop.index0 %}\r\n {%- if ns.multi_step_tool and message.role == \"user\" %}\r\n {%- set content = render_content(message.content, false)|trim %}\r\n {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}\r\n {%- set ns.multi_step_tool = false %}\r\n {%- set ns.last_query_index = index %}\r\n {%- endif %}\r\n {%- endif %}\r\n{%- endfor %}\r\n{%- if ns.multi_step_tool %}\r\n {{- raise_exception('No user query found in messages.') }}\r\n{%- endif %}\r\n{%- for message in messages %}\r\n {%- set content = render_content(message.content, true)|trim %}\r\n {%- if message.role == \"system\" %}\r\n {%- if not loop.first %}\r\n {{- raise_exception('System message must be at the beginning.') }}\r\n {%- endif %}\r\n {%- elif message.role == \"user\" %}\r\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\r\n {%- elif message.role == \"assistant\" %}\r\n {%- set reasoning_content = '' %}\r\n {%- if message.reasoning_content is string %}\r\n {%- set reasoning_content = message.reasoning_content %}\r\n {%- else %}\r\n {%- if '</think>' in content %}\r\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\r\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\r\n {%- endif %}\r\n {%- endif %}\r\n {%- set reasoning_content = reasoning_content|trim %}\r\n {%- if (preserve_thinking is defined and preserve_thinking is true) or (loop.index0 > ns.last_query_index) %}\r\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content }}\r\n {%- else %}\r\n {{- '<|im_start|>' + message.role + '\\n' + content }}\r\n {%- endif %}\r\n {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}\r\n {%- for tool_call in message.tool_calls %}\r\n {%- if tool_call.function is defined %}\r\n {%- set tool_call = tool_call.function %}\r\n {%- endif %}\r\n {%- if loop.first %}\r\n {%- if content|trim %}\r\n {{- '\\n\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\r\n {%- else %}\r\n {{- '<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\r\n {%- endif %}\r\n {%- else %}\r\n {{- '\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\r\n {%- endif %}\r\n {%- if tool_call.arguments is defined %}\r\n {%- for args_name, args_value in tool_call.arguments|items %}\r\n {{- '<parameter=' + args_name + '>\\n' }}\r\n {%- set args_value = args_value | string if args_value is string else args_value | tojson | safe %}\r\n {{- args_value }}\r\n {{- '\\n</parameter>\\n' }}\r\n {%- endfor %}\r\n {%- endif %}\r\n {{- '</function>\\n</tool_call>' }}\r\n {%- endfor %}\r\n {%- endif %}\r\n {{- '<|im_end|>\\n' }}\r\n {%- elif message.role == \"tool\" %}\r\n {%- if loop.previtem and loop.previtem.role != \"tool\" %}\r\n {{- '<|im_start|>user' }}\r\n {%- endif %}\r\n {{- '\\n<tool_response>\\n' }}\r\n {{- content }}\r\n {{- '\\n</tool_response>' }}\r\n {%- if not loop.last and loop.nextitem.role != \"tool\" %}\r\n {{- '<|im_end|>\\n' }}\r\n {%- elif loop.last %}\r\n {{- '<|im_end|>\\n' }}\r\n {%- endif %}\r\n {%- else %}\r\n {{- raise_exception('Unexpected message role.') }}\r\n {%- endif %}\r\n{%- endfor %}\r\n{%- if add_generation_prompt %}\r\n {{- '<|im_start|>assistant\\n' }}\r\n {%- if enable_thinking is defined and enable_thinking is false %}\r\n {{- '<think>\\n\\n</think>\\n\\n' }}\r\n {%- else %}\r\n {{- '<think>\\n' }}\r\n {%- endif %}\r\n{%- endif %}"},"createdAt":"2026-04-20T18:37:09.000Z","discussionsDisabled":false,"discussionsSorting":"recently-created","downloads":630,"downloadsAllTime":630,"id":"llmfan46/Qwen3.6-35B-A3B-uncensored-heretic","isLikedByUser":false,"availableInferenceProviders":[],"showHuggingChatEntry":false,"inference":"","lastModified":"2026-04-25T01:43:26.000Z","likes":21,"pipeline_tag":"image-text-to-text","library_name":"transformers","librariesOther":[],"trackDownloads":true,"model-index":null,"private":false,"repoType":"model","gated":false,"tags":["transformers","safetensors","qwen3_5_moe","image-text-to-text","heretic","uncensored","decensored","abliterated","conversational","base_model:Qwen/Qwen3.6-35B-A3B","base_model:finetune:Qwen/Qwen3.6-35B-A3B","license:apache-2.0","endpoints_compatible","region:us"],"tag_objs":[{"id":"image-text-to-text","label":"Image-Text-to-Text","type":"pipeline_tag","subType":"multimodal"},{"id":"transformers","label":"Transformers","type":"library"