Thanks to visit codestin.com
Credit goes to gist.github.com

Skip to content

Instantly share code, notes, and snippets.

View Anemll's full-sized avatar

Anemll Anemll

View GitHub Profile
@Anemll
Anemll / TPS_PI_EXTENSION.md
Created September 13, 2026 06:29
Model-neutral Pi extension for live decode TPS, TTFT, and prompt-rate estimates

Live decode TPS and TTFT for Pi

This guide adds a model-neutral throughput indicator to Pi. It was validated against @earendil-works/pi-coding-agent 0.85.1.

The extension works with local and hosted models because it observes Pi's standard assistant-stream events. It does not read vLLM logs or metrics and does not depend on a particular model name.

@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()