Skip to content

Instantly share code, notes, and snippets.

View Anemll's full-sized avatar

Anemll Anemll

View GitHub Profile
@Anemll
Anemll / README.md
Last active September 20, 2026 16:32
Pi: keep the newest four images for DeepSeek Spark requests without changing saved history

Pi image-history filter for DeepSeek on Spark

Work around this vLLM error without restarting the model server:

At most 4 image(s) may be provided in one prompt. (parameter=image)

Pi sends images from retained conversation history, not just the latest turn. This extension keeps the newest four images in each outgoing request and

@Anemll
Anemll / TPS_PI_EXTENSION.md
Last active September 15, 2026 03:50
Model-neutral Pi extension for live decode TPS, TTFT, server-side prefill TPS, and whole-request elapsed time (v2)

Live decode TPS, TTFT & prefill throughput for Pi (v2)

A model-neutral throughput footer for Pi, validated against @earendil-works/pi-coding-agent 0.85.1.

It observes Pi's standard assistant-stream events, so it works with local and hosted models. For real server-side prefill throughput it can optionally read Prometheus metrics (e.g. vLLM /metrics); prefix caching is handled correctly, which client-side usage.input cannot.

@Anemll
Anemll / FFN_SPLIT_PREFILL.md
Last active September 13, 2026 02:43
M5 ANE INT8/W8A8 1 MiB coefficient-window slowdown: shared vs per-channel weight scales; standalone native eval_us reproducer

M5 W8A8 FFN expansion: splits and prefill vectors

The complete 2048 -> 8192 projection becomes about 2.1–2.5x faster when split into 2/4/8 output-channel branches on this M5. TP2 is a strong default for this tested shape; more splits do not consistently improve it. These are sequential branches in one ANE graph, not distributed tensor parallelism.

All measurements below include the full output: one native evaluation of all branches and concatenation. Compile/load time and external application overhead are excluded. This is an expansion projection, not a full gated FFN (no gate, activation, or down projection).

Shared weight scale

Vectors TP1 µs TP2 µs TP4 µs TP8 µs TP2 speedup TP2 µs/vector
@Anemll
Anemll / README.md
Last active September 13, 2026 20:42
ANE KernelDMA 1 MiB prefetch-notch profiler (M1 Max / M3 Ultra / M4 / M5). eval_us, not wall clock. No ANEC 1MiB DMA-split flag.
@Anemll
Anemll / KDA_ALGORITHM.md
Last active July 16, 2026 23:41
Kimi Delta Attention (KDA): algorithm, pseudocode, flow diagram, and vLLM PR #27654 analysis
@Anemll
Anemll / README.md
Created June 9, 2026 22:25
AFM-in-Pi

Pi Coding Agent + Apple Foundation Models

This gist shows a working local Pi provider setup for Apple's fm serve Chat Completions endpoint.

It supports both Apple Foundation Models exposed by the fm CLI:

  • fm/system: on-device Apple Foundation Model, configured as 4K context
  • fm/pcc: Private Cloud Compute model, configured as 32K context
@Anemll
Anemll / README.md
Created June 9, 2026 22:12
Pi Coding Agent configuration for Apple Foundation Models via fm serve

Pi Coding Agent + Apple Foundation Models

This gist shows a working local Pi provider setup for Apple's fm serve Chat Completions endpoint.

It supports both Apple Foundation Models exposed by the fm CLI:

  • fm/system: on-device Apple Foundation Model, configured as 4K context
  • fm/pcc: Private Cloud Compute model, configured as 32K context
@Anemll
Anemll / README.md
Created March 8, 2026 16:14
ANE INT8 W8A8 Benchmark: ~1.88x FP16 Throughput on Apple Silicon

ANE INT8 W8A8 Benchmark: ~1.7-1.9x FP16 Throughput on Apple Silicon

Demonstrates that Apple Neural Engine (ANE) achieves significantly higher throughput with INT8 W8A8 quantization vs FP16, consistent with native INT8 datapath support.

Results (M5, h17g, single ANE cluster)

Summary

Method FP16 INT8 W8A8 Ratio
@Anemll
Anemll / test.swift
Last active June 10, 2025 00:42
Test Apple Foundation Model t/s
import FoundationModels
import Playgrounds
import Foundation
let session = LanguageModelSession()
let start = Date()
let response = try await session.respond(to: "What is Apple Neural Engine and how to use it?")
let responseText = response.content // Replace 'value' with the actual property name from LanguageModelSession.Response<String> that holds the string payload.
print(responseText)
let end = Date()