{"id":17318424,"url":"https://github.com/quantisan/itune","last_synced_at":"2026-05-01T15:39:30.249Z","repository":{"id":196393895,"uuid":"694619312","full_name":"Quantisan/itune","owner":"Quantisan","description":"i tune your parameters so you don't have to","archived":false,"fork":false,"pushed_at":"2024-01-18T02:24:16.000Z","size":158,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-01T08:13:21.053Z","etag":null,"topics":["parameter-tuning","reinforcement-learning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Quantisan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-21T11:06:52.000Z","updated_at":"2023-10-16T09:20:59.000Z","dependencies_parsed_at":"2024-12-05T12:38:07.625Z","dependency_job_id":null,"html_url":"https://github.com/Quantisan/itune","commit_stats":null,"previous_names":["quantisan/rlhf-wizard","quantisan/itune"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantisan%2Fitune","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantisan%2Fitune/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantisan%2Fitune/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quantisan%2Fitune/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Quantisan","download_url":"https://codeload.github.com/Quantisan/itune/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245768723,"owners_count":20669053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["parameter-tuning","reinforcement-learning"],"created_at":"2024-10-15T13:19:47.830Z","updated_at":"2026-05-01T15:39:25.188Z","avatar_url":"https://github.com/Quantisan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# i tune your parameters so you don't have to\n\nitune is a Python package for optimizing parameters using reinforcement learning with human feedback (RLHF).\n\n## Example: Favourite number guessing game\n\nThis code example demonstrates a simple guessing game using `itune`. The algorithm will randomly choose a number from 1 to 5 (inclusive) and ask the user if that is their favourite number. If the user says yes, the algorithm will learn to choose that number more often in the future. If the user says no, the algorithm will continue to explore different numbers.\n\n```Python\nfrom itune import MultiArmedBandit, Tune\n\nMAX_VALUE = 5\nITERATIONS = 5\nitune = Tune(strategy=MultiArmedBandit())\n\nfor _ in range(ITERATIONS):\n    print(\n        f\"Your favourite number from 1 to {MAX_VALUE} (inclusive) is {itune.choose(fav_num=list(range(1,5+1)))}\"\n    )\n\n    user_input = input(\"Yes (y) / No (n)?\")\n    ######################\n    # reward function\n    itune.register_outcome(user_input == \"y\")\n    ######################\n\n```\n\n### Output\n\nSuppose your favorite number is 5. The output of the code might look like this:\n\n```\nYour favourite number from 1 to 5 (inclusive) is 3\nYes (y) / No (n)?n\nYour favourite number from 1 to 5 (inclusive) is 4\nYes (y) / No (n)?n\nYour favourite number from 1 to 5 (inclusive) is 2\nYes (y) / No (n)?n\nYour favourite number from 1 to 5 (inclusive) is 5\nYes (y) / No (n)?y\nYour favourite number from 1 to 5 (inclusive) is 5\nYes (y) / No (n)?y\n```\n\nIt's worth noting that `itune` retains its progress by loading and saving its state implicitly, enabling seamless continuation from previous sessions.\n\n```\nYour favourite number from 1 to 5 (inclusive) is 1\nYes (y) / No (n)?n\nYour favourite number from 1 to 5 (inclusive) is 5\nYes (y) / No (n)?y\nYour favourite number from 1 to 5 (inclusive) is 5\nYes (y) / No (n)?y\nYour favourite number from 1 to 5 (inclusive) is 5\nYes (y) / No (n)?y\nYour favourite number from 1 to 5 (inclusive) is 5\nYes (y) / No (n)?y\n```\n\nDuring subsequent runs, `itune` tends to favour the previously successful choice.\n\n## Example: Retrieval Augmented Generation (RAG) application\n\nThis example requires features not yet available in `itune v0.1`. It demonstrates where the library is headed.\n\n### Problem\n\nOptimizing a user-facing program with multiple parameters can be tedious, especially when the parameters are correlated.\n\n### Solution\n\nUse the `itune` library to discover the most effective combination of parameters. `itune` is a parameter optimizer for user-facing programs.\n\n### Example\n\nThe following code shows how to use `itune` to optimize the `chunk_size` and `llm` parameters of a RAG model:\n\n```Python\nfrom llama_index import ServiceContext, SimpleDirectoryReader, VectorStoreIndex\nfrom llama_index.llms import OpenAI, PaLM\n\nfrom itune import Tune, ContextualBandit\n\ndocuments = SimpleDirectoryReader(\"data\").load_data()\n\nitune = Tune(strategy=ContextualBandit())\n\n\nservice_context = ServiceContext.from_defaults(\n    #######################################################################\n    # pass in acceptable list of values to these parameters and use RLHF to\n    # optimize over combinations of them\n    chunk_size=itune.choose(chunk_size=[250, 500, 1000, 2000])\n    llm=itune.choose(llm=[PaLM(), OpenAI()])\n    #######################################################################\n)\nindex = VectorStoreIndex.from_documents(documents, service_context=service_context)\n\nquery_engine = index.as_query_engine()\nresponse = query_engine.query(\"What did the author do growing up?\")\nprint(response)\n\nuser_input = input(\"Good response?\")\n# reward function\nitune.register_outcome(user_input == \"y\")\n```\n\n### Benefits\n\nUsing `itune` can save you time and effort when writing programs with multiple parameters. It also allows you to focus on developing your end-to-end solution while `itune` figures out the best combination of parameters.\n\n## Installing\n\nInstall and update using `pip`:\n\n```\n$ pip install itune\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantisan%2Fitune","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquantisan%2Fitune","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantisan%2Fitune/lists"}