Better HN
topnewbestaskshowjobs
Log inSign up

devit

4,235 karma · joined Sep 10, 2015 (11y ago) · 1,525 submissions

Submissions

comment 3y ago · link · parent

You can implement such a system-wide undo with filesystem snapshots using LVM2 or btrfs (or with backup/restore).

However, you also need to properly isolate software in containers or VMs since of course doing a system-wide undo on a system that is running a server will also revert the server state, which is usually disastrous.

comment 3y ago · link · parent

People act based on their beliefs, and their beliefs are not necessarily related to reality; in fact, they usually aren't.

comment 3y ago · link · parent

The 128 bytes of RAM seems quite easy (game state is 32 bytes for chessboard + 1 byte for side-to-move+castling+en-passant plus 2/3 bytes per move in the search stack + 1 byte to record the depth at which castling was disrupted = 54/64 bytes with depth 10, leaving a luxurious 64/74 bytes for call stack and local variables).

The problem seems to be more the 4KB of ROM, but only if one is trying to make it actually somewhat good, and also perhaps using 1979 tech for programming.

comment 3y ago · link · parent

Use pgbouncer

comment 3y ago · link · parent

There probably should be a toggle or a separate brightness control (i.e. "maximum brightness" and "default brightness") if something like that is exposed to the web.

Letting content be arbitrarily much brighter than what the user expects seems a terrible design, easily exploitable by advertisers and all sorts of attention thieves.

comment 3y ago · link · parent

Seems kind of pointless, since the implementations for different languages are independently written and thus the results depend mostly on the skill of the programmers who wrote them (at least for languages that are efficient), and on the quality of the specific standard library features being used if any.

comment 3y ago · link · parent

Well, that's accurate and indeed a major problem.

Subreddit moderators, like unfortunately usually moderators everywhere, can act arbitrarily and there is no way for users to remove or punish moderators.

So this means that /r/$FOO is not actually a subreddit about $FOO, moderated so that exactly any non-spam discussion about $FOO is allowed, but rather a dictatorship ran by whoever happened to grab the name first.

So for instance if a company creates a subreddit about their product before it's announced (which they are guaranteed to succeed at) or perhaps buys or acquires it afterwards, they are allowed to censor it arbitrarily to remove negative opinions or anything they don't like. Amateur moderators can instead moderate according to their personal agenda.

The advantage that something like Reddit can have other normal forums is the existence of an higher authority that users that are banned or censored can petition to to have them ban the moderator instead, and it was pretty absurd that there used to be no way to do that.

comment 3y ago · link · parent

What? Prompts are natural language, so I don't see how they can possibly become obsolete.

comment 3y ago · link · parent

It looks like the reason this apparently weird instruction exists is that AArch64 has a zero register, meaning you can use csinc with two zero register operands to represent cond ? 1 : 0.

Given that AArch64 has/had no 16-bit instruction support, it probably made sense to provide a generalization of a setcond instruction to make use of the encoding space of 32-bit instructions, and that's one of the most obvious (the other ones being cond ? imm : 0 or cond ? imm : reg).

comment 3y ago · link · parent

The fill algorithm is far from being properly optimized:

1. Use pointIdx instead of a string for fill keys. That's going to be way faster and memory efficient

2. There's no need to have separate added and visited. Just keep added and continue checking it before adding to the queue, and don't delete added entries

3. Even better, don't even use added but instead just check the output image data

4. Compute pointIdx incrementally by adding or subtracting 1 or width, only do a multiplication for the first point

5. Don't keep y coordinates in the loop, instead store the minimum and maximum pointIdx and then divide at the end to find the y coordinates (you still need to keep x to compute the x minimum and maximum if you need it, unless you can make the image have a power of two stride, in which case you can just mask pointIdx to compute x)

6. Use a black border instead of doing boundary checks

7. The % 5000 check is horribly slow since division is horribly slow. Use a power-of-two size and a bitwise and to be safe

8. Doing an update every 5000 pixels seems absurdly low. CPUs do billions of operations per second and a pixel should not take more than 100 CPU cycles with proper optimization, so even at around 100 fps you should be able to do in the magnitude of 100K pixels per frame, which means you shouldn't even need to do it incrementally or pre-process. If you really need incrementality you should use both a pixel number check and a timer and adaptively double or halve the pixel number if the timer check gives a too low or high time elapsed.

9. Using "chunks of pixel" is probably faster than single pixels and using horizontal groups of chunks even better, although that requires significantly more code

10. WebAssembly, with SIMD if available, is going to be faster than JavaScript

In general, this code has clearly not been written by someone experienced in writing optimized code, so I assume the pre-processing can also be greatly optimized (if it's even necessary after optimizing the filling code).

Also, there is no need to limit to 256 areas since you can use multiple images and all channels to store larger integers.

comment 3y ago · link · parent

The article claims that an allocator that splits memory based on allocation size is called a "buddy allocator". That's misleading: an allocator that allocates an area for each size class is usually called a "slab allocator", while a "buddy allocator" is one that when needed subdivides a memory area with a power of two size into two half-sized areas that are "buddies", does so recursively to satisfy allocations, and coalesces them again when they are free.

E.g. the Linux kernel used (not sure if it's still like this) a buddy allocator to allocate pages and power-of-two blocks of pages and slab allocators to subdivide those pages and allocate data structures.

Another thing that the article doesn't mention that is important is that most production allocators make use of thread-local storage and either have per-thread caches of free blocks or sometimes whole per-thread memory regions. This is to reduce lock contention and provide memory that is more likely to be in the current core's cache.

comment 3y ago · link · parent

It works like this:

First, convert the input text to a sequence of token numbers (2048 tokens with 50257 possible token values in GPT-3) by using a dictionary and for each token, create a vector with 1 at the token index and 0 elsewhere, transform it with a learned "embedding" matrix (50257x12288 in GPT-3) and sum it with a vector of sine and cosine functions with several different periodicities.

Then, for each layer, and each attention head (96 layers and 96 heads per layer in GPT-3), transform the input vector by query, key and value matrices (12288x128 in GPT-3) to obtain a query, key and value vector for each token. Then for each token, compute the dot product of its query vector with the key vectors of all previous tokens, scale by 1/sqrt of the vector dimension and normalize the results so they sum to 1 by using softmax (i.e. applying e^x and dividing by the sum), giving the attention coefficients; then, compute the attention head output by summing the value vectors of previous tokens weighted by the attention coefficients. Now, for each token, glue the outputs for all attention heads in the layer (each with its own key/query/value learned matrices), add the input and normalize (normalizing means that the vector values are biased and scaled so they have mean 0 and variance 1).

Next, for the feedforward layer, apply a learned matrix, add a learned vector and apply a ReLU (which is f(x) = x for positive x and f(x) = kx with k near 0 for negative x), and do that again (12288x49152 and 49152x12288 matrices in GPT-3, these actually account for around 70% of the parameters in GPT-3), then add the input before the feedforward layer and normalize.

Repeat the process for each layer, each with their own matrices, passing the output of the previous layer as input. Finally, apply the inverse of the initial embedding matrix and use softmax to get probabilities for the next token for each position. For training, train the network so that they are close to the actual next token in the text. For inference, output a next token according to the top K tokens in the probability distribution over a cutoff and repeat the whole thing to generate tokens until an end of text token is generated.

comment 3y ago · link · parent

It's more efficient, both in time (optimized character parsing, no repeated work if parser backtracks) and memory usage (store identifiers as an interned byte string instead of a tree of character tokens).

It also makes it easier for some tools to only use the lexer, which makes them more likely to work even if code is not syntactically correct or written for a newer language revision than the tool.

comment 3y ago · link · parent

Radio towers are at much lower altitude, so you need way more of them than satellites to cover the whole planet. Also you need permission on land and you need a boat in addition to the tower on the sea. Plus always having line of sight to the tower is harder unless you make them extra tall. I assume that makes them much more expensive and is why cell phone coverage is not global.

comment 3y ago · link · parent

Looks like the actual threat is that it's hard to get currently known chemical weapons synthesized because labs will refuse to do so, while it could be much easier to have some novel AI-generated molecule synthesized because the labs don't know what it does.

Seems easily countered by using the same toxicity prediction software when evaluating synthesis requests (but I'm not sure whether this actually matters, or whether skilled chemists can easily synthesize anything themselves anyway).

comment 3y ago · link · parent

Well, the safe approach is to either have the user provide their own API key, or to perform requests on the backend (after verifying the user has an account, correctly authenticated, has paid and deducting from their quota).

Or you could generate a per-user subkey with a quota if the upstream service supports that.

comment 3y ago · link · parent

Here you can apply the most common technique for such problems, which is to create a graph whose vertices are pairs made of a vertex of the original graph, plus the "state" of the traversal (or in other words, the essential information about the path used to reach the vertex).

In this case, the state is the number of walls passed, so just create a graph made of (v, k) pairs where for adjacent v and w in the grid, (v, k) connects to (w, k) if there is no wall, and it connects to (w, k + 1) if there is a wall.

Then run A*, finding the shortest path from (start, 0) to (end, 1), reconstruct the path and look at where it transitions from a (v, 0) to a (w, 1) and then return the wall between v and w.

You can use this for all sorts of other constraints, like finding a path that only changes direction up to N times, or a path where you don't get eaten by the monster moving deterministically (in this case the state is the monster position), or a path where you spend up to N time underwater consecutively, etc.

But GPT-4 seems very bad at solving problems, so even though this is an easy problem, it's not unexpected that it would not come up with this solution.

comment 3y ago · link · parent

You can do that, but there's a tradeoff of losing properties that otherwise hold.

For example, by adding the imaginary numbers, there is no longer an ordering compatible with addition and multiplication (ordering compatible with multiplication means that z > 0 and x > y implies x * z > y * z: assuming that, if 0 < i, then 0 = 0 * i < i * i = -1, absurd, or if 0 > i and thus 0 < -i, then 0 = 0 * -i < -i * -i = -1, absurd).

You can certainly add a number x such that x = x + 1 (e.g. what is commonly called an infinity or NaN), but that implies no longer having additive left inverses assuming you keep associativity of addition and 0 != 1 (since otherwise 0 = -x + x = -x + (x + 1) = (-x + x) + 1 = 0 + 1 = 1).

comment 3y ago · link · parent

Italy has not banned ChatGPT: that would be accomplished by a DNS-level block on national ISP resolvers that has not been applied, which would be trivially circumvented by using an unaffected DNS resolver.

Rather, OpenAI has decided to respond to an injuction to stop processing Italian PII within 20 days by immediately configuring their Cloudflare account to block connections from IPs where the GeoIP lookup resolves to Italy, which is easily circumvented by a VPN or proxy.

comment 3y ago · link · parent

Interestingly they seem to have different token ids for "Word", "word", " Word" and " word". That seems kind of a wasteful design.

It seems like it would make more sense to have a single token for all variants and then a "capitalized where not expected" token (e.g. "foo Foo"), a "not capitalized where expected" token (e.g. "foo. foo") and a "missing space where expected" token (e.g. "foo.Foo").

The lack of any normalization also means that WrItInG tExT lIkE tHiS will make future GPT versions not be able to make full use of the text during future training unless they change the tokenization (or the model is so overpowered that it doesn't matter).

comment 3y ago · link · parent

In-person competitions simply don't allow any Internet access, you have to use their own machines and you can't bring any data or printed material or electronic device.

comment 3y ago · link · parent

GPT-4 is competely incapable of solving any advanced problem in coding or mathematics competitions, and usually doesn't even appear to correctly understand the problem statement (assuming the solutions are not in the training set, of course).

Just try submitting the IOI 2022 and IMO 2022 problems.

Obviously it still outperforms the average human, since the average human has no knowledge of mathematics or computer science whatsoever.

comment 3y ago · link · parent

It's a bit annoying that you have to pay for Copilot just to sign up for the waitlist, rather than being able to either pay for acceptance or start paying when you are accepted.

comment 3y ago · link · parent

Missing discrete GPU and ECC RAM.

comment 3y ago · link · parent

Basically this expresses the image as an image where each row is a linear combination of a set of K rows, with different coefficients for each row (or equivalently for columns).

In general it doesn't make sense to compress images this way, since the algorithm is not invariant with respect to 2D image rotation, a very relevant operation for realistic images, but is invariant with respect to row/column permutations, which are not a relevant operation for realistic images.

comment 3y ago · link · parent

And the problem is that such a thing doesn't really work on mainstream CPUs, because memory access instructions take a highly variable amount of cycles depending on which cache level the data is in, which the compiler cannot know, and generating code for all possibilities leads to exponential blowup of the source code size.

It's not clear how Intel thought it could possibly work.

comment 3y ago · link · parent

This appears to just hallucinate it using the LLM (easily seen by using made-up words).

A much better approach would be to do a Wikipedia/web search and then ask the LLM to summarize the results for a 5 years old.

comment 3y ago · link · parent

As long as you build unwinding tables for each function (which I'm pretty sure gcc has an option for), there is no need for a frame pointer unless the function uses alloca or stack VLAs.

comment 3y ago · link · parent

Because an unexploitable browser (which is the main fundamental advantage of Servo) is more important for Tor than elsewhere since an exploit will compromise anonymity.

Also, since Tor browsing is often done with JavaScript off, and removing JavaScript removes a huge amount of web features that need to be supported (including a JavaScript engine, which I think Servo still doesn't have a pure Rust implementation of), it's much easier to make a usable browser for this use case than others.

1
101112
51