Compressed Filesystems and Language Models

Many systems engineers eventually consider building a filesystem. While creating a robust, production-ready filesystem is complex and challenging, a minimal working filesystem is surprisingly simple a

Many systems engineers eventually consider building a filesystem. While creating a robust, production-ready filesystem is complex and challenging, a minimal working filesystem is surprisingly simple and manageable, especially for coding AI agents.

Recently, I’ve been testing how well coding models can emulate filesystems using just a single shot. As models improved, I wondered if they could even understand the filesystem engine itself, given that a filesystem is an ideal black box to experiment with various backends and stress-test language models.

Training a Filesystem

I began by modifying a simple FUSE (Filesystem in Userspace) setup, repurposing it with a model called Claude to create a loopback filesystem that logs all operations. This setup allowed the filesystem to perform real operations on the host system while recording every action, providing perfect semantic accuracy and rich training data.

Next, I developed a simulation that generated diverse filesystem interactions on this logged filesystem. I focused on capturing essential read/write operations, ignoring more complex ones like open or fsync, and recorded the entire filesystem state after each change. The data was formatted in XML for clarity and ease of parsing, with prompts combining filesystem actions and the current filesystem tree.

From this data, the model learned to respond to two primary types of prompts:

– Read requests, which asked for file contents or metadata, such as size or modification time.
– Write requests, which involved updating files or directories and then outputting the updated filesystem state.

For example, a read prompt might look like this:

Read request:

Filesystem state:

And the model’s response would include the file content.

Fine-tuning and Evaluation

With a diverse, high-quality dataset, fine-tuning the model was straightforward using standard techniques on Modal. After several training cycles, the model achieved about 98% accuracy on a separate evaluation set, trained over 8 epochs with a dataset of 15,000 examples, using the Qwen3-4b architecture.

Most of the effort went into cleaning and balancing the data—making sure every filesystem operation was well-represented and that the dataset included complex directory trees for the model to learn.

Testing the model in real-world scenarios, I built a minimal filesystem that directly passed filesystem operations through to the language model. This way, every operation like chmod was handled by the AI, making it possible to run a truly adaptive, intelligent filesystem.

Conclusion

This approach demonstrates the potential of language models to learn and emulate filesystem behaviors effectively. With sufficient training data and careful fine-tuning, models can understand and replicate core filesystem operations, opening new avenues for developing smart, self-healing, or adaptive storage systems.

FAQs

Q: Can language models replace traditional filesystems?
A: While promising, current models are best suited for specific tasks or prototypes. Fully replacing robust, performance-critical filesystems requires further development.

Q: How complex can a model-made filesystem be?
A: Currently, models handle basic read/write operations well but struggle with complex system-level features like concurrency, fault tolerance, or high performance.

Q: What are the benefits of using AI for filesystems?
A: AI can provide adaptive management, error recovery, and intelligent data organization, potentially improving resilience and efficiency.

Q: Is this approach practical for everyday use?
A: Not yet. It’s mainly experimental, but it illustrates the potential for intelligent, self-improving storage systems in the future.

More Reading

Post navigation

Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

If you like this post you might also like these

back to top