News for hackers. Stuff that matters.
Re:T-Wand: beating Lucene in less than 600 lines of code by ekzhu on Wednesday November 17, 2021 @12:53AM (#29249652)
I cannot continue reading after this following “declaration”… Author should take a look at the Wikipedia page for TF-IDF.

> As someone who has a Ph.D. in Human-computer Interaction ;-), I feel like I am entitled to define a condition of "good" in relevance here. I hereby declare that:

>> A good top-K algorithm should rank a document containing more user query terms higher than a document containing less number of user query terms.

> This makes perfect sense. Right?

Also, “most search engines” don’t use vector space model as the only way to rank result, for example, page rank.

Edit: in some search scenarios finding the documents with the most query terms make sense, but Lucene can also rank using this metric. Still, applaud the author's effort in digging into research literature. Search relevance is very hard and standard off the shelf metrics like TF-IDF and page rank are often not enough. Good search usually requires deep understanding of the specific subject domain and hand-tuning tons of signals, many of which aren't even strictly based on search terms (e.g., previously purchased products on a store's website, geographic location, trending results).

Re:T-Wand: beating Lucene in less than 600 lines of code by softwaredoug on Wednesday November 17, 2021 @07:11AM (#29252016)
As author of Relevant Search and contriburor of AI powered search I endorse this :)

Relevance is really subjective, domain specific, requires intense amount of measurement and testing and many different ranking signals. Lucene is a toolbox for crafting many of these signals.

Re:T-Wand: beating Lucene in less than 600 lines of code by softwaredoug on Wednesday November 17, 2021 @04:36PM (#29259144)
On second read-thru, I think the author is maybe(?) describing assumptions behind WAND and relevance algos that benefit from it? Maybe not some overarching statement about relevance per-se? But it's mixed in with statements about relevance / what Lucene does that are mostly incorrect...

For example, he says

> However, as you can see, this vector space model does not explicitly require a higher ranking document to contain more query terms than a lower ranking one.

Well the way you get a higher similarity in a vector-space model is matching more terms. The caveat being that IDF and field length makes you also consider a term's specificity. So if you search for 'luke skywalker' you care more about the 'skywalker' match than the 'luke' match. But a match on BOTH 'luke skywalker' would score higher (field lengths being constant)

Re:T-Wand: beating Lucene in less than 600 lines of code by huahaiy on Wednesday November 17, 2021 @05:10PM (#29259529)
There's no guarantee in pure vector space model that it is the case. Your understanding is way off. This is a caveat that Lucene prominently put on their Web page.

https://lucene.apache.org/core/3_5_0/scoring.html

"Lucene scoring is the heart of why we all love Lucene. It is blazingly fast and it hides almost all of the complexity from the user. In a nutshell, it works. At least, that is, until it doesn't work, or doesn't work as one would expect it to work. Then we are left digging into Lucene internals or asking for help on [email protected] to figure out why a document with five of our query terms scores lower than a different document with only one of the query terms."

See? Lucene people know about it but they just do not think it is a problem.

But I do.

T-Wand, though also uses vector space model, makes sure it is the case.

Re:T-Wand: beating Lucene in less than 600 lines of code by softwaredoug on Wednesday November 17, 2021 @05:47PM (#29259846)
No there’s no guarantee. A very strong bias, but no absolute guarantee. Most people use AND queries by default or set a high enough min should match.

Those settings aside, arguably there are cases where fewer term matches could be more relevant.

For the search “Luke skywalker”

A tweet for example mentioning the term “Skywalker” once has much higher “Star Wars” aboutness than a move that uses skywalker one page and Luke pages apart.

That is the information density of Star Wars type content is far higher in the tweet, whereas eventually a book ends up using most English somewhere.

Re:T-Wand: beating Lucene in less than 600 lines of code by huahaiy on Wednesday November 17, 2021 @05:55PM (#29259939)
You either has or has no guarantee, that's what the word "guarantee" means. Don't mince words.

You had a wrong understanding. Now you are corrected. Let's move on.

Nobody said anything about "fewer term matches could not be more relevant". You are just making up straw men here. That's not the discussion we are having.

What I said is this, from a user point of view, it's not good to have a document containing fewer query terms to rank higher. This is a fact that even Lucene acknowledge (at least when they were version 3.5.0.). You have nothing to counter this fact.

Re:T-Wand: beating Lucene in less than 600 lines of code by softwaredoug on Wednesday November 17, 2021 @06:08PM (#29260057)
But you’re arguing that such a guarantee ALWAYS is most relevant. When that’s not always the case.

There’s been extensive research justification behind the vector-space model. BM25 is the 25th iteration of a model and well tuned BM25 holds the highest non nueral performance on many tasks including question answering[1]. Research has long found including factors other than total term matches matters. Such as IDF[2] and field length[3].

Have you benchmarked your relevance assumptions similarly? If so I’d love to see them and learn more!

1 - https://www.elastic.co/blog/improving-search-relevance-with-...

2- https://www.researchgate.net/publication/238123710_Understan...

3 - http://sifaka.cs.uiuc.edu/course/410s12/mir.pdf

Re:T-Wand: beating Lucene in less than 600 lines of code by huahaiy on Wednesday November 17, 2021 @06:31PM (#29260277)
You are making up straw man again. Did I make that claim?

I was simply motivate my work, pointing out it's a problem that the current generation of search engine does not address.

What is "relevance", it is of course a context sensitive question.

You talk as if BM25 is the gold standard when it is not.

The research on this is all over the place. I just read an article that says that BM25 is way worse than alternative language models. You don't have to look far, for example this one that talks about Wand:

https://dl.acm.org/doi/10.1145/2537734.2537744

You know why I quit academia? It is useless arguments and virtual signalings like these.

I'd rather go out and build a damn thing that people like to use.

I merely pointed out that there's a problem, and I have a solution. I did not claim that my problem and my solution solve all problems. Isn't this obvious?

In my problem, my solution beats Lucene. It's as simple as that.

So if Lucene wants to be this infinitely configurable search library, it would be advisable to offer my solution as an option, or offer an better one that does something similar.

So far I have not seen any takers, only excuses.

Re:T-Wand: beating Lucene in less than 600 lines of code by softwaredoug on Wednesday November 17, 2021 @09:11PM (#29261308)
The title of the section quoted is

"Better Relevance"

and I am simply saying, arguably, you can't make that claim without evidence.

(That said, I do find much to like about the article and the WAND / T-WAND explanation. I'm only pointing out you can't claim 'better relevance' without a benchmark to go with it.)

[dead]
Re:T-Wand: beating Lucene in less than 600 lines of code by aleben on Thursday November 18, 2021 @05:52AM (#29264102)
Pardon my intrusion, but I think there's the necessity of toning down the discussion a bit. To be fair it is irrelevant where user A or user B works and I don't see any hostility in this discussion except the one from the blog's author. If the aim is doing Science, let's do this peacefully! I think the main problem that generated this discussion is the form of some sentences of the blog "As someone who has a Ph.D. in Human-computer Interaction ;-), I feel like I am entitled to define a condition of "good" in relevance here. I hereby declare that:

A good top-K algorithm should rank a document containing more user query terms higher than a document containing less number of user query terms. This makes perfect sense. Right?" This should have been changed in: "For the sake of this blog post I am interested in a simplified relevance concept: more query terms matched -> more relevance" In this way the blog would have not caused the outburst of (correct) indignation of the Information Retrieval community, that has been working for years on the topic, and knows very well how much complex is relevance.

Re:T-Wand: beating Lucene in less than 600 lines of code by huahaiy on Thursday November 18, 2021 @10:57AM (#29266881)
That's the problem right there. The so called "Information Retrieval Community" does not seem to care about what users want, and they treat their users in a condescending way, ignoring an obvious problem for years, as clearly demonstrated here and elsewhere.

Why should I care about what they think? In the end of the day, they are serving the users. They are either going to be left behind, or they have to change.

For example, the newer search engines, such us, https://github.com/meilisearch/MeiliSearch, also do what T-Wand does. Users are going to vote by their feet. The "information retrieval community" be damned. It's as simple as that. Got it?

And change they will. What "information retrieval community" are you talking about? Just a bunch of fresh graduates who just got their PH.D, and some college students. That's about it. I don't see any IR professors coming out defending them.

Re:T-Wand: beating Lucene in less than 600 lines of code by huahaiy on Friday November 19, 2021 @12:36PM (#29279872)
The "hostility" I referred to was the one towards the users. Basically, he's demanding users to show evidence that whatever they want is better than BM25.

That's just wrong. Period. This is the reason I mention his job, because his job requires him to listen to the users, instead of taking something he learned in school and use that to talk condescendingly to his users. That's not gonna fly.

Given this context, I think whatever I said it is entirely appropriate.

Re:T-Wand: beating Lucene in less than 600 lines of code by softwaredoug on Thursday November 18, 2021 @06:53AM (#29264443)
Yes for sure! I agree. I mean no disrespect myself, the algorithm seems useful and I wish the author all the best. I know, from personal experience, having your work commented on can be stressful.

I'm just trying to understand what the author meant and their intention for anyone that might revisit this thread later. I think what you're saying sounds plausible as an interpretation.

Re:T-Wand: beating Lucene in less than 600 lines of code by Cavallium on Wednesday November 17, 2021 @05:14AM (#29251043)
I also suggest you to look at his "benchmarks" code
Re:T-Wand: beating Lucene in less than 600 lines of code by huahaiy on Wednesday November 17, 2021 @02:23PM (#29257666)
It's your loss then.

It is actually smug, to suggest the author, in this case, me, a computer scientist and a past professor who taught Information Retrieval class for more than 3 years, and who just came up with a new search algorithm, to "take a look at Wikipedia page for TF-IDF".

In case you have not read the article due to your smugness, my search algorithm also uses TF-IDF and vector space model.

Please do not dis-understand what is going on here: I am running a startup, and I am also old enough to not care about publications as much as people who are younger or in academia.

That's why I chose to reveal this in a blog post instead of hiding it until after my paper is published. Understood?

Re:T-Wand: beating Lucene in less than 600 lines of code by antocv on Thursday November 18, 2021 @03:49AM (#29263457)
Haters gonna hate, dont mind them. Your work is truly amazing, I learned a lot and you opened a whole new world of datalog as an aside.
Re:T-Wand: beating Lucene in less than 600 lines of code by huahaiy on Thursday November 18, 2021 @12:15PM (#29267836)
Thank you. I am glad that you learned something from the article. I wrote the article for people like you, who are seeking knowledge and self improvement.
Re:T-Wand: beating Lucene in less than 600 lines of code by rory_isAdonk on Wednesday November 17, 2021 @04:36AM (#29250790)
Yeah beyond the cringe of thinking a Ph.D really means anything, its just highlights the pure lack of Lucene knowledge.
Re:T-Wand: beating Lucene in less than 600 lines of code by speedgoose on Wednesday November 17, 2021 @05:33AM (#29251224)
A Ph.D means a lot for many people. It's years of work to make the science progress a tiny little bit on a topic you enjoy (supposedly). I think it's a lot harder and meaningful than writing scalable and reliable code as a team in a software company, just to give one example to compare with.
Re:T-Wand: beating Lucene in less than 600 lines of code by tgv on Wednesday November 17, 2021 @06:27AM (#29251594)
But a phd in HCI has very little relevance to information retrieval or computational linguistics.
Re:T-Wand: beating Lucene in less than 600 lines of code by johncearls on Wednesday November 17, 2021 @10:25AM (#29254284)
Exactly this. I have a PHD in CS and am a world class expert in multi-omic data integration and analysis. I'm happy to throw my weight around in that area, but I'd never point to my PhD to pontificate on Neural nets or systems or queuing theory or 99 percent of CS. If getting a PhD doesn't teach you how much you don't know and how hard it is to develop real expertise in any area, I think you wasted your PhD. Note, my PhD isn't on the value of PhDs so take it as you will.
Re:T-Wand: beating Lucene in less than 600 lines of code by huahaiy on Wednesday November 17, 2021 @05:45PM (#29259813)
I think I am pretty qualified to make my declaration, since it is about user experience.

I also do know a lot about IR, because I taught Information Retrieval class for 3 years when I was teaching in university, I read research papers, and I just come up with a new search algorithm.

It's just that some people cannot accept that there are people who can cross fields with ease, make contributions quickly, and move on to the next field that pit their interests.

Yes, I am one of those people. In addition to HCI, I also published in the following areas: VR, DB, NLP, IR and Psychology. Sorry to hurt your feelings, but it is what it is. Accept it and move on.

Re:T-Wand: beating Lucene in less than 600 lines of code by tgv on Friday November 19, 2021 @08:08AM (#29276738)
That's not a new search algorithm. It's about the second one people have come up with. First version: all documents containing all search terms. Second version: counting frequency in document. Since you taught IR for three years, I'm surprised there's no mention of other relevant heuristics, or measuring against benchmarks.
Re:T-Wand: beating Lucene in less than 600 lines of code by huahaiy on Friday November 19, 2021 @09:51AM (#29277725)
Again, you miss the novelty of the algorithm due to your smugness. I have updated the article to point out explicitly where the novelty is at. You completely ignored that. In fact, I believe you didn't even read that far before your jumping out to write this dismissal.

I wrote a blog post for lay people to read. I am under no obligation to do an extensive literature review, I only need to mention the essentials.

You just cannot seem to swallow the fact that someone who does not have a Ph.D in IR or computational linguistics can come in to contribute quickly then move on to something else. It hurts your feelings deeply, does it? Heed my advice, just get over it, don't take your degree or your specialization too seriously. It does not matter.

Re:T-Wand: beating Lucene in less than 600 lines of code by juancb on Wednesday November 17, 2021 @10:29AM (#29254355)
Of course it doesn't and the author doesn't try to make that claim. The author jokes that their HCI PhD is only good enough to give them the authority to make obvious statementd about what a "good" search experience should be for a user.

What did I miss?

Re:T-Wand: beating Lucene in less than 600 lines of code by huahaiy on Wednesday November 17, 2021 @01:22PM (#29256769)
It does have relevance to user experience, which is under discussion.
Re:T-Wand: beating Lucene in less than 600 lines of code by Cthulhu_ on Wednesday November 17, 2021 @08:48AM (#29252891)
Well yeah, but it shouldn't make you smug. A Ph.D, while not the beginning, is definitely not the end, and the people we look up to as Really Smart never sat on their laurels and quit learning, never considered themselves above others.
Re:T-Wand: beating Lucene in less than 600 lines of code by juancb on Wednesday November 17, 2021 @10:21AM (#29254233)
It's fascinating seeing what hacker news thinks is smug. There are plenty of actually smug comments that go without being called out but for some reason this guy does.

The PhD flex in jest by the blog post's author is a bit awkward but I don't know that I would characterize it as smug.

Any insight into why the author is perceived as smug would be appreciated.

Re:T-Wand: beating Lucene in less than 600 lines of code by huahaiy on Wednesday November 17, 2021 @07:18PM (#29260667)
Let me offer my arguably biased insight: racism.

I am obviously a Chinese.

In the eyes of racists, Chinese Americans are supposed to be timid and does not make any noises, but I do make noises, so I am perceived as a smug today because I said I am a Ph.D, something else next time I said something else.

It's not complicated.

Re:T-Wand: beating Lucene in less than 600 lines of code by throwaway744678 on Thursday November 18, 2021 @06:58AM (#29264467)
Wow, I was with you until this. I, for one, never even suspected your origin or nationality reading the blog post.

OK, re-reading it, there are a few hints (a Chinese proverb, your nickname, etc.). But nothing "obvious".

Probably not the explanation we are looking for here.

Re:T-Wand: beating Lucene in less than 600 lines of code by huahaiy on Thursday November 18, 2021 @11:27AM (#29267238)
Not my nickname, my name.

It's good for you that you are not a racist (it's sad that such a normal thing has to be a compliment, but it is a compliment. Good for you.), but racists do look for these cues and make their judgement based on these.

It's an unfortunate current state of affairs that we have to live with. Ignoring it does not make it going away though. If you don't like it, you got to call it out whenever you see it, which I hope you do, instead of being taken back by it, as you seems to be.

Re:T-Wand: beating Lucene in less than 600 lines of code by huahaiy on Thursday November 18, 2021 @02:27PM (#29269348)
BTW, you were with me? Where?

Why do you have to use a throwaway account to say this, I am curious.

Re:T-Wand: beating Lucene in less than 600 lines of code by taeric on Wednesday November 17, 2021 @10:57AM (#29254712)
Agreed. The wink right after it, I would have thought, dulled any smugness.

I could see calling it audacious. But, our industry advances on audacity.

Re:T-Wand: beating Lucene in less than 600 lines of code by marcellus23 on Wednesday November 17, 2021 @08:25AM (#29252648)
Well it’s certainly more meaningful to the person who has one.