Skip to content

huge performance gains with transformers fix - #52

Merged
tpae merged 1 commit into
mainfrom
feature/performance-upgrades
Sep 2, 2025
Merged

huge performance gains with transformers fix#52
tpae merged 1 commit into
mainfrom
feature/performance-upgrades

Conversation

@tpae

@tpae tpae commented Sep 2, 2025

Copy link
Copy Markdown
Contributor

Summary

I found latency issues with generateEvents function, and found out that swift-transformers package needed some optimization.

PR -> huggingface/swift-transformers#218
PR -> ml-explore/mlx-swift-examples#380

The results before:

Running warm-up: 3 server(s), 2 prompt(s), 1 iteration(s) each, concurrency=1 (excluded from results)...
Running benchmark against 3 server(s), 2 prompt(s), 10 iteration(s) each, concurrency=1, system_prompt=ON...

Summary:
- osaurus | llama-3.2-3b-instruct-4bit:
  success_rate=100.0%  ttft_avg=222.5ms  ttft_p50=214.7ms  ttft_p95=248.3ms  total_avg=1272.1ms  p50=1190.7ms  p95=2062.5ms  chars/s=480.1  bytes/s=480.1
- ollama | llama3.2:
  success_rate=100.0%  ttft_avg=58.3ms  ttft_p50=52.0ms  ttft_p95=90.5ms  total_avg=1632.0ms  p50=1485.5ms  p95=3009.4ms  chars/s=438.9  bytes/s=438.9
- lmstudio | llama-3.2-3b-instruct:
  success_rate=100.0%  ttft_avg=55.5ms  ttft_p50=50.5ms  ttft_p95=94.9ms  total_avg=1171.7ms  p50=1131.3ms  p95=2092.3ms  chars/s=623.0  bytes/s=623.0

The results after 🤯:

Running warm-up: 3 server(s), 2 prompt(s), 1 iteration(s) each, concurrency=1 (excluded from results)...
Running benchmark against 3 server(s), 2 prompt(s), 10 iteration(s) each, concurrency=1, system_prompt=ON...

Summary:
- osaurus | llama-3.2-3b-instruct-4bit:
  success_rate=100.0%  ttft_avg=84.2ms  ttft_p50=82.4ms  ttft_p95=87.4ms  total_avg=1330.3ms  p50=1192.0ms  p95=2433.8ms  chars/s=560.6  bytes/s=560.6
- ollama | llama3.2:
  success_rate=100.0%  ttft_avg=59.7ms  ttft_p50=52.0ms  ttft_p95=93.6ms  total_avg=1690.4ms  p50=1453.2ms  p95=3222.2ms  chars/s=439.4  bytes/s=439.4
- lmstudio | llama-3.2-3b-instruct:
  success_rate=100.0%  ttft_avg=55.5ms  ttft_p50=50.7ms  ttft_p95=92.8ms  total_avg=1143.6ms  p50=1092.0ms  p95=2087.0ms  chars/s=613.2  bytes/s=613.2

Checklist

  • I have read CONTRIBUTING.md
  • I added/updated tests where reasonable
  • I updated docs/README as needed
  • I verified build on macOS with Xcode 16.4+

@github-actions github-actions Bot added the enhancement New feature or request label Sep 2, 2025
@tpae

tpae commented Sep 2, 2025

Copy link
Copy Markdown
Contributor Author

Related to #47

@tpae
tpae merged commit b163c53 into main Sep 2, 2025
1 check passed
@tpae
tpae deleted the feature/performance-upgrades branch September 2, 2025 23:34
@tpae tpae added the released label Sep 12, 2025
tpae added a commit that referenced this pull request Mar 8, 2026
huge performance gains with transformers fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant