logoalt Hacker News

60% Fable cost cut by converting code to images and having the model OCR it

221 pointsby dimitropoulostoday at 3:50 PM88 commentsview on HN

Comments

aabhaytoday at 5:32 PM

In Gemini at least, if you look at how they process PDFs, they do an OCR and then feed the text + image to the model, without charging you for the text tokens (I believe).

So my guess is that Claude’s backend is doing the same — so this hack is probably more of a loophole in token accounting that might get closed if Claude is doing what Gemini does

show 3 replies
lpellistoday at 5:18 PM

I tried the same thing last year (with openai models), back then it worked to reduce prompt tokens, but you needed way more completion tokens, ultimately more expensive (and slower) https://pagewatch.ai/blog/post/llm-text-as-image-tokens/

aabhaytoday at 4:53 PM

Ahhh my eyes the vibe coded readme

show 3 replies
genxytoday at 4:41 PM

This seems like a pricing hack that burns resources, that when the loophole gets closed the price of OCR will have to rise?

show 2 replies
g42gregorytoday at 10:24 PM

I think Oh-My-Pi (OMP.sh) uses images for context compactificaton. OMP is built on top of Pi coding agent.

brumartoday at 10:06 PM

Tangentially related: I don't think OCR is the right term and I am generally vocal about that. But seeing this unquestioned here, I am wondering if I am the one who is wrong here. Is it ok to call this OCR? To me ocr means text in the end, not visual tokens.

show 3 replies
OSaMaBiNLoGiNtoday at 8:28 PM

Saw a Tweet a while ago from someone (maybe Carmack, maybe Geohot, maybe Karpathy?) wondering if images were just the better option.

Since then I've been using images with very simply worded prompts whenever I'm informing an agent of what is happening. Sometimes no text in the prompt at all.

It has been very very effective.

That being said, this isn't really what Karpathy was talking about. But it got me thinking a bit, and that got me to a much nicer workflow.

show 1 reply
dimitropoulostoday at 4:02 PM

there's also a DeepSeek whitepaper on this technique https://www.seangoedecke.com/text-tokens-as-image-tokens

__huguestoday at 5:58 PM

seems really dumb and like it would need to violate basic information theory to work?

input tokens are cheaper than output tokens. seems like it would maybe reduce input tokens at the expense of many more output tokens if you're actually triggering OCR via thinking?

shinryuutoday at 9:59 PM

Interesting approach, though that readme really needs a rewrite by a human...

chickensongtoday at 9:30 PM

Binary compression unpacked by OCR? This is the stuff of nightmares. So cursed, and yet...

anigbrowltoday at 7:22 PM

I'm sorry, but this is retarded. It works, and it's clever, but but it's clearly a workaround for a pricing failure. Much like the bounty on poisonous snakes leading to people taking up snake-breeding, this just exploits and promotes waste. I think ultimately blame falls on Anthropic for the poor pricing system the enables such arbitrage. But I'm also disgusted by the inevitable tide of people exploiting this until its fixed, and creating an entirely unnecessary extra tide of digital junk.

lstroudtoday at 10:40 PM

Are we really re-discovering that compressed binary formats are more efficient data representations?

show 1 reply
tru3_powertoday at 8:25 PM

This probably works with PDF parsing as well I’m sure, even if it’s just from not having to parse pdf format alone.

electrotypetoday at 7:27 PM

What about: "Read this document online : [URL]" and you add your text/context to an online document?

Would that reduce the number of tokens used too?

show 1 reply
puppycodestoday at 5:39 PM

That is hilarious and an amazing find.

nickpetersontoday at 8:09 PM

a pictures worth a thousand tokens

wigstertoday at 9:33 PM

a picture paints a thousand words

dippogrifftoday at 5:33 PM

I want to see more text-free foundation models

show 1 reply
yogthostoday at 6:49 PM

Isn't this basically what DeepSeek came up with https://github.com/deepseek-ai/DeepSeek-OCR

felipelallitoday at 8:37 PM

No words.

AIorNottoday at 6:43 PM

I cant get past that LLM intense slop text in the Github repo

colwonttoday at 9:05 PM

[dead]

tomyowtoday at 9:19 PM

[flagged]

tomdowtoday at 9:21 PM

[flagged]

tomfowtoday at 9:24 PM

[flagged]