June 23rd, 2024

Llama.ttf: A font which is also an LLM

The llama.ttf font file acts as a language model and inference engine for text generation in Wasm-enabled HarfBuzz-based applications. Users can download and integrate the font for local text generation.

Read original articleLink Icon
Llama.ttf: A font which is also an LLM

The llama.ttf font file serves a dual purpose as a large language model (LLM) and an inference engine for that model. This unique functionality allows users to run the LLM and generate text within Wasm-enabled HarfBuzz-based applications like text editors or email clients without waiting for additional features to be included by vendors. By utilizing the font, users can engage in text generation locally without the need for external servers. To experience this font in action, users can download the llama.ttf file and integrate it into applications built with Wasm support. This innovative approach showcases the potential for unconventional uses of fonts and LLMs, such as creating playable games or formatting text creatively. Additionally, the font's capabilities are demonstrated in various projects like tom7's text formatting language and Erk's presentation on programmable fonts with HarfBuzz-Wasm.

Related

Tetris Font (2020)

Tetris Font (2020)

The Tetris Font, designed by Erik and Martin Demaine, features letters made of Tetris pieces, challenging users with puzzle elements. Created in 2020, it showcases the complexity of Tetris in a unique typographic experience.

Font as Tetris [video]

Font as Tetris [video]

The video discusses font evolution from clay tablets to digital fonts, covering styles, typography progress, ligatures, OTF and TTF formats. It mentions Metafont, hinting techniques, and Half Bus C++ library integration.

GitHub – Karpathy/LLM101n: LLM101n: Let's Build a Storyteller

GitHub – Karpathy/LLM101n: LLM101n: Let's Build a Storyteller

The GitHub repository "LLM101n: Let's build a Storyteller" offers a course on creating a Storyteller AI Large Language Model using Python, C, and CUDA. It caters to beginners, covering language modeling, deployment, programming, data types, deep learning, and neural nets. Additional chapters and appendices are available for further exploration.

How to run an LLM on your PC, not in the cloud, in less than 10 minutes

How to run an LLM on your PC, not in the cloud, in less than 10 minutes

You can easily set up and run large language models (LLMs) on your PC using tools like Ollama, LM Suite, and Llama.cpp. Ollama supports AMD GPUs and AVX2-compatible CPUs, with straightforward installation across different systems. It offers commands for managing models and now supports select AMD Radeon cards.

Detecting hallucinations in large language models using semantic entropy

Detecting hallucinations in large language models using semantic entropy

Researchers devised a method to detect hallucinations in large language models like ChatGPT and Gemini by measuring semantic entropy. This approach enhances accuracy by filtering unreliable answers, improving model performance significantly.

Link Icon 43 comments
By @xrd - 4 months
After watching part of the video, I believe the world would benefit from a weekly television program where you could tune in each week to watch something weird, brilliant and funny. This would be a great episode #1 for that television show.
By @fuglede_ - 4 months
Very much inspired this earlier HackerNews post which put Tetris into a font, today we put an LLM and an inference engine into a font so you can chat with your font, or write stuff with your font without having to write stuff with your font.

https://news.ycombinator.com/item?id=40737961

By @polshaw - 4 months
This is cool, as far as a practical issue though (aside from the 280gb TTF file!) is that it makes it incompatible with all other fonts; if you copy and paste your "improved" text then it will no longer say what you thought it did. It just alters the presentation, not the content. I guess you would have to ocr to get the content as you see it.

I was wondering why this was never used for an simpler autocorrect, but i guess that's why.

Also perhaps someone more educated on LLMs could tell me; this wouldn't always be consistent right? Like "once upon a time _____" wouldn't always output the same thing, yes? If so even copying and pasting in your own system using the correct font could change the content.

By @electric_mayhem - 4 months
While cool, technically… From a security perspective today I learned that TrueType fonts have arbitrary code execution as a ‘feature’ which seems mostly horrific.
By @xg15 - 4 months
> The font shaping engine Harfbuzz, used in applications such as Firefox and Chrome, comes with a Wasm shaper allowing arbitrary code to be used to "shape" text.

Has there already been a proposal to add scripting functionality to Unicode itself? Seems to me we're not very far from that anymore...

By @petters - 4 months
The page links to https://www.coderelay.io/fontemon.html which is a game embedded into a font. Playable in the browser.
By @zharknado - 4 months
My takeaway is that if you can efficiently simulate rendering raster graphics with text ligatures, you could run Doom in a TTF.

Right?

By @simonw - 4 months
> The font shaping engine Harfbuzz, used in applications such as Firefox and Chrome, comes with a Wasm shaper allowing arbitrary code to be used to "shape" text.

In that case could you ship a live demo of this that's a web page with the font embedded in the page as a web font, such that Chrome and Firefox users can try it out without installing anything else?

By @geor9e - 4 months
>build Harfbuzz with -Dwasm=enabled and build wasm-micro-runtime, then add the resulting shared libraries, libharfbuzz.so.0.60811.0 and libiwasm.so to the LD_PRELOAD environment variable before running a Harfbuzz-based application such as gedit or GIMP

It'd be lovely if someone embedded the font in a website form to save us all the trouble of demoing it

By @bitwize - 4 months
> The font shaping engine Harfbuzz, used in applications such as Firefox and Chrome, comes with a Wasm shaper allowing arbitrary code to be used to "shape" text.

Oh, this can't be used for nefarious purposes. What could POSSIBLY go wrong?!

By @bastien2 - 4 months
Well this definitely won't get exploited at all or lead to new strict limits on what Harfbuzz/WASM can do
By @pk-protect-ai - 4 months
I will never allow my linux to update my fonts ever again ... Arbitrary code execution in its finest form.
By @amai - 4 months
Does this mean fonts are Turing complete nowadays? Sounds like a pretty bad idea for security.
By @stgiga - 4 months
WebAssembly in fonts doesn't sound very secure, coming from someone who is certified in cybersecurity and has spent years doing font stuff.
By @tcsenpai - 4 months
After your help and troubleshooting, I am happy to notify you that your work has been archived (https://archive.tunnelsenpai.win/archive/1719179042.512455/i... and in the Internet Archive). Thanks!
By @jonathaneunice - 4 months
I never imagined a future in which PDFs talked back. Now I can.
By @UncleOxidant - 4 months
Can someone explain why HarfBuzz isn't a potentially serious security vulnerability? Couldn't someone create a .ttf file that looks like one of the standard .ttf files but includes similar capability to this llama.ttf to execute arbitrary code?
By @rhyjyrtjhtyn - 4 months
The author categorizes this as "pointless" but some things I can think of is being able to create automated workflows within an app that didn't previously allow it or had limited scope and then creating app interoperability with other app's using the same method.
By @closetkantian - 4 months
This is really cool, but I'm left with a lot of questions. Why does the font always generate the same string to replace the exclamation points as he moves from gedit to gimp? Shouldn't the LLM be creating a new "inference"?

As an aside, I originally thought this was going to generate a new font "style" that matched the text. So for example, "once upon a time" would look like a storybook style font or if you wrote something computer science-related, it would look like a tech manual font. I wonder if that's possible.

By @bbor - 4 months
Wow, this is incredible. OP you (I?) should train a few models with different personalities/tasks and pair them with the 5 GitHub Monaspace fonts accordingly, allowing people in multifont programs to easily get different kinds of help in different situations. Lots of little ideas sparked by this… in general, I think this a good reminder that we are vastly underestimating fonts in discussions of UI (and, it appears, UX in full!)
By @Xlythe - 4 months
It seems like it'd be possible to, instead of typing multiple exclamation points, have one trigger-character (eg. ). And then replace that character visually with an entire paragraph of text, assuming there aren't limits to the width of a character in fonts. I suppose the cursor and text wrapping would go wonky, though.

You could also use this to make animated fonts. An excuse to hook up a diffusion model next?

By @NayamAmarshe - 4 months
This is the coolest thing I've seen this week.
By @tcsenpai - 4 months
I may be doing this wrong but...the font provided just install as OpenSans and does not provide any functionality at least in mousepad or LibreOffice Writer. I am talking about the 90mb one
By @kylehotchkiss - 4 months
Is this the AI hype cycle equivalent of in browser crypto mining? (once the file size goes down a little)
By @exe34 - 4 months
your engineers were so busy finding out if they could, they never stopped to ask if they should!
By @wiradikusuma - 4 months
So how do you copy the output?
By @Dwedit - 4 months
I thought the Bad Apple font was really neat, but this is just too much.
By @ranger_danger - 4 months
This is terrifying.
By @anthk - 4 months
A Z Machine in a TTF font, anyone?
By @lacoolj - 4 months
Hello. I'm Dr. Sheldon Cooper. And welcome to Sheldon Cooper Presents: Fun with Fonts
By @ilrwbwrkhv - 4 months
This is so so awesome! One of the best things I have seen so far this year.
By @hsfzxjy - 4 months
cool. is there a github repo to produce this thing?
By @UncleOxidant - 4 months
about 1/3 way through the video and I'm getting the impression this is an elaborate joke.
By @jraph - 4 months
(Show HN)
By @LeonigMig - 4 months
this is over my head
By @est - 4 months
first time I've heard of harfbuzz.

So we could expect latex.ttf very soon?

By @fitsumbelay - 4 months
excellence
By @yourfriendpalsy - 4 months
Interesting idea, but needs to be ported to the Typescript type system.
By @freitasm - 4 months
Stopped watching when the demo showed the letter O with a slash. That would confuse me a lot. I am an old timer and expect the zero to have it.