
Share
Embedding an entire large language model inside a `.ttf` font file might sound like digital wizardry, but it’s real-and it’s transforming how we interact with AI right from our desktops.
If you thought fonts were just for displaying text, think again. llama.ttf is a font file that doubles as a large language model (LLM) and its inference engine. This innovative hack leverages the WebAssembly (Wasm) capabilities of the HarfBuzz font shaping engine to run an LLM directly from a font file.
Traditionally, fonts are used for rendering text in applications like web browsers and word processors. However, llama.ttf takes this concept to a new level by embedding a complete LLM and its inference engine within the font file itself. This means you can use the font to generate text based on prompts, all while running locally and without any additional software installations.
For developers and enthusiasts, llama.ttf opens up a novel way to integrate AI capabilities into existing applications. Instead of waiting for vendors to add "Copilot"-like features, you can use this font to get text generation in any Wasm-enabled HarfBuzz-based application. This includes your favorite text editor, email client, or even image editing software.
llama.ttf embeds an entire LLM inference engine, specifically the Llama model, along with its trained parameters. This is achieved by treating certain text sequences as "magic ligatures" that trigger the LLM initialization and text generation.
llama.ttf is a 60 MB download, which includes the 15M parameter TinyStories-based model.llama.ttf, you need an application that uses HarfBuzz with Wasm support. This can be achieved by:
-Dwasm=enabled.-DWAMR_BUILD_REF_TYPES=1.libharfbuzz.so.0.60811.0 and libiwasm.so) to the LD_PRELOAD environment variable.llama.ttf without recompilation, making it a seamless integration.To see llama.ttf in action, check out this YouTube video by Søren Fuglede Jørgensen. Skip to 6:09 for a demonstration of the font generating text based on user prompts.
llama.ttf: Get the 60 MB font file from the project's GitHub page.git clone https://github.com/harfbuzz/harfbuzz.gitcmake -Dwasm=enabled . && makegit clone https://github.com/bytecodealliance/wasm-micro-runtime.gitcmake -DWAMR_BUILD_REF_TYPES=1 . && makeLD_PRELOAD: export LD_PRELOAD=/path/to/libharfbuzz.so.0.60811.0:/path/to/libiwasm.sollama.ttf as your font.If this project piques your interest, consider exploring other creative uses of fonts and Wasm. The possibilities are
Tags
Original Sources
↗ https://fuglede.github.io/llama.ttf/?utm_source=tldrai
About the author
Kai built ML infrastructure at a Bay Area startup before developing an obsession with transformer architectures and inference optimisation that eventually pulled him out of product work entirely. A stint at a compute research lab sharpened his instinct for what actually matters in a model release versus what is marketing. He writes from the inside — from the perspective of someone who has debugged the systems he is describing at three in the morning. He is allergic to hype and instinctively drawn to the unglamorous plumbing questions that everyone else skips over.
More from The Engineer →This Week's Edition
25 June 2024
133 articles
Related Articles
Related Articles
More Stories