Improve factual reliability and Jinja2 compatibility in chat template

#15
by yasu-oh - opened

Summary

This PR proposes improvements to the MiniMax-M3.1-Flash chat template, primarily focusing on factual reliability, hallucination reduction, and standard Jinja2 compatibility.

MiniMax-M3.1-Flash demonstrates strong overall capabilities, but its AA-Omniscience v1.1 performance appears relatively weak compared with its results on other benchmarks.

Since AA-Omniscience penalizes incorrect answers, improving confidence calibration and reducing unsupported factual claims may help address this weakness.

The proposed changes are intentionally minimal and do not modify the model's special tokens, message structure, reasoning protocol, or tool-calling format.

Changes

1. Improve factual reliability and confidence calibration

Added general-purpose instructions to the system prompt to encourage the model to:

  • Distinguish known facts from unsupported assumptions.
  • Avoid plausible-sounding guesses when factual information is insufficient.
  • Exercise greater caution with exact names, dates, numbers, software versions, quotations, and citations.
  • Explicitly acknowledge uncertainty when an answer cannot be reliably determined.
  • Avoid claiming to have verified sources that were not actually checked.
  • Continue answering questions that can be solved through reliable reasoning or calculation.
  • Preserve the user's requested response format.

These instructions are task-agnostic and do not contain benchmark-specific answers, examples, or evaluation data.

2. Fix standard Jinja2 compatibility

Changed:

tojson(ensure_ascii=False)

to:

tojson

The original expression raises a TypeError with the standard Jinja2 3.1.x implementation because the tojson filter does not accept an ensure_ascii argument.

This change allows tool definitions to be serialized using the standard Jinja2 filter.

Compatibility

The modification preserves the existing:

  • MiniMax-specific message delimiters and special tokens.
  • Role mapping and conversation structure.
  • Thinking and reasoning tags.
  • Tool-call serialization format.
  • Image and video markers.

The JSON serialization change may affect the textual escaping of non-ASCII characters, while preserving their JSON values.

Validation

Basic Jinja2 rendering checks were performed for normal conversations and tool definitions.

However, these checks do not establish behavioral equivalence with the original template across all inputs.

Importantly, no inference-based A/B benchmark has been performed yet. Improvements to AA-Omniscience v1.1, hallucination rates, or general model accuracy have therefore not been demonstrated.

Expected Benefits

The primary goal is to improve factual answer calibration without unnecessarily reducing the model's ability to answer questions through reasoning.

Potential benefits include fewer unsupported factual claims, more appropriate abstention on uncertain questions, and improved reliability in knowledge-intensive tasks.

These remain hypotheses until validated through controlled evaluation.

Suggested Evaluation

I recommend comparing the original and modified templates under identical inference settings using AA-Omniscience v1.1 and complementary benchmarks.

Useful metrics would include:

  • Correct answer rate.
  • Incorrect answer rate.
  • Abstention rate.
  • AA-Omniscience net score.
  • Performance on reasoning, coding, and tool-use tasks.

The goal should be to reduce incorrect answers without introducing excessive abstention or degrading the model's existing strengths.

Feedback

I would appreciate feedback from the MiniMax team, particularly regarding whether system-level factual reliability guidance aligns with the model's intended instruction hierarchy and whether there are any compatibility considerations specific to its inference implementation.

Thank you for developing and releasing MiniMax-M3.1-Flash!

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment