Candle is Hugging Face’s Rust machine-learning framework. It gives developers control of model loading and inference. It does not provide a ready-made Mac chat app. Start with an upstream quantized-model example on Apple Silicon before writing your own application.

Install and build on Mac: Terminal

Install a current stable Rust toolchain from Rust’s official site, then confirm rustc --version and cargo --version. Install Apple’s developer tools if Git or the build requires them, and consult Apple’s Xcode documentation if a selected Metal feature requires additional components. Use a clean folder and clone Candle from its official repository.

git clone https://github.com/huggingface/candle.git
cd candle
cargo build -p candle-examples --example quantized --release --features metal
./target/release/examples/quantized --prompt "A quiet afternoon is"

The upstream example can fetch a tokenizer and model on its first run, so allow internet access for that setup. Read --help to choose a compatible local model and tokenizer when working without a network. A successful build does not mean that the selected weights fit in memory.

Verify it is running locally

Keep the working binary and its model files together for the offline repeat. If the binary starts but reports a missing tokenizer or weights file, check the local file paths first. Once a new prompt produces text, check Metal use separately if GPU acceleration is part of your goal.

After setup, rerun the same compiled binary with internet disconnected and a fresh prompt. If it still attempts a download, supply local copies explicitly using the flags shown in its help. If you want to prove GPU use rather than simply local execution, check Metal activity in Instruments or compare the example’s CPU-only mode separately. Do not assume GPU use merely because the build included the Metal feature.

Record the toolchain and build you want to reproduce

Use the official upstream repository and keep track of its commit. In the repository directory, record the outcome of git rev-parse HEAD, the Rust version and the host reported by rustc -vV. Check that the host architecture matches the Apple Silicon environment you intend to use. A shell running a different architecture can select different dependencies or produce the wrong expectation for a Metal build. After changing the shell or toolchain, record the new values next to the result.

Start with the upstream quantized example before modifying it. Run the build in the checkout whose revision you recorded. Save any error output without removing the beginning, where Cargo usually identifies the first dependency or file that failed. Compiling the binary successfully gives you evidence about the build only. The example may still need weights, tokenizer files and a supported runtime device before it can answer a prompt.

Keep the release binary path alongside the checkout and build options. If you compile again in a different directory or use a different target, confirm which binary you execute. This avoids diagnosing runtime behavior using an earlier binary that did not include the feature you intended to try. You can also keep a separate documented build for a CPU comparison. Record its binary and version so it remains distinguishable from the Metal candidate.

Prepare a complete set of runtime files

Run a small first setup while online and use a supported model explicitly documented for the example. The tool may fetch files the first time it needs a model. Keep the exact filename, revision or source identifier, and tokenizer configuration associated with it. A weight file and a tokenizer serve different purposes. The model uses the token IDs produced by a compatible tokenizer. Substituting an unrelated tokenizer can fail at load time or produce output that no longer matches the prompt’s intended format.

If the example lists downloadable quantizations, choose one that fits your machine and use the matching inference example. Record whether you followed a specific upstream quantized model path or supplied your own local files. Inspect the runner’s --help at the recorded revision for the available model and tokenizer options. Use the flag names shown there. The command interface can change as the project is revised, and an answer obtained with one binary does not establish which options are available in another.

Put the files for a cold offline launch in an ordinary local folder. When an option accepts a filename, record an absolute path or start in the intended working directory and record that directory. Keep weights and tokenizer outputs together with a text note identifying the model and the binary. If an initial example downloaded a cached file, preserve the actual runtime inputs rather than assuming the cache will be present after moving to another machine or user profile.

Before disconnecting, make one small request with the local files you intend to keep. For an instruction-capable model, choose a source and ask for a known field. If you are using a continuation model, use a short continuation prompt and define what a completed response looks like. The starter line from the upstream example can prove that the binary produces text. A known-answer check is needed when you want to assess whether it can do a particular task correctly. Keep those goals separate when describing a result.

Confirm local generation and check Metal independently

After the first run, close the process and disconnect. Open a new terminal, use the same release binary and provide the full local paths required by the installed example. Send a fresh prompt. For an instruction-capable package, you could supply “The current parcel route is Dock 8. The previous route was Dock 4. Report the current route only.” Check for Dock 8 in the completed answer. A new offline result shows that the binary used the local assets needed for that request.

Keep the build features and runtime device as two observations. The metal compile feature enables a supported Metal route in the build. When the binary runs, inspect the device information it actually reports for the configured model. Where the application does not show a clear device, use a documented observation route, such as Apple developer instrumentation, to check GPU activity during the actual request. A response generated offline is evidence of on-device execution. If you cannot determine whether it used Metal rather than CPU, leave the accelerator unverified.

When comparing CPU and Metal, use one exact model and the same input and output requirements. Record how the device was chosen, the time to generate a complete result, and the output itself. Do not compare a first load that compiles or downloads files with an already prepared model on the other device. If you need a timing comparison, distinguish setup, weight loading and generation. An apparently fast test may only have returned part of the intended response.

Diagnose failures in the order they appear

For an error before the binary is built, first check the checkout, package names, feature arguments and toolchain. A message about Apple developer components calls for checking the tools installed for that revision. If the build works but the binary is not where expected, inspect the selected target and the path printed by Cargo before downloading a second model. Preserve the first working checkout when testing a change.

For an error opening or fetching an asset, verify file paths and the selected model and tokenizer first. If an offline run attempts to fetch a file, reconnect to complete the documented download or supply the verified local copy using the binary’s own help. Restart offline again and use a new prompt. Do not classify the warm run as a cold pass when one required file was only present in process memory.

If the model starts and then stalls or gives a memory error, note the exact package, requested device, prompt length and other applications using memory. Try a smaller compatible quantization or shorter input while keeping the success check unchanged. Record whether the model finishes, how long the answer takes and whether it contains the expected information. If a configuration works after changing several variables, capture it as a new baseline before attributing the improvement to one setting.

Write down the source commit, build options, model and tokenizer identifiers, startup state, runtime device if verified, prompt and result. Keep one successful offline example you can repeat after a Rust update or another model download. With that record, a new failure can be located in the toolchain, local files, device or task output without starting over.

Use a small acceptance record when you change the example

For a single change to the program, keep the last working binary and input files. Change one build option or one model setting in the new checkout, then compare the build result and the runtime with the saved configuration. If you change a Cargo feature and also select a different weight file, keep that as a new combination. A successful result tells you that the combination works. It cannot isolate the impact of the feature or the weights individually.

Retain a known output task for each intended use. For a short development smoke test, you may only need the program to start, take a prompt and write a plausible continuation. If your app must copy identifiers exactly, choose words or codes that are easy to confuse and write down the expected values first. For example, use distinct labels “PINE-21” and “PINE-12” in an instruction model and ask for only the former from a specified source line. A plausible reply that changes a digit fails the check. This fact-preservation result should be recorded separately from the speed or device.

For a shared build record, write the model source and commit, resolved input paths, build profile, target and the exact steps used to confirm the offline result. Do not use an older application checkout’s binary to establish that an updated checkout builds. If you compare on another Mac, include its OS version and supported device and distinguish toolchain compatibility from model capacity. This makes the example a repeatable starting point for your own application.

Audit input formatting when a model loads but fails the task

Start with the usage example for the chosen model and compare it with the input your program actually supplies. Check whether the example expects a chat message format or a plain continuation. Keep the weights and tokenizer fixed while comparing the two input forms. For a chat model, use the expected template from the model or the maintained example wherever it is available. A response that repeats role markers or continues the source text can point to input formatting. Record the working input format alongside the weight version so a future prompt change can be reviewed independently of a Rust or Metal change.

Who makes Candle?

Candle is maintained under the Hugging Face organization, with Laurent Mazare among the early contributors. The public candle-core 0.1.0 package record dates to August 2, 2023. That is a package publication milestone; Hugging Face the company was founded separately in 2016.

References: Candle installation and Metal feature · Quantized example · Company profile.