Feed aggregator

Why Mina Loy

Hacker News - Sun, 04/20/2025 - 5:23am
Categories: Hacker News

SHOW HN: Day 1 of trying to fit a Chatbot into a QR Code

Hacker News - Sun, 04/20/2025 - 5:22am

Image for day 1: https://i.imgur.com/bQ3Oxc5.png

After I tried to fit DOOM inside a QR code last time (https://news.ycombinator.com/item?id=43729683), I'm trying to continue this "series" to get an actually decent chatbot into a QR code.

This is, of course, not as easy as the former. I could always cheat and make a rule-based ELIZA style chatbot (that I actually dabbled with earlier) but I want to make something actually somewhat useful. I know quite little about how LLMs and Transformers fundamentally work so this will also teach me a lot about AI (also, will be public and Open Source when it actually turns into something somewhat cool)

Here's our limitations: The largest standard QR code (Version 40) holds 2,953 bytes (~2.9 KB). This is very small—a Windows sound file of 1/15th of a second is 11 KB! PLUS, we can't directly dump HTML/JS into the QR code, we need to compress it to BASE64 (or BigInt) which takes up 0.1-0.15Kb as well, so we have about 2.7Kb for the entire thing, yikes!

Here's what I did for day 1:

The first version (v0) was incredibly basic - a simple pattern-matching chatbot with predefined responses:

``` const V = "you,I,is,are,do,what,how,why,,...e".split(","); const P = [ [5,2,0,8], // what is you like [5,4,0,8], // what do you like.... [0,8,15,9] // you like me think ]; ```

(v1) added better CSS (still light theme), topic memory, sentiment analysis and transition patterns, but all this made the file size a bit over 4kb.

(v2) was v1 with more compression, lost features but shrank to 2.8kb.

(v3) added a retro UI because it seemed fitting, ASCII art and simplified text formatting with newlines, but it was still extremely dumb. (v4) and (v5) added more cuts to barely get it below the limit (2.85kb).

So I changed the approach for (v6) and went for a trie data structure for response lookups: ``` const t={h:{e:{l:{l:{o:["Hello! How can I help you today?","Hi! What's on your mind?"]}}}}}; ```

This allowed for prefix matching under our constraints AND there was no need for pattern matching.

(v7) was trying to optimise it, but it still ended up being around 3.3kb, better than before but still not very "intelligent".

For (v8), I took a lot of time and switched to a very basic implementation of a 2 layered neural network: ``` const network = { embeddings: new Float32Array(c.vSize * c.eDim), hidden: new Float32Array(c.eDim * c.hSize), output: new Float32Array(c.hSize * c.oSize), hiddenBias: new Float32Array(c.hSize), outputBias: new Float32Array(c.oSize) }; ```

This gives us a 582 char neural network that's 8 bit quantized but, as you would expect, this was huge, about 11kb.

(v9) and (v10) were basically minifying this further, down to about 3.2kb, not bad!

The last version I worked on today was (v10.5). I used word level processing instead of character level with 4D vectors, template responses with context awareness, better state tracking and 8 output dimensions. Also added a repetition penalty (currently a little broken) but is actually kind of good... 5.3kb good.

For Day 2, I'm thinking: 1. Implement better context handling 2. Optimize the neural architecture further (maybe a tiny transformer?) 3. Maybe find a way to compress it even more?

Resources: https://www.youtube.com/watch?v=aircAruvnKk https://www.youtube.com/watch?v=zhxNI7V2IxM&t=275s https://github.com/rasbt/LLMs-from-scratch https://github.com/lionelmessi6410/Neural-Networks-from-Scra...

Comments URL: https://news.ycombinator.com/item?id=43742639

Points: 1

# Comments: 0

Categories: Hacker News

Show HN: My Squaring Algo Beats Karatsuba and FFT for Real-World Cryptography

Hacker News - Sun, 04/20/2025 - 5:18am

Hi HN, I’m Krishil Rohit Sheth, and over the last 4 years I’ve developed a new algorithm (RPF) for squaring large numbers — and it outperforms Karatsuba, and even FFT-based methods for numbers under 800 digits.

Raw performance: RPF beats Karatsuba in execution time and scales better with input size. With GMP enhancements: Even after both are optimized with GMP, RPF still maintains a performance edge. Better than FFT for mid-size inputs: Up to 800 digits, RPF is also faster than FFT-based multiplication, which usually kicks in beyond this range.

I’ve attached benchmark charts and comparisons here: -https://drive.google.com/file/d/1aZ-JR0Oq5KnY4xKd2tAPEvr1wFPowhSt/view?usp=drive_link This has applications in:

Cryptography (modular exponentiation)

Blockchain & ZK systems

Financial simulations

Any compute-heavy big-number operations

I’ve filed a provisional patent and I’m looking to either license the algorithm, collaborate, or sell the IP outright.

Would love feedback from devs, researchers, and cryptographers here! Also happy to talk if you work on libraries like GMP, OpenSSL, Java BigInteger, Libgcrypt, etc.

Thanks! —Krishil Sheth -krishilsheth@gmail.com -+91 9372677245

Comments URL: https://news.ycombinator.com/item?id=43742624

Points: 2

# Comments: 0

Categories: Hacker News

Bootstrapping Rustc from Source

Hacker News - Sun, 04/20/2025 - 4:55am

Article URL: https://github.com/dtolnay/bootstrap

Comments URL: https://news.ycombinator.com/item?id=43742529

Points: 1

# Comments: 0

Categories: Hacker News

Ask HN: What's your workflow for finding project names with available domains?

Hacker News - Sun, 04/20/2025 - 4:54am

When building side projects, I constantly hit this snag: brainstorm a good name -> check domain availability (ideally .com/ai/io) -> find it's taken -> repeat. This iteration loop is frustrating and slows down the start of a project.

I'm considering building a tool to streamline the process and I am curious to evaluate external interest for something like this.

Is this a common pain point for others here? What's your current workflow for naming projects and checking domain availability, and how often does this issue disrupt you?

Comments URL: https://news.ycombinator.com/item?id=43742523

Points: 1

# Comments: 0

Categories: Hacker News

Ask HN: Why Y outube is better than Y Combinator

Hacker News - Sun, 04/20/2025 - 4:40am

Creative and technical minds are here too, yet content is repetitive, uneducational, less of fun.

There can't be anything innovative in computer tech, unless someone designs an abstract concept on computer to make other concepts obsolete.

Programming language are not innovation.

Frameworks are not innovation.

Display systems were once an innovation but forgotten.

Monitor is not output device, but also an input device. Invention of pointer.

AI, Neural networks are inverse law of function. That's not innovation.

Voice: we know that already. Why explain so much?

Me: I abstained from using social networks, then from educational networks, then from phone. It changed what I was able to create.

The power and quality of creation is same, but noise can tamper it.

Here is my creation out of an experiment of not feeding information to brain.

It forced brain to create the missing dopamine kick, by creating it's own kick.

Introducing ui-editor.com

Comments URL: https://news.ycombinator.com/item?id=43742456

Points: 1

# Comments: 0

Categories: Hacker News

Pages