broken-model / Q2_PartB.py
KR-16's picture
Q1, Q2, Q3 solutions
c1eaeaa verified
Raw History Blame Contribute Delete
2.71 kB
"""
Q2 Part B: reasoning_effort Parameter Analysis
Problem:
--------
When users include a reasoning_effort parameter in requests to this model, it has
no observable effect on the generated output.
Root Cause:
-----------
• The model (Qwen3ForCausalLM) is a standard causal language model, not a reasoning-capable
model. Only specialized models like OpenAI's o1 or o3 series support reasoning_effort.
• The inference engine doesn't recognize or process the reasoning_effort parameter. It's
either ignored or passed through without any logic to actually use it.
• There's no code that maps the reasoning_effort value to any model generation parameters.
• The model cannot generate intermediate reasoning tokens. Since it generates output tokens
directly without a reasoning phase, there's nothing for the parameter to control.
Requirements to Make reasoning_effort Functional:
--------------------------------------------------
• Use a reasoning-capable model architecture:
- Replace with o1, o3, or similar reasoning-capable models
- Or fine-tune existing model to support reasoning token generation
- Model must have built-in capability to generate reasoning tokens
• Update the inference engine:
- Add code to parse reasoning_effort parameter from API requests
- Implement logic to generate reasoning tokens
- Add token classification to distinguish reasoning tokens from output tokens
- Map effort levels (low/medium/high) to reasoning parameters
- Pass reasoning_effort to model's forward pass
• Modify the API server:
- Add reasoning_effort to request schema validation
- Accept parameter from client requests
- Pass parameter through to inference engine
- Handle reasoning tokens separately in response formatting
- Optionally return reasoning tokens in API response
• Update model configuration:
- Add reasoning_config section to config.json
- Configure max_reasoning_tokens based on effort level
- Specify reasoning token IDs
- Define reasoning_effort_levels supported
• Implement architectural changes:
- Create token routing pipeline to separate reasoning and output tokens
- Add logic to control reasoning depth/length based on effort level
- Update token stream processing to handle reasoning vs output distinction
Summary:
--------
This isn't a simple configuration fix. It requires:
• Architectural changes (reasoning-capable model + engine support)
• Implementation changes (API server + token processing)
• Configuration updates (model config + reasoning settings)
The current model simply doesn't have the capability to support this feature.
"""