Predicting UNIX Command Lines: Adjusting to User Patterns

Benjamin Korvemaker, Russell GreinerAAAI 2000

TL;DR

This paper introduces an adaptive UNIX shell that predicts a user's next command to simplify interactions. While simple prediction models achieve decent accuracy, surprisingly, adding more complex features often degrades performance, suggesting that user command patterns are inherently non-stationary and high-dimensional. The authors propose a "mixture of experts" approach to effectively combine simpler predictors and achieve a modest but significant improvement.

What Problem Does This Paper Address?

Modern computer applications are becoming increasingly complex to accommodate a wider range of tasks and users. While customization options exist, they often require users to manually adjust parameters or define macros, a tedious process that demands user awareness of their own preferences and technical knowledge. This paper tackles the challenge of creating adaptive interfaces that can autonomously learn user preferences and adjust the interface accordingly. Specifically, they focus on a UNIX shell that predicts the user's next command to streamline future interactions, aiming to make the interface more intuitive and less demanding for the user.

Methods

The core of the system is a command-line prediction engine. Initially, the authors explore a simple approach based on the Davison and Hirsh (DH98) system, which uses a probabilistic model (specifically, an "adaptive user model" or AUR) to predict the next command stub (the executable part of a command). They extend this to predict complete commands rather than just stubs.

Several techniques were explored to improve prediction accuracy:

  • Including Error Codes: Using the error code from the previous command to inform predictions.
  • Temporal Information: Incorporating day of the week and time of day.
  • Parsing Commands: Abstracting commands to generalize patterns (e.g., recognizing dvips foo.dvi and dvips bar.dvi as instances of a broader pattern).
  • Longer Command History: Considering the previous two commands (or more) instead of just the immediately preceding one.

Surprisingly, most of these additions degraded performance. This led to the development of a "Mixture of Experts" (MoE) approach. In this framework, multiple "experts" are trained, each using a different subset of information (e.g., previous actual commands, parsed commands, last 100 commands, first command of a session). These experts' predictions are then combined using a probabilistic model to produce a final, improved prediction. This MoE approach aims to reduce the dimensionality of the problem and handle the non-stationary nature of user command patterns.

Datasets

The primary dataset used for evaluation is the Greenberg dataset. This dataset contains approximately 287,000 command lines from 168 users over several months, representing a range of skill levels. The authors note that while this data is ten years old, it remains a reasonable benchmark. They also mention collecting their own data, which includes more detailed information like current working directory, command timing, and system identification, for future work.

Key Insights and Ideas

  • "One Size Does NOT Fit All": User interfaces need to adapt to individual preferences and usage styles.
  • Manual Customization is Tedious: Users often don't customize interfaces due to complexity and lack of awareness of their own preferences.
  • Simple Prediction Works Surprisingly Well: A basic model predicting the next command based on the previous one can achieve nearly 50% accuracy.
  • More Information Isn't Always Better: Adding complex features like error codes, time of day, or longer history often reduces prediction accuracy. This is attributed to the high dimensionality of the parameter space and the non-stationary nature of user command distributions.
  • Mixture of Experts is Key: Combining predictions from multiple simpler, specialized "experts" is a more effective way to improve accuracy than simply adding more features to a single model.
  • User Command Patterns are Inherently Noisy: Even with perfect knowledge of the future, prediction accuracy is limited, with only about 72% of commands being duplicates of previous ones.

Key Results

  • The simple "AUR"-like system (predicting based on the previous command) achieved 47.4% accuracy in predicting the complete next command line on the Greenberg dataset.
  • Attempts to improve this by incorporating error codes, day of week, or time of day resulted in degraded performance, with accuracies dropping to around 46-47%.
  • Using the previous two commands (instead of one) also led to a significant drop in accuracy to 36.9%.
  • The "Mixture of Experts" approach, combining predictions from various experts, achieved a slight but statistically significant improvement, reaching 47.9% accuracy.
  • The authors note that even with perfect future knowledge, their system could only achieve 45.5% accuracy on the same data, highlighting the inherent difficulty and stochasticity in predicting user commands.

Limitations and Future Work

Limitations:

  • The authors acknowledge that their current system's accuracy, while improved, is still far from perfect.
  • The Greenberg dataset, while useful, might lack some finer-grained information that could further enhance prediction.
  • The current system's accuracy is limited by the inherent stochasticity and non-stationarity of user command patterns.

Future Work:

  • Collecting Richer Data: The authors are collecting their own data with more detailed information (e.g., command timing, directory navigation) to build more sophisticated models.
  • Automated Shell Macro Construction: Using the predicted patterns to automatically generate shell macros.
  • Exploring Other Applications: Investigating the applicability of command prediction in other domains like word processors, presentation software, or even optimizing communication for devices like PDAs.
  • Improving User Interface: Enhancing the shell's interface with features like auto-completion and better integration with existing tools (like ZSH).
  • Incorporating More Information: Continuing to explore the "mixture of experts" framework by incorporating additional information like error codes and time of day more effectively.

Summary updated

BibTeX
@inproceedings{korvemaker2000predicting,
  author = {Benjamin Korvemaker and Russell Greiner},
  title = {{Predicting UNIX Command Lines: Adjusting to User Patterns}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2000},
  url = {https://openreview.net/forum?id=HyZfWRluWH},
}
Figure