# Show HN: Fixing grammar and spelling using on-device Apple Foundation Model

> Source: <https://github.com/huytd/afm-grammar/>
> Published: 2026-06-16 23:03:52+00:00

Grammar and spelling-fixing tool using Apple's Foundation Model, run locally on any Apple Silicon Macs.

Build the binary with:

``` bash
$ make
```

You will need to have Xcode installed to compile the Swift LLM bridge. The output of the build process is a `grammar-fix`

binary that you can run.

Run the command and pass the input string:

```
$ /grammar-fix "he eat two apple"

# output: He ate two apples.
```

For a while now, Apple devices shipped with an [on-device language model](https://developer.apple.com/documentation/foundationmodels/systemlanguagemodel). The model can be used for some writing tasks, but it's only accessible for Swift via the Foundation Models framework.

This project [bridged](https://github.com/huytd/afm-grammar/blob/main/LLMBridge.swift) the API and expose it as a [C function](https://github.com/huytd/afm-grammar/blob/main/LLMBridge.h), so we can use it for simple tasks like fixing grammar.
