| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
PDF available on arXiv
InSQuaD is a research framework for efficient in-context learning that leverages submodular mutual information to optimize the quality-diversity tradeoff in example selection for large language models. This implementation supports various retrieval methods, subset selection strategies, and generative models for comprehensive evaluation across multiple datasets.
Clone the repository:
git clone https://github.com/Ghost---Shadow/InSQuaD.git
cd InSQuaDCreate conda environment (recommended):
conda create -n InSQuaD python=3.9 -y
conda activate InSQuaDInstall dependencies:
./devops/install.shSet up environment variables: Create a .env file in the root directory with your API keys:
OPENAI_API_KEY=your_openai_key_here
WANDB_API_KEY=your_wandb_key_hereSingle experiment:
python src/train.py experiments/tests/InSQuaD_test_experiment.yamlFull experiment suite:
sh run_all_experiments.shOffline evaluation:
python src/offline_eval.py path/to/experiment/config.yamlSee experiments/ directory for configuration examples.
Run the test suite to ensure everything is working correctly:
# Test everything (some tests may fail on Windows)
python -m unittest discover -s src -p "*_test.py"
# Test specific modules
python -m unittest discover -s src.dataloaders -p "*_test.py"
python -m unittest discover -s src.dense_indexes -p "*_test.py"
python -m unittest discover -s src.shortlist_strategies -p "*_test.py"
python -m unittest discover -s src.subset_selection_strategies -p "*_test.py"Format code using Black:
black .src/ ├── dataloaders/ # Dataset loading and preprocessing ├── dense_indexes/ # FAISS and other dense retrieval indexes ├── generative_models/ # LLM wrappers (OpenAI, HuggingFace) ├── losses/ # Submodular loss functions ├── semantic_search_models/ # Embedding models ├── shortlist_strategies/ # Example selection strategies ├── subset_selection_strategies/ # Submodular optimization └── training_strategies/ # Training loops and algorithms
The framework includes comprehensive analysis tools:
Results are automatically logged to Weights & Biases for easy tracking and comparison.
Please ensure your code follows the existing style and includes appropriate tests.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
If you use this code in your research, please cite:
@inproceedings{insquad2025,
title={InSQuaD: In-Context Learning for Efficient Retrieval via Submodular Mutual Information to Enforce Quality and Diversity},
author={Nanda, Souradeep and Majee, Anay and Iyer, Rishab Krishnan},
booktitle={Proceedings of the 2025 IEEE International Conference on Data Mining (ICDM)},
year={2025},
organization={IEEE},
url={https://github.com/Ghost---Shadow/InSQuaD}
}For questions, issues, or feature requests, please open an issue on GitHub or contact the maintainers.
| Back | FazBrowse Home | New Git URL |