32,383 karma · joined Jan 3, 2008 (18y ago) · 8,295 submissions
comment 2y ago · link · parent
I had a thought in my reply [0] on this that actually might let him eat his cake and have it too in this regard. I think you can heavily abuse serde::de::Visitor to schema validate without actually parsing (or with less parsing, at any rate). I went into more detail in my comment but I wanted to ping you (@duped).
comment 2y ago · link · parent
Two suggestions: it’s not immediately obvious whether subsequent benchmark result tables/rows show deltas from the original approach or from the preceding one (it’s the latter, which is more impressive). Maybe call that out the first couple of times?
Second, the “using the single Vec but mutating it” option would presumably benefit from a reserve() or with_capacity() call. Since in that approach you push to the vector in both erroring and non-erroring branches, it doesn’t have to be exact (though you could do a bfs search to find maximum depth, that doesn’t strike me as a great idea) and could be up to some constant value since a single block memory allocation is cheap in this context. (Additionally, the schema you are validating against defines a minimum depth whereas the default vec has a capacity of zero, so you’re guaranteed that it’s a bad choice unless you’re validating an empty, invalid object.)
But I agree with the sibling comment from @duped that actually parsing to JSON is the biggest bottleneck and simply parsing to the minimum requirements for validation would be far cheaper, although it depends on if you’ll be parsing immediately after in case it isn’t invalid (make the common case fast, assuming the common case here is absence of errors rather than presence of them) or if you really do just want to validate the schema (which isn’t that rare of a requirement, in and of itself).
(Edit: I do wonder if you can still use serde and serde_json but use the deserialize module’s `Visitor` trait/impl to “deserialize” to an enum { Success, ValidationError(..) }` so you don’t have to write your own parser, get to use the already crazy-optimized serde code, and still avoid actually fully parsing the JSON in order to merely validate it.)
If this were in the real world, I would use a custom slab allocator, possibly from storage on the stack rather than the heap, to back the Vec (and go with the last design with no linked lists whatsoever). But a compromise would be to give something like the mimalloc crate a try!
comment 2y ago · link · parent
But I’m not an expert!
comment 2y ago · link · parent
Obviously there's a reason in dropping the price of gpt-4o but not gpt-4t. Yes, the new tokenizer has improvements for non-English tokens, but that can't be the bulk of the reason why 4t is more expensive than 4o. Given the multi-model training set, how is 4o cheaper to train/run than 4t?
Or is this just a business decision, anyone with an app they're not immediately updating from 4t to 4o continues to pay a premium while they can offer a cheaper alternative for those asking for it (kind of like a coupon policy)?
comment 2y ago · link · parent
comment 2y ago · link · parent
A budget is normally set and it is funded by property taxes as a ratio of the asset value compared to all other asset values in the county. If your home didn’t increase in value nor did anyone else’s you’d pay the same amount because that budget has to be realized one way or the other.
Some jurisdictions make this less transparent by taxing at a flat rate (x% of assessed home value) but that’s misleading because they determined that rate to set their budget to begin with. If there were a downturn in property values across the board that didn’t happen at the same time as a recession somehow such that the monetary outflow remained high (high employment for the local government, high costs, no deflation, etc) then there would be a budget crisis and they’d revisit that percentage.
comment 2y ago · link · parent
I must say though, is it jina or bge-3/flag - the embeddings (and tokenizer?) do not do a good job on tech topics. It's fine for natural words, but searching for tech concepts like "xaml", "simd", etc cause it fall back to tokenizing the inputs and tries to grab similar sounding words.
Also, just some constructive feedback, if there were some way to stop it from showing the same "hn leaderboard" of results when there are no results because a topic is too niche would be nice. I get a lot of "Stephen Hawking has died" when searching for words the embeddings aren't familiar with.
Edit: I'm not so sure how well the sentiment analysis is working. I had the feeling that there was too much negative sentiment that didn't match up to reality, so I tried looking up things HN would feel overwhelmingly positive about like "Mr Rogers", I mean, who could feel negatively about him? The results show some serious negative spikes. Look up "Carter" and there's a massive negative peak associated with the passing of Rosalynn Carter. It was an HN submission talking about all the wonderful things the Carters did.
Also, I think the "popularity over time" needs to be scaled by the median number of votes a story got that month/year, because the trend lines just go up and up if you plot strictly the number of posts. Look at the popularity of "diesel" and you'll see what I mean - this is a term that peaked ten years ago! Or perhaps it should be some sort of keyword incidence rate or number of items with a cosine similarity index of less than x from the query rather than post score, maybe?
Edit2: The dynamic "click a post to remove and recalculate similarity threshold" is awesome.
comment 2y ago · link · parent
It's great that it's self-bootstrapping, though. I thought they would have you install both this tool and CMake in order to build the project on end-user's machines.
comment 2y ago · link · parent
This sounds really elegant and simple to the point where people might take it as an axiomatic fact but the very existence of both nuclear fission and fusion stops it from being a general rule. They’re both discharging power from individual atoms and it would actually be great if we had a way to slow down the rate of discharge.
comment 2y ago · link · parent
You could say that. You could also be more pedantic and say that this comes at the cost of some decrease in battery life (and efficiency) due to the resistance resulting in some amount of heat in order to facilitate this high-speed charging process.
But I don’t know if the ROI on improved battery life would be worth the complexity, size, weight, and cost of a two-stage charging process. As battery tech improves, that resistance continues to come down.
comment 2y ago · link · parent
Given the enormous scope of this transition, I have to wonder how many will be benefiting from this 15 years from now. I don’t question it will have utility, but I wonder about the ROI.
comment 2y ago · link · parent
comment 2y ago · link · parent
It is an owned pointer, with emphasis on the "owned". You can have as many raw pointers to the same memory location as you like, you just can't have multiple native rust objects pointing to that same memory alive at once, though. It's also obvious because Box<T> implements Drop, so obviously it's not just something you can pass to a function in lieu of a pointer and if you do pass it to a function, you can no longer make any assumptions about the lifetime or validity of any pointers to the same data.
comment 2y ago · link · parent
It keeps secrets out of your environment variables and lets you manage secrets the same way you do code (in lock-step with the code that uses it and as easy to update a secret just by pushing to git), but it's definitely for smaller teams or projects. It also has significantly fewer moving parts or dependencies.
comment 2y ago · link · parent
> While it can be argued that box is like a T, but on the heap, and therefore moving it should invalidate pointers, since moving T definitely has to invalidate pointers to it, this comparison doesn’t make sense to me. While Box<T> usually behaves like a T, it’s just a pointer.
The "it's just a pointer" argument is moot (and pointers have nothing to do with the issue, it's a question of exclusive ownership and nothing more). It's a high-level object (i.e. not a pointer) to which rust's very clear aliasing and single name rules apply. Thou shalt not have multiple live T that point to the same memory address. QED.
It's the same reason this code is unsafe:
struct Foo;
impl Foo {
fn bar(&mut self) { ... }
fn baz(&self) { ... }
}
fn get_foo() -> &mut Foo {
unsafe { static mut FOO_SINGLETON: Foo = Foo; }
unsafe { &mut FOO_SINGLETON }
}
Here we don't even have a pointer, only statically allocated data stored in .TEXT. We don't even create a second top-level instance of Foo, only an &mut reference to it. But it's unsafe because the compiler can't know whether or not it has exclusive access.(As a refresher, in terms of "strength" of ownership from the most exclusively owned to the least so, it would go T -> &mut T -> &T.)
comment 2y ago · link · parent
https://www.newsweek.com/john-barnett-boeing-whistleblower-p...