frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Word2vec-style vector arithmetic on docs embeddings

https://technicalwriting.dev/embeddings/arithmetic/index.html
66•kaycebasques•16h ago

Comments

aDyslecticCrow•14h ago
There have been quite a few writing tools that are effectively just GPT wrappers with pre-defined prompts. "rephrase this more formally". Personally I find them to modify too much or are difficult to use effectively. Asking a for a few different rephrasings and then merging it myself ends up being my workflow.

But ever since learning about word2vec, I've been thinking that there must be a better way. "Push" a section in with the formal vector a bit. Add a pinch of "brief", dial up the "humour" vector. I think it could create a very controllable and efficient writing tool.

acmiyaguchi•13h ago
This does exist to some degree, as far as I understand, along the lines of style-transfer and ControlNet in visual domains. Anthropic has some research called "persona vectors" which effectively push generative behaviors toward or away from particular traits.

[0] https://www.anthropic.com/research/persona-vectors [1] https://arxiv.org/abs/2507.21509

nostrebored•13h ago
> How do we actually use this in technical writing workflows or documentation experiences? I’m not sure. I was just curious to learn whether or not it would work.

--

There are a few easy applications.

* When surfacing relevant documents, you can keep a list of the previous documents visited and boost in the "direction" that the customer is headed (could be an average of the previous N docs or weight towards frequency). But then you're just building a worse recsys for something where latency probably isn't that critical.

* If you know for every feature you release, you need an API doc, an FAQ, usage samples for different workflows or verticals you're targetting, you can represent each of these as f(doc) + f(topic) and find the existing doc set. But then, you can have much more deterministic workflows from just applying structure.

It's nice that you have a super flexible tool in the toolbox, but I think a lot of text based embedding applications (especially on out of domain data like long, unchunked technical docs) are just better off being something else if you have the time.

kaycebasques•11h ago
> If you know for every feature you release, you need an API doc, an FAQ, usage samples for different workflows or verticals you're targetting, you can represent each of these as f(doc) + f(topic) and find the existing doc set. But then, you can have much more deterministic workflows from just applying structure.

This one sounds promising to me, thanks for the suggestion. We technical writers often build out "docs completeness" spreadsheets where we track how completely each product feature is covered, exactly as you described. E.g. the rows are features, column B is "Reference", column C is "Tutorial" etc. So cell B1 would contain the deeplink to the reference for some particular feature. When we inherit a huge, messy docs set (which is fairly common) it can take a very long time to build out a docs completeness dashboard. I think the embeddings workflow you're suggesting could speed up the initial population of these dashboards a lot.

seg_lol•11h ago
You can probably do this in a day with a CLI based LLM like Claude Code. It can write the tools that would allow you to sort, test and cross check your doc sets.
jdthedisciple•13h ago
Intriguing! This inspired me to run the example "calculation" ("king" - "man" + "woman") against several well-known embedding models and order them by L2 distance between the actual output and the embedding for "queen". Result:

    voyage-3-large:             0.54
    voyage-code-3:              0.62
    qwen3-embedding:4b:         0.71
    embeddinggemma:             0.84
    voyage-3.5-lite:            0.94
    text-embedding-3-small:     0.97
    voyage-3.5:                 1.01
    text-embedding-3-large:     1.13
Shocked by the apparently bad performance of OpenAI's SOTA model. Also always had a gut feeling that `voyage-3-large` secretly may be the best embedding model out there. Have I been vindicated? Make of it what you will ...

Also `qwen3-embedding:4b` is my current favorite for local RAG for good reason...

smallerize•11h ago
That never exactly worked for word2vec either. https://blog.esciencecenter.nl/king-man-woman-king-9a7fd2935...
kaycebasques•10h ago
From the linked article:

> The widely known example only works because the implementation of the algorithm will exclude the original vector from the possible results!

I saw this issue in the "same topic, different domain" experiment when using EmbeddingGemma with the default task types. But when using custom task types, the vector arithmetic worked as expected. I didn't have to remove the original vector from the results or control for that in any way. So while the criticism is valid for word2vec I'm skeptical that modern embedding models still have this issue.

Very curious to learn whether modern models are still better at some analogies (e.g. male/female) and worse at others, though. Is there any more recent research on that topic? The linked article is from 2019.

gojomo•10h ago
Not sure you can judge whether these modern models do well on the 'arithmetic analogization' task based on absolute similarity values – & especially L2 distances.

That it ever worked was simply that, among the universe of candidate answers, the right answer was closer to the arithmetic-result-point than other candidates – not necessarily close on any absolute scale. Especially in higher dimensions, everything gets very angularly far from everything else - the "curse of dimensionality".

But the relative differences may still be just as useful/effective. So the real evaluation of effectiveness can't be done with the raw value diff(king-man+woman, queen) alone. It needs to check if that value is less than that for every other alternative to 'queen'.

(Also: canonically these exercises were done as cosine-similarities, not Euclidean/L2 distance. Rank orders will be roughly the same if all vectors normalized to the unit sphere before arithmetic & comparisons, but if you didn't do that, it would also make these raw 'distance' values less meaningful for evaluating this particular effect. The L2 distance could be arbitrarily high for two vectors with 0.0 cosine-difference!)

jdthedisciple•1h ago
> It needs to check if that value is less than that for every other alternative to 'queen'.

There you go: Closest 3 words (by L2) to the output vector for the following models, out of the most common 2265 spoken English words among which is also "queen":

    voyage-3-large:             king (0.46), woman (0.47), young (0.52), ... queen (0.56)
    ollama-qwen3-embedding:4b:  king (0.68), queen (0.71), woman (0.81)
    text-embedding-3-large:     king (0.93), woman (1.08), queen (1.13)
All embeddings are normalized to unit length, therefore L2 dists are normalized.
thornton•11h ago
We’ve done similar work. Use case was identifying pages in an old website that now 404 and where they should be redirected to.

Basically doc2vec and cosine similarity. Totally nonsensical matching outputs to the point matching on title tag vectors or precis was better so now I’m curious if we just did something wrong…

gojomo•10h ago
If by 'doc2vec' you mean the word2vec-like 'Paragraph Vectors' technique: even though that's a far simpler approach than the transformer embeddings, it usually works pretty well for coarse document similarity. Even the famous word2vec vector-addition operations kinda worked, as illustrated by some examples in the followup 'Paragraph Vector' paper in 2015: https://arxiv.org/abs/1507.07998

So if for you the resulting doc-to-doc similarities seemed nonsensical, there was likely some process error in model training or application.

Backpropagation is a leaky abstraction (2016)

https://karpathy.medium.com/yes-you-should-understand-backprop-e2f06eab496b
150•swatson741•5h ago•62 comments

Notes by djb on using Fil-C (2025)

https://cr.yp.to/2025/fil-c.html
100•transpute•5h ago•17 comments

When O3 is 2x slower than O2

https://cat-solstice.github.io/test-pqueue/
24•keyle•4d ago•3 comments

Visopsys: OS maintained by a single developer since 1997

https://visopsys.org/
351•kome•13h ago•69 comments

We reduced a container image from 800GB to 2GB

https://sealos.io/blog/reduce-container-image-size-case-study
15•untrimmed•6d ago•8 comments

How I use every Claude Code feature

https://blog.sshh.io/p/how-i-use-every-claude-code-feature
273•sshh12•11h ago•86 comments

Claude Code can debug low-level cryptography

https://words.filippo.io/claude-debugging/
331•Bogdanp•16h ago•163 comments

Updated practice for review articles and position papers in ArXiv CS category

https://blog.arxiv.org/2025/10/31/attention-authors-updated-practice-for-review-articles-and-posi...
454•dw64•20h ago•208 comments

Crossfire: High-performance lockless spsc/mpsc/mpmc channels for Rust

https://github.com/frostyplanet/crossfire-rs
69•0x1997•8h ago•6 comments

Pomelli

https://blog.google/technology/google-labs/pomelli/
186•birriel•12h ago•65 comments

LM8560, the eternal chip from the 1980 years

https://www.tycospages.com/other-themes/lm8560-the-eternal-chip-from-the-1980-years/
50•userbinator•6h ago•18 comments

FlightAware Map Design

https://andywoodruff.com/posts/2024/flightaware-maps/
26•marklit•5d ago•10 comments

GHC now runs in the browser

https://discourse.haskell.org/t/ghc-now-runs-in-your-browser/13169
312•kaycebasques•18h ago•100 comments

Show HN: Why write code if the LLM can just do the thing? (web app experiment)

https://github.com/samrolken/nokode
334•samrolken•17h ago•240 comments

Automatically Translating C to Rust

https://cacm.acm.org/research/automatically-translating-c-to-rust/
64•FromTheArchives•1w ago•16 comments

Anonymous credentials: rate-limit bots and agents without compromising privacy

https://blog.cloudflare.com/private-rate-limiting/
68•eleye•10h ago•33 comments

SQLite concurrency and why you should care about it

https://jellyfin.org/posts/SQLite-locking/
309•HunOL•22h ago•141 comments

Hyperbolic Non-Euclidean World (2007)

http://web1.kcn.jp/hp28ah77/
17•ubavic•6d ago•2 comments

Beginner-friendly, unofficial documentation for Helix text editor

https://helix-editor.vercel.app/start-here/basics/
136•Curiositry•15h ago•45 comments

3M Diskette Reference Manual (1983) [pdf]

https://retrocmp.de/fdd/diskette/3M_Diskette_Reference_Manual_May83.pdf
83•susam•5d ago•18 comments

Chip Hall of Fame: Intel 8088 Microprocessor

https://spectrum.ieee.org/chip-hall-of-fame-intel-8088-microprocessor
27•stmw•6d ago•1 comments

Context engineering

https://chrisloy.dev/post/2025/08/03/context-engineering
5•chrisloy•2h ago•0 comments

From 400 Mbps to 1.7 Gbps: A WiFi 7 Debugging Journey

https://blog.tymscar.com/posts/wifi7speedhunt/
110•tymscar•15h ago•83 comments

The Smol Training Playbook: The Secrets to Building World-Class LLMs

https://huggingface.co/spaces/HuggingFaceTB/smol-training-playbook
195•kashifr•2d ago•12 comments

CLI to manage your SQL database schemas and migrations

https://github.com/gh-PonyM/shed
24•PonyM•4h ago•11 comments

A Few Words About Async

https://yoric.github.io/post/quite-a-few-words-about-async/
52•vinhnx•10h ago•18 comments

How to Build a Solar Powered Electric Oven

https://solar.lowtechmagazine.com/2025/10/how-to-build-a-solar-powered-electric-oven/
57•surprisetalk•1w ago•29 comments

SailfishOS: A Linux-based European alternative to dominant mobile OSes

https://sailfishos.org/info/
282•ForHackernews•13h ago•116 comments

You Don't Need Anubis

https://fxgn.dev/blog/anubis/
120•flexagoon•7h ago•97 comments

Dating: A mysterious constellation of facts

https://dynomight.net/dating/
101•tobr•2d ago•95 comments