Science Is Open Software
Science Is Open Software / 科学即开源软件
TL;DR I claim that modern science is synonymous with open source software. This post explains why, why it matters, and what you can (and should) do next.
简而言之:我主张现代科学与开源软件是同义词。本文将解释其原因、重要性,以及你接下来可以(也应该)做些什么。
Why do you care about (open source) software? - Everyone 为什么你应该关心(开源)软件?——致所有人
I spend a lot of my time working on software. I have been asked why software matters more times than I can remember. Software is, people say, not science. It’s a time sink, something to rush past in the pursuit of what really matters: results (and papers if you’re in academia). Publish or perish.
我花费大量时间从事软件开发工作。我被问过无数次“软件为什么重要”。人们常说,软件不是科学。它只是浪费时间,是追求真正重要事物(如研究成果,或者学术界的论文)过程中的绊脚石。不发表就出局(Publish or perish)。
Well. I think software matters. In fact, I think open source software is science. Or, at least computational science. And this post tells you why. Why we as scientists must insist on the scientific method and why that means working on open and reproducible software. This post is not easy to write. It challenges many of the current trends in academia, but it is an important move towards better science that doesn’t turn us all insane.
好吧,我认为软件很重要。事实上,我认为开源软件就是科学,或者至少是计算科学。本文将告诉你原因:为什么我们作为科学家必须坚持科学方法,以及为什么这意味着必须致力于开发开放且可复现的软件。写这篇文章并不容易,它挑战了学术界的许多当前趋势,但这是迈向更好科学的重要一步,能让我们不至于陷入疯狂。
What is science? 什么是科学?
If you look up science on Wikipedia, here’s what hits you: Science is a systematic discipline that builds and organises knowledge in the form of testable hypotheses and predictions about the universe. - Wikipedia
如果你在维基百科上查阅“科学”,你会看到: 科学是一门系统的学科,它以关于宇宙的可检验假设和预测的形式构建并组织知识。——维基百科
Now, go and grab a random arXiv paper. It clearly contains “knowledge” of some sort. But, does the paper contribute predictions that are testable and can by systematically organized? Can you test it? Can you systematize it? The answer is never a flat no, but it’s hard. You rarely have direct access to that knowledge.
现在,随便找一篇 arXiv 论文。它显然包含某种“知识”。但是,这篇论文是否提供了可检验且能被系统组织的预测?你能检验它吗?你能将其系统化吗? 答案从来不是绝对的“不”,但确实很难。你很少能直接获取那些知识。
The good explanation - inner models 好的解释——内在模型
If the organism carries a ‘small-scale model’ of external reality and of its own possible actions within its head, it is able to try out various alternatives, … and in every way to react in a much fuller, safer, and more competent manner to the emergencies which face it. In his excellent book The Nature of Explanation, Kenneth James Williams Craik posits that we use small simulations of reality to explain and predict the world outside.
如果生物体在头脑中携带了一个关于外部现实及其自身可能行为的“小型模型”,它就能够尝试各种替代方案……并以更全面、更安全、更有效的方式应对所面临的紧急情况。 肯尼斯·詹姆斯·威廉姆斯·克雷克(Kenneth James Williams Craik)在其杰作《解释的本质》(The Nature of Explanation)中提出,我们利用现实的小型模拟来解释和预测外部世界。
This point seems obvious today, but it highlights the goal of pursuing science in the first place: you, as an acting entity, improves your inner model to the point that you can make better predictions than before. The inner model here is critical: if the arXiv paper does not help their readers predict the world, it is not science. This is why computational reproducibility matters–software is how we encode and share predictive models.
这一点在今天看来显而易见,但它突显了追求科学的初衷:作为行动主体,你不断改进自己的内在模型,直到能够做出比以前更好的预测。这里的“内在模型”至关重要:如果 arXiv 论文不能帮助读者预测世界,那它就不是科学。这就是计算可复现性重要的原因——软件正是我们编码和共享预测模型的方式。
What is reproducibility? 什么是可复现性?
Recall that according to Wikipedia, it is not enough to demonstrate results alone. Results have to be (1) systematic and they have to be (2) testable. It is entirely possible that the given paper is too hard to understand or unaccessible to the audience for other reasons. That does not mean that there are no scientific insights to find—readers may find ways to systematize them on their second or third reading. No, it means that you specifically cannot take the idea as your own, test it, and use it to improve your world model.
回想一下维基百科的定义,仅仅展示结果是不够的。结果必须是 (1) 系统的,并且 (2) 可检验的。 完全有可能某篇论文因为太难理解或由于其他原因而无法被受众获取。这并不意味着其中没有科学见解——读者可能在阅读第二或第三遍时找到将其系统化的方法。不,这意味着你个人无法将该想法据为己有、进行检验,并用它来改进你的世界模型。
Reproducibility, in this context, is not only the duplication of results. It is the ability to take the scientific idea, embed it into your own inner model, adapt it, and build upon it—or discard it because it reduces predictability. If an idea is not reproducible, the findings cannot be expanded. And are, therefore, useless.
在这种语境下,可复现性不仅是结果的复制。它是指能够获取科学思想,将其嵌入你自己的内在模型中,进行调整并在此基础上构建——或者因为其降低了可预测性而将其丢弃。 如果一个想法不可复现,研究结果就无法扩展,因此也就毫无用处。
This becomes clear if we do a quick thought-experiment where we replace “software model” with “mathematical model”. Just as we wouldn’t accept a physics paper that said our equations predict X but we won’t show the math, we shouldn’t accept (computational) science that hides its methods.
如果我们做一个简单的思想实验,将“软件模型”替换为“数学模型”,这一点就变得很清楚了。正如我们不会接受一篇声称“方程预测了 X 但不展示数学推导”的物理学论文一样,我们也不应该接受隐藏其方法的(计算)科学。
Why is software science? 为什么软件就是科学?
How many fields have been held back, and how many people have had their careers disrupted, because of a buggy program? - Greg Wilson Software is ubiquitous in modern science. Anything from CoVid models to search algorithms to lab protocols are build on software built by other people. Researchers are busy people. They don’t bother to look through all software dependencies to verify correctness, understand implementation details, or check for potential errors that could invalidate results.
有多少领域因为程序漏洞而停滞不前,又有多少人的职业生涯因此受到干扰?——格雷格·威尔逊(Greg Wilson) 软件在现代科学中无处不在。从新冠病毒模型到搜索算法,再到实验室规程,一切都建立在他人开发的软件之上。研究人员很忙,他们不会费心去检查所有的软件依赖项以验证正确性、理解实现细节,或检查可能导致结果失效的潜在错误。
From that follows that the scientific results depend on the software. If the software is wrong, the science is wrong. (Software bugs already cause numerous retractions, such as here, here, here, and several places here). And that is well and good, because at some point we have to trust and rely on other’s work. For that to happen, it (software) needs to be reliable.
由此可见,科学结果依赖于软件。如果软件错了,科学也就错了。(软件漏洞已经导致了无数次撤稿,例如这里、这里、这里,以及这里的几处)。 这本身没问题,因为在某种程度上我们必须信任并依赖他人的工作。为了实现这一点,它(软件)必须是可靠的。
Why open source? 为什么选择开源?
We found that software needs to be:
- Reproducible, meaning executable, as well as modifiable, and
- Reliable, meaning that the results are consistently trustworthy.
我们发现软件需要:
- 可复现,即不仅可执行,而且可修改;
- 可靠,即结果始终值得信赖。
Modifiability is important for science for the same reason that equations are important for scientific predictions. Reliability is crucial because we want systematic improvement of our knowledge, not flaky and partial results that only work occasionally.
可修改性对科学很重要,原因与方程对科学预测的重要性相同。可靠性至关重要,因为我们追求的是知识的系统性提升,而不是那种偶尔才奏效的、不稳定的局部结果。
This is what open source software gives us. We can change code and retrofit it to suit our needs (just think about Hugging Face models) and we can iterate upon it to continue to improve it. It already generates trillions in value and there is room for much, much more.
这就是开源软件带给我们的东西。我们可以修改代码并根据需要进行改造(想想 Hugging Face 的模型),我们可以在此基础上迭代以不断改进它。它已经创造了数万亿美元的价值,而且还有巨大的增长空间。
Of course, open source software is not a perfect cure. There are IP and security concerns, bugs can still occur, and stability can be a problem. But at least the imperfections are on public record. They can be amended and improved, just like our scientific understanding. From that perspective, one can claim that open source software is the scientific method—just in simulation.
当然,开源软件并非万能药。它存在知识产权和安全隐患,漏洞依然可能出现,稳定性也可能成为问题。但至少这些缺陷是公开记录的。它们可以像我们的科学认知一样被修正和改进。从这个角度来看,我们可以断言:开源软件就是科学方法——只不过是在模拟环境中。
A vision for future science 对未来科学的愿景
If we accept these premises we can ask: what would truly open (computational) science look like? Every result is instantly reproducible. When you read a paper claiming that a new drug reduces symptoms by 30%, you click a link and watch the exact analysis run in your browser. The data processing, statistical tests, and visualizations execute in seconds using the same environment the authors used—preserved perfectly through reproducible containers.
如果我们接受这些前提,我们就可以问:真正开放的(计算)科学会是什么样子? 每一个结果都是即时可复现的。当你读到一篇声称某种新药能减轻 30% 症状的论文时,你点击一个链接,就能在浏览器中看到完全相同的分析过程在运行。数据处理、统计检验和可视化结果在几秒钟内执行完毕,使用的正是作者所用的环境——通过可复现的容器完美保存。