LogicFlow-Gemma-3-27b-thinking is an advanced multimodal reasoning model built upon google/gemma-3-27b-it, specifically designed to excel at complex logical reasoning, mathematical problem-solving, and step-by-step analytical thinking. This model represents a significant advancement in AI reasoning capabilities, achieved through careful fine-tuning on three specialized, high-quality datasets using LoRA (Low-Rank Adaptation) technique.
Key Innovations
This unique combination of datasets creates a model that not only provides correct answers but also demonstrates how it arrives at those answers, making it particularly valuable for educational applications, research, and any scenario requiring explainable AI reasoning.
The model demonstrates enhanced capabilities in:
Logical Reasoning: Improved ability to work through complex logical problems step by step
Mathematical Problem Solving: Enhanced performance on mathematical reasoning tasks (76.8% MATH, 13.3% AIME25)
Chain-of-Thought Reasoning: Superior step-by-step thinking with detailed reasoning chains and self-verification
Structured Analysis: Improved at breaking down complex problems into manageable components
Multi-Method Verification: Uses multiple approaches to validate results and ensure accuracy
Vision Understanding: Ability to analyze and reason about images, charts, diagrams, and visual data
Multimodal Reasoning: Combining visual and textual information for comprehensive analysis
Model Details
Model Type: Multimodal Language Model (Gemma-3 Architecture)
Base Model: google/gemma-3-27b-it
Parameters: 27 billion parameters
Fine-tuning Method: LoRA (Low-Rank Adaptation) with merge
Context Length: 131,072 tokens
Architecture: Gemma-3 with vision capabilities
Precision: bfloat16
Image Resolution: 896x896 pixels, encoded to 256 tokens per image
Supported Formats: Text + Images (JPEG, PNG, WebP)
Training Details
Training Data
The model was fine-tuned on three carefully selected, high-quality datasets that form the foundation of its exceptional reasoning capabilities:
OpenO1-SFT Dataset
Purpose: Supervised fine-tuning for advanced reasoning patterns
Content: High-quality reasoning demonstrations with explicit thought processes
Impact: Enables the model to break down complex problems systematically and show transparent reasoning chains
Open-Thoughts Dataset
Purpose: Step-by-step thinking process modeling
Content: Detailed internal monologues and reasoning progressions for various problem types
Impact: Teaches the model to externalize its thinking process, making reasoning transparent and verifiable
OpenR1-Math Dataset
Purpose: Mathematical reasoning and problem-solving specialization
Content: Comprehensive mathematical problems with detailed solution methodologies
Impact: Significantly enhances performance on mathematical reasoning tasks, from basic arithmetic to advanced competition-level problems
This synergistic combination creates a model that excels not only at providing accurate answers but also at demonstrating clear, verifiable reasoning processes.
Training Configuration
Core Training Parameters
Learning Rate: 5e-05
Epochs: 5.0
Optimizer: AdamW (adamw_torch)
LR Scheduler: Cosine with 100 warmup steps
Max Gradient Norm: 1.0
Max Samples: 100,000
Precision: bfloat16 (bf16: true)
Batch Configuration
Per Device Train Batch Size: 2
Gradient Accumulation Steps: 8
Total Effective Batch Size: 32
Packing: Disabled (false)
LoRA Configuration
Fine-tuning Type: LoRA
LoRA Rank (r): 8
LoRA Alpha: 16
LoRA Dropout: 0.0
LoRA Target: all (comprehensive layer targeting)
Sequence and Vision Parameters
Cutoff Length: 2,048 tokens
Image Max Pixels: 589,824
Image Min Pixels: 1,024
Video Max Pixels: 65,536
Video Min Pixels: 256
Flash Attention: auto
Freeze Vision Tower: true
Freeze Multi-modal Projector: true
Special Features
Template: gemma (Optimized for multimodal reasoning tasks)
Trust Remote Code: true (Required for advanced vision capabilities)
Preprocessing Workers: 16 (Optimized for multimodal data processing)
Save Steps: 100 (Frequent checkpointing for training stability)
Logging Steps: 5 (Detailed training monitoring)
Training Results
Training Loss Curve
The model training included comprehensive loss tracking and visualization. The training loss curve below shows the convergence pattern over the 41,400 training steps across 5 epochs:
Training Loss
The loss curve demonstrates stable convergence with the final training loss reaching 0.003759, indicating effective learning without overfitting.
Benchmark Performance
Comprehensive Evaluation Results
Benchmark
Metric
Base Gemma-3-27B-IT
LogicFlow-Gemma-3-27b-thinking
Improvement
Mathematical Reasoning
GSM8K
5-shot
82.6%
89.5%
+6.9%
MATH
5-shot
50.0%
76.8%
+26.8%
Code Generation
MBPP
pass@1
65.6%
69.0%
+3.4%
HumanEval
0-shot
48.8%
Pending
TBD
Instruction Following
IFEval
Prompt-level
45.0%
40.0%
-5.0%
IFEval
Instruction-level
58.0%
53.1%
-4.9%
Advanced Mathematics
AIME25
5-shot
~8-12%
13.3%
+1-5%
Scientific Reasoning
GPQA Diamond
5-shot
~30-35%
45.96%
+11-16%
Knowledge & Understanding
MMLU
Overall Accuracy
78.6%
75.3%
-3.3%
MMLU STEM
Sciences & Math
~70.0%
71.6%
+1.6%
MMLU Humanities
Arts & Literature
~67.0%
69.2%
+2.2%
MMLU Social Sciences
Psychology & Economics
~82.0%
84.3%
+2.3%
MMLU Other
Professional & Medical
~77.0%
79.2%
+2.2%
Key Performance Insights
Significant Improvements
Mathematical Reasoning: Exceptional improvements - GSM8K (+6.9%) and MATH (+26.8%) demonstrate enhanced step-by-step problem solving
Advanced Mathematics: Massive 26.8% improvement on MATH benchmark showcases superior mathematical reasoning capabilities
Scientific Reasoning: Outstanding 45.96% accuracy on GPQA Diamond - significantly above typical model performance (30-35%)
Competition Mathematics: Solid 13.3% performance on AIME25 - competing with leading models on elite mathematical competitions
1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
34# Load model and tokenizer5model_name ="RekklesAI/LogicFlow-Gemma-3-27b-thinking"6tokenizer = AutoTokenizer.from_pretrained(model_name)7model = AutoModelForCausalLM.from_pretrained(8 model_name,9 torch_dtype=torch.bfloat16,10 device_map="auto"11)1213# Example usage for reasoning tasks14prompt ="""Solve this step by step:
15If a train travels 120 km in 2 hours, and then 180 km in the next 3 hours, what is its average speed for the entire journey?
1617Let me think through this step by step:"""1819inputs = tokenizer(prompt, return_tensors="pt")20with torch.no_grad():21 outputs = model.generate(22**inputs,23 max_new_tokens=512,24 do_sample=True,25 top_p=0.95,26 top_k=64,27 temperature=0.728)2930response = tokenizer.decode(outputs[0], skip_special_tokens=True)31print(response)
Multimodal Usage (Text + Image)
python
1from transformers import AutoProcessor, Gemma3ForConditionalGeneration
2from PIL import Image
3import requests
4import torch
56# Load model and processor7model_name ="RekklesAI/LogicFlow-Gemma-3-27b-thinking"8model = Gemma3ForConditionalGeneration.from_pretrained(9 model_name,10 torch_dtype=torch.bfloat16,11 device_map="auto"12)13processor = AutoProcessor.from_pretrained(model_name)1415# Load an image (example: a mathematical diagram or chart)16url ="https://example.com/math-diagram.jpg"17image = Image.open(requests.get(url, stream=True).raw)1819# Create a multimodal prompt for step-by-step analysis20prompt ="""<start_of_image>Analyze this mathematical diagram step by step.
21What mathematical concepts are being illustrated, and how would you solve any problems shown?
2223Please provide a detailed, step-by-step explanation."""2425# Process the inputs26model_inputs = processor(text=prompt, images=image, return_tensors="pt")2728# Generate response29input_len = model_inputs["input_ids"].shape[-1]30with torch.inference_mode():31 generation = model.generate(32**model_inputs,33 max_new_tokens=1024,34 do_sample=True,35 top_p=0.95,36 temperature=0.737)38 generation = generation[0][input_len:]3940# Decode the response41response = processor.decode(generation, skip_special_tokens=True)42print(response)
Chat Template Usage
This model uses the standard Gemma 3 multimodal chat template with optimized formatting:
Text-only Chat
python
1messages =[2{"role":"system","content":"You are a helpful AI assistant specialized in logical reasoning and mathematics."},3{"role":"user","content":"Explain the reasoning behind the Pythagorean theorem and provide a step-by-step proof."}4]56input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)7inputs = tokenizer(input_text, return_tensors="pt")89outputs = model.generate(10**inputs,11 max_new_tokens=1024,12 do_sample=True,13 top_p=0.95,14 temperature=0.715)1617response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)18print(response)
Multimodal Chat (with Images)
python
1from PIL import Image
23# Load an image4image = Image.open("path/to/your/image.jpg")56messages =[7{8"role":"user",9"content":"Analyze this chart and explain the trends you observe. What mathematical relationships can you identify?",10"images":[image]# Include image in the message11}12]1314# Use processor for multimodal inputs15model_inputs = processor.apply_chat_template(16 messages,17 add_generation_prompt=True,18 return_tensors="pt"19)2021outputs = model.generate(22**model_inputs,23 max_new_tokens=1024,24 do_sample=True,25 top_p=0.95,26 temperature=0.727)2829response = processor.decode(outputs[0], skip_special_tokens=True)30print(response)
Chat Template Format
The model uses the following multimodal template format:
{{- bos_token }}
{%- for message in messages %}
{%- if message['role'] == 'system' %}
{{- '<start_of_turn>system\n' + message['content'] + '<end_of_turn>\n' }}
{%- elif message['role'] == 'user' %}
{{- '<start_of_turn>user\n' }}
{%- if 'images' in message and message['images'] %}
{%- for image in message['images'] %}
{{- '<start_of_image>\n<end_of_image>\n' }}
{%- endfor %}
{%- endif %}
{{- message['content'] + '<end_of_turn>\n' }}
{%- elif message['role'] == 'assistant' %}
{{- '<start_of_turn>model\n' + message['content'] + '<end_of_turn>\n' }}
{%- endif %}
{%- endfor %}
{%- if add_generation_prompt and messages[-1]['role'] != 'assistant' %}
{{- '<start_of_turn>model\n' }}
{%- endif %}
Step-by-Step Reasoning Examples
LogicFlow-Gemma-3-27b-thinking demonstrates exceptional reasoning capabilities through detailed Chain-of-Thought (CoT) processes. Below are real examples showcasing the model's thinking methodology:
Example 1: Mathematical Comparison
Question: "9.11 and 9.9, which one is larger?"
CoT Example 1
The model demonstrates sophisticated numerical reasoning by:
Converting decimals to fractional comparisons (11/100 vs 90/100)
Using multiple verification methods (number line visualization, real-world applications)
Calculating the precise difference (0.79) to confirm the result
Providing comprehensive step-by-step analysis
Example 2: Letter Counting Task
Question: "How many r's are in the word strawberry?"
CoT Example 2
The model showcases systematic thinking through:
Letter-by-letter breakdown of the word "strawberry"
Cross-checking results using different methodologies
Clear documentation of the reasoning process
These examples demonstrate the model's ability to:
Break down complex problems into manageable steps
Self-verify results using multiple approaches
Document reasoning chains for transparency
Maintain accuracy while showing work
Activating Chain-of-Thought Reasoning
To get the best reasoning performance from LogicFlow-Gemma-3-27b-thinking, use prompts that encourage step-by-step thinking:
python
1# Example prompt for mathematical reasoning2prompt ="""Please solve this problem step by step, showing your thinking process:
34Question: Compare 9.11 and 9.9. Which number is larger?
56Think through this carefully and show your work."""78# Example prompt for logical reasoning 9prompt ="""Let me work through this systematically:
1011Question: How many times does the letter 'r' appear in the word 'strawberry'?
1213Please show your step-by-step analysis."""1415# For complex problems, you can explicitly request thinking16prompt ="""Think step by step about this problem:
1718[Your complex question here]
1920Show your reasoning process before giving the final answer."""
Pro Tips for Best Results:
Use phrases like "step by step", "think through this", "show your work"
For math problems, request multiple verification methods
Ask for reasoning before the final answer
Use temperature settings around 0.7 for optimal reasoning creativity
Intended Use Cases
This multimodal model is particularly well-suited for:
Educational Applications
Chain-of-Thought Tutoring: Demonstrates complete problem-solving processes with transparent reasoning steps
Mathematical Education: Shows multiple verification methods for mathematical concepts (as seen in 9.11 vs 9.9 example)
Critical Thinking Development: Models systematic analysis and self-verification techniques
Visual Learning: Analyzing educational diagrams, charts, and mathematical illustrations
Interactive Learning: Combining text and visual elements for comprehensive understanding
Mathematical & Scientific Analysis
Chart Analysis: Interpreting graphs, statistical charts, and data visualizations
Geometric Problem Solving: Analyzing geometric figures and spatial relationships
Scientific Diagram Understanding: Processing scientific illustrations and technical drawings
Formula Recognition: Understanding mathematical formulas in images
Professional Applications
Document Analysis: Processing documents containing both text and visual elements
Technical Documentation: Understanding technical manuals with diagrams
Data Visualization: Analyzing and explaining complex charts and infographics
Research Assistance: Combining textual research with visual data analysis
Advanced Reasoning Tasks
Chain-of-Thought Problem Solving: Complex reasoning with detailed step-by-step analysis and self-verification
Multi-Method Validation: Using multiple approaches to verify answers (numerical comparison, pattern analysis, etc.)
If you use this model in your research or applications, please cite:
bibtex
1@model{logicflow-gemma-3-27b-thinking,
2 title={LogicFlow-Gemma-3-27b-thinking: A Fine-tuned Model for Enhanced Reasoning},
3 author={[Xiangda Li]},
4 year={2025},
5 base_model={google/gemma-3-27b-it},
6 url={https://huggingface.co/RekklesAI/LogicFlow-Gemma-3-27b-thinking}
7}
Acknowledgments
Based on Google's Gemma-3-27B-IT model
Fine-tuned using LLaMA-Factory framework
Training data from open-source reasoning and mathematics datasets
This model card was generated to provide comprehensive information about the LogicFlow-Gemma-3-27b-thinking model. Please refer to the original Gemma-3 model documentation for additional technical details about the base architecture.