Semantle 的求解器
A solver for Semantle

原始链接: https://victoriaritvo.com/blog/semantle-solver/

## Semantle 求解器总结 Semantle 是 Wordle 的一种变体,它测试语义理解能力,根据猜测词与目标词的相似度(使用 300 维词嵌入,即意义的向量表示)来评分。与 Wordle 的词汇线索不同,Semantle 仅提供一个“冷热”相似度分数,这使得它非常难以破解。 研究人员 Ethan Jantz 和作者开发了一种求解器,能够始终在约 3 次猜测内找到答案,远超人类表现。求解器没有试图直接计算目标词的嵌入向量(这需要 300 次独立的猜测),而是利用了一种过滤方法。 每次猜测定义了一个基于余弦相似度的“环”,即可能的候选目标词范围。求解器从一个大型词汇表中开始,并迭代地缩小候选词,仅保留与报告的相似度分数在容差范围内的词。由于词嵌入空间的稀疏性,这种几何过滤被证明非常有效——每个相似度约束都会大大减少可能性。 求解器的成功展示了两种不同的语义空间导航方式:人类使用直观的、基于意义的“梯度下降”,而求解器则采用全局的、几何地剔除不可能答案的方法。然而,这两种方法最终都收敛于相同的解决方案。

一个黑客新闻的讨论围绕着Semantle(victoriaritvo.com),一个基于语义相似度的猜词游戏。用户分享了替代实现和解题策略。 尤其值得一提的是,Pimantle(https://semantle.pimanrul.es/)因其更优秀的二维可视化效果而受到关注,这使得理解词语关系和享受游戏变得更容易。一位用户甚至创建了自己的求解器,发现几个关键的相似度得分可以唯一确定目标词——这个项目灵感来自原始帖子。 讨论涉及了计算机解决这个游戏的可行性,将其与容易解决的谜题(如数独)进行比较,并承认人类在制定有效策略方面面临的困难。一些用户对Semantle中意想不到的词语距离感到沮丧,而另一些用户则认为Pimantle的界面显著改善了游戏体验。
相关文章

原文

Semantle is a Wordle game variant. But instead of scoring guesses based on lexical similarity like its predecessor, it scores them based on semantic similarity.

Here’s a screenshot from a game I played recently, ordered by similarity to the correct answer.

Screenshot of a Semantle game
Screenshot of a Semantle game

I initially guessed “philosophy,” which was very far from the correct answer (similarity score of 6.02). After several more guesses I got lucky with “biology” (27.55) as my 8th guess, which pointed me toward more science-y words. Eventually I realized the answer had something to do with a hospital setting (yes, yes, I could have gotten there faster after “biology”). I landed on the right word “medical” as my 52nd guess.

To be honest, that’s a pretty good round for me. I’ve had games last more than twice that before giving up. If you’ve played before, you know Semantle is hard. But it is solvable, generally by gradually honing in on words that give higher similarity scores, and moving away from words that give lower scores.

Ethan Jantz and I wondered whether we could do better algorithmically. This post describes a simple solver we made while at the Recurse Center that reliably finds the answer in around 3 guesses.

What information does the game give you?

Semantle uses word embeddings — numerical vector representations of word meanings — to represent words. It uses Google News word2vec, which represents each word as a 300-dimensional vector. It then measures how close your guess is to the target word using the cosine similarity between the guess word embedding (gg) and the target word embedding (tt). That similarity score is the feedback you get with each guess.

The difficulty of playing Semantle comes from how little information a single cosine similarity provides. It effectively tells you whether your guess is “hot” or “cold,” but not which direction you should move. As a result, you have to combine feedback from multiple guesses, mentally “triangulating” where the answer might be in semantic space.

Can we solve for the embedding of the target word?

If you want to skip ahead to how we implemented the solver, you can jump to the next section. But first, I’m going to digress briefly to discuss why solving for the target word directly isn’t practical.

A natural first idea might be to treat each guess as a clue to the hidden vector and try to combine those clues to recover it directly. In embedding space, that translates to solving for the target vector using a system of linear equations.

The similarity score the game returns with each guess is:

similarity=cos(θ)=gtgt\text{similarity} = \cos(\theta) = \frac{g \cdot t}{\lVert g\rVert \,\lVert t\rVert}
联系我们 contact @ memedata.com