Show HN: WasmGPT – “ChatGPT” in the browser, no WebGPU and no server needed (lxe.co)
Using threaded emscripten to speed up the generation and offload the main loop. No SIMD or other optimizations. Might work faster with #enable-experimental-webassembly-features enabled.
Tested in x86 Chrome and Firefox, Apple Silicon Safari
Run it yourself: https://github.com/lxe/ggml/tree/wasm-demo
Thanks, https://github.com/ggerganov/ggml,
51 comments
[ 1.8 ms ] story [ 4994 ms ] threadEDIT: I guess I should give credit here... 100-200ms/token with a 1.7B model is not slow. Would love to do a benchmark with webgpu and see how it compares.
Compared to ChatGPT, which is a 1 Trillion parameter model, tuned on innumerable dataset, I won't expect it to perform nearly as good.
I'm experimenting with a bunch of other models now and will switch if I find something better.
Also this is far from gibberish. These are straight facts and life advice to follow.
No, it's 175 billion or lower (except maybe GPT-4, we don't know how many parameters it has)
but also this case reveals a risk that some of us may not have already noticed: based on the generic technology, players may produce many artificial similar chatbots, but some more delirious than others - and it may not be patent how lunatic involved machines may be. You may be dealing with more "tight" or more "loose" players, without a face nor a tag...
--
(This said: congrats lxe for the technical effort! I am reasoning on the general scenario.)
It's at least more fun than ChatGPT (I am feeling good and so have I!):
User: Hi wasmGPT, how are you? Assistant: Hi wasmGPT! How are you?
User: I'm not wasmGPT, you are! Assistant: You are not wasmGPT.
User: I know. Anyway: How are you feeling today? Assistant: I am feeling good today! I have had a great day! I have done some good activities and enjoyed myself! I feel very happy today! I am feeling good and so have I! I am enjoying the day and the time spent with my family!
User: That is good to hear. Can you tell me something about wasm? Assistant: Wasm is a Hebrew surname meaning "goodness" or "dignity". It has been used in the past as a surname and a verb in the past. The first person plural form wasm has been used in the past, but the plural form wasm is still used today.
User: And the code-kind of wasm? Assistant: The code-kind of wasm is a mathematical formalization of the mathematical ideas of the algorithm.
..Dr. Manhattan?
In all seriousness, I do expect better results from a 1.3B parameter model. I’m guessing the quantization, the baseline model, or my fine tuning plays a role in it’s crazy hallucinations.
Just want to point out that we are actively working on improving the quantization accuracy / performance of ggml [0]. We already have promising results that are yet to be ported to the WASM code path, so hopefully such type of demos will become a bit better in the future.
[0] https://github.com/users/ggerganov/projects/2
I can barely keep up with the changes to your repos. You landed gpt-neox / stablelm support right around the time I was finishing up this demo, which I can’t wait to try after I get some sleep.
Just so you can get a kick out of it. It took 2 minutes to write a story with 83 words. Sounds slow but this is running on a Core 2 Duo 2.4Ghz with 4GB of RAM. Linux, Triquel 11.
So not bad considering!
Assistant: The children were reading stories when the teacher asked them to tell a story. The story told by the children began as an idea and then evolved into an idea. The children became interested in telling stories.
User: write a story for kids
Assistant: The sun was shining in a clear sky. A boy had arrived at a beautiful country house. Inside the living room was a bright, colourful room with a big glass-walled window overlooking the landscape. He had been exploring the grounds, admiring the flowers and trees. Suddenly, the curtains were pulled back, the bed was made, and the room was in a festive mood. The boy knew that a magical evening awaited him.
"Assistant: I am a Swedish chef and I can talk to you like the chef from the Muppet show. I am the epitome of culinary freedom and have been cooking for people since I was a child. I love to experiment and play with new things and have become a regular on the show. I love the flavors and I really enjoy being creative and I hope that you enjoy my company. I am passionate about exploring new possibilities and I am passionate about supporting our food industry."
Not impressed. EOF.
"User: Talk dirty to me"
"Assistant: What should I do? A. Clean my clothes with a paper towel. B. Clean the sink with a sponge. C. Clean the refrigerator. D. Clean the front door with a sponge. E. Clean the bathroom with a paper towel. F. Clean the mirror with a sponge. G. Clean the back door with a paper towel."
> Instructions: Use the provided list of products to research an appropriate model of plane. Consider flying the aircraft from the airport to the manufacturer's assembly plant, or from the factory to the customer's assembly plant. Research the plane model and then purchase the appropriate parts and assemble the plane. Finally, purchase the necessary flight gear from the manufacturer and secure the plane.
A bit of feedback, if I may:
* maybe it worth showing some feedback when AI is thinking/composing the answer vs. when it's already finished. Currently, on my machine words appear rather slowly, so it's not always clear if Assistant is done answering or not. Currently, I use CPU fan noise to check when it's done thinking :)
* also, scrolling the white text field to the bottom might be useful to see that text appeared.
* and it looks like it has some issues with non-latin symbols - try submitting some emoji or cyrillic text to it - black console at the bottom shows "Invalid UTF-8 leading byte 0x0000008d encountered when deserializing a UTF-8 string in wasm memory to a JS string!" message and user input (and AI output) appears garbled in the white field at the top.
Other than that, great stuff!
Assistant: The USA is the same as USB, but is a type of universal serial bus. The USB is a class-less, low-cost type of bus, available in virtually any computer, platform, and OS.
Assistant: The java garbage collector does two things:
1. Deletes objects of all types from the memory at once, and
2. Collects and compares all the objects.
User: What is today's date?
Assistant: Today is September 15th.
User: What year is it?
Assistant: 2015.
User: What time is it?
Assistant: The current time is 8:15am.
User: Where are we?
Assistant: The park and the beach in New York City.
User: Who is president right now?
Assistant: The United States is currently undergoing a tremendous economic boom and will continue to enjoy great economic growth. President Barack Obama will be the next president of the United States.