Skip to content

feat: add MiniCPM5-2B model - #1571

Open
barhanc wants to merge 4 commits into
mainfrom
@bh/minicpm5
Open

barhanc wants to merge 4 commits into
mainfrom
@bh/minicpm5

Conversation

@barhanc

@barhanc barhanc commented Oct 22, 2026

Copy link
Copy Markdown
Member

Description

Adds MiniCPM5-2B https://huggingface.co/openbmb/MiniCPM5-2B as a substitute for Qwen 3.5 whose hybrid architecture doesn't work well with our runtime.

Introduces a breaking change?

  • Yes
  • No

Type of change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update (improves or adds clarity to existing documentation)
  • Other (chores, tests, code style improvements etc.)

Tested on

  • iOS
  • Android

Testing instructions

Screenshots

Related issues

Closes #935

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional notes

@barhanc barhanc self-assigned this Oct 22, 2026
@barhanc barhanc added the feature PRs that implement a new feature label Oct 22, 2026
@barhanc
barhanc requested a review from msluszniak October 22, 2026 20:48
@barhanc barhanc added the model Issues related to exporting, improving, fixing ML models label Oct 22, 2026
@msluszniak

Copy link
Copy Markdown
Member

Plesse address "unknown word" warnings. I will test the PR today.

@msluszniak

Copy link
Copy Markdown
Member

MiniCPM5 hits maxNewTokens: 512 while still thinking (the template always opens <think>), so no answer or tool call is produced. Raise it to ~2048+?

@msluszniak

Copy link
Copy Markdown
Member

@barhanc the HF tokenizer_config.json dropped upstream's enable_thinking switch and always appends <think>\n, so thinking can't be turned off.

@msluszniak

msluszniak commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Forced thinking + tools makes it overthink trivial prompts on iPhone 16 (XNNPACK): bat-and-ball 2370 tokens / 149 s, "My name is Mateusz and I live in Kraków" 2449 tokens / 174 s, almost all of it debating tool calls. Same on MLX, where the Kraków prompt also triggers unrequested get_weather + get_outfit_recommendation calls and the reply is an outfit suggestion. Default thinking off in the demo?

Comment thread apps/nlp/constants/llm.ts
Comment on lines +665 to +674
systemPrompt: DEFAULT_SYSTEM_PROMPT,
toolOpts: MINICPM5_TOOL_OPTS,
},
{
id: 'minicpm-5-2b-mlx',
name: 'MiniCPM5 2B',
backend: 'mlx',
model: models.llm.MINICPM5_2B.MLX_INT4,
generationConfig: MINICPM5_GENERATION_CONFIG,
systemPrompt: DEFAULT_SYSTEM_PROMPT,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Polish questions get English answers with the default prompt; this fixes it on device.

Suggested change
systemPrompt: DEFAULT_SYSTEM_PROMPT,
toolOpts: MINICPM5_TOOL_OPTS,
},
{
id: 'minicpm-5-2b-mlx',
name: 'MiniCPM5 2B',
backend: 'mlx',
model: models.llm.MINICPM5_2B.MLX_INT4,
generationConfig: MINICPM5_GENERATION_CONFIG,
systemPrompt: DEFAULT_SYSTEM_PROMPT,
systemPrompt: `${DEFAULT_SYSTEM_PROMPT}. Always reply in the language of the user's latest message.`,
toolOpts: MINICPM5_TOOL_OPTS,
},
{
id: 'minicpm-5-2b-mlx',
name: 'MiniCPM5 2B',
backend: 'mlx',
model: models.llm.MINICPM5_2B.MLX_INT4,
generationConfig: MINICPM5_GENERATION_CONFIG,
systemPrompt: `${DEFAULT_SYSTEM_PROMPT}. Always reply in the language of the user's latest message.`,

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature PRs that implement a new feature model Issues related to exporting, improving, fixing ML models

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding support for Qwen 3.5

2 participants