programasweights 0.2.5__tar.gz → 0.2.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (463) hide show
  1. programasweights-0.2.7/.gitignore +14 -0
  2. {programasweights-0.2.5 → programasweights-0.2.7}/AGENTS.md +51 -38
  3. {programasweights-0.2.5 → programasweights-0.2.7}/PKG-INFO +3 -3
  4. {programasweights-0.2.5 → programasweights-0.2.7}/PYPI_README.md +1 -1
  5. programasweights-0.2.7/README.md +113 -0
  6. {programasweights-0.2.5 → programasweights-0.2.7}/docs/api-reference/rest-api.md +2 -10
  7. programasweights-0.2.7/docs/case-studies/semantic-search.md +146 -0
  8. programasweights-0.2.7/docs/case-studies/site-navigation.md +127 -0
  9. {programasweights-0.2.5 → programasweights-0.2.7}/docs/index.md +1 -1
  10. programasweights-0.2.7/examples/paw_monitor.py +180 -0
  11. {programasweights-0.2.5 → programasweights-0.2.7}/mkdocs.yml +3 -0
  12. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/__init__.py +15 -17
  13. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/cache.py +21 -15
  14. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/client.py +18 -16
  15. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/config.py +4 -0
  16. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/runtime_llamacpp.py +19 -16
  17. {programasweights-0.2.5 → programasweights-0.2.7}/pyproject.toml +2 -2
  18. programasweights-0.2.5/.cursor/rules/sdk-publishing.mdc +0 -53
  19. programasweights-0.2.5/.cursor/rules/vllm-deployment.mdc +0 -118
  20. programasweights-0.2.5/.git +0 -1
  21. programasweights-0.2.5/.github/workflows/web-sdk.yml +0 -51
  22. programasweights-0.2.5/.gitignore +0 -76
  23. programasweights-0.2.5/.gitmodules +0 -3
  24. programasweights-0.2.5/.hatch_build.toml +0 -28
  25. programasweights-0.2.5/1apple.jpg +0 -0
  26. programasweights-0.2.5/1apple2.jpg +0 -0
  27. programasweights-0.2.5/2apples.jpg +0 -0
  28. programasweights-0.2.5/2apples2.jpg +0 -0
  29. programasweights-0.2.5/3apples.jpg +0 -0
  30. programasweights-0.2.5/3apples2.jpg +0 -0
  31. programasweights-0.2.5/479400.png +0 -0
  32. programasweights-0.2.5/4apples.jpg +0 -0
  33. programasweights-0.2.5/4apples2.jpg +0 -0
  34. programasweights-0.2.5/4apples3.jpg +0 -0
  35. programasweights-0.2.5/4apples4.jpg +0 -0
  36. programasweights-0.2.5/5apples.jpg +0 -0
  37. programasweights-0.2.5/6apples.jpg +0 -0
  38. programasweights-0.2.5/8apples.jpg +0 -0
  39. programasweights-0.2.5/9apples.jpg +0 -0
  40. programasweights-0.2.5/FLOW_SUMMARY.md +0 -202
  41. programasweights-0.2.5/MANIFEST.in +0 -25
  42. programasweights-0.2.5/ONNX_MIGRATION_PLAN.md +0 -84
  43. programasweights-0.2.5/PREFIX_TOKENS_DESIGN.md +0 -176
  44. programasweights-0.2.5/README.md +0 -186
  45. programasweights-0.2.5/TRUNCATION_CHANGES.md +0 -185
  46. programasweights-0.2.5/USE_CASES_AND_IDEAS.md +0 -748
  47. programasweights-0.2.5/VERIFICATION_USAGE.md +0 -282
  48. programasweights-0.2.5/analyze_dataset.py +0 -372
  49. programasweights-0.2.5/analyze_lengths.py +0 -246
  50. programasweights-0.2.5/baselines/code_prompt.md +0 -21
  51. programasweights-0.2.5/baselines/evaluate_openai_python_code_baseline.py +0 -296
  52. programasweights-0.2.5/baselines/openai_batch_request.py +0 -218
  53. programasweights-0.2.5/baselines/prepare_alchemist_data.py +0 -194
  54. programasweights-0.2.5/baselines/prepare_var_bench_data.py +0 -53
  55. programasweights-0.2.5/baselines/python_code_sandbox.py +0 -302
  56. programasweights-0.2.5/baselines/script_evaluation_var_bench.sh +0 -3
  57. programasweights-0.2.5/baselines/script_evalution_evaluation.sh +0 -8
  58. programasweights-0.2.5/baselines/script_evalution_request.sh +0 -8
  59. programasweights-0.2.5/baselines/script_evalution_statistics.sh +0 -8
  60. programasweights-0.2.5/benchmark_pytorch_vs_onnx.py +0 -315
  61. programasweights-0.2.5/benchmark_user_experience.py +0 -375
  62. programasweights-0.2.5/check_dataset.py +0 -31
  63. programasweights-0.2.5/combine_datasets.py +0 -157
  64. programasweights-0.2.5/compare_datasets.py +0 -268
  65. programasweights-0.2.5/compare_old_vs_regen.py +0 -227
  66. programasweights-0.2.5/convert_paw_to_svg.py +0 -119
  67. programasweights-0.2.5/create_favicon_sizes.py +0 -86
  68. programasweights-0.2.5/create_visualization_from_log.py +0 -269
  69. programasweights-0.2.5/create_vqa_dataset.py +0 -217
  70. programasweights-0.2.5/debug_cache.py +0 -80
  71. programasweights-0.2.5/debug_eos_example.sh +0 -22
  72. programasweights-0.2.5/estimate_data_gen_cost.py +0 -273
  73. programasweights-0.2.5/eval.py +0 -739
  74. programasweights-0.2.5/export_to_onnx.py +0 -485
  75. programasweights-0.2.5/extract_models.py +0 -193
  76. programasweights-0.2.5/inspect_data_dirs.py +0 -384
  77. programasweights-0.2.5/latest_export.csv +0 -230
  78. programasweights-0.2.5/log.train.81920.morecategories.extraprefix +0 -14928
  79. programasweights-0.2.5/main_no_spec_direct_ans_mix_continuous_sampleref_shorterprompt_vllm.py +0 -1546
  80. programasweights-0.2.5/merge_datasets.py +0 -303
  81. programasweights-0.2.5/paw.png +0 -0
  82. programasweights-0.2.5/paw.svg +0 -34
  83. programasweights-0.2.5/process_im2latex_dataset.py +0 -207
  84. programasweights-0.2.5/programasweights_lora/__init__.py +0 -28
  85. programasweights-0.2.5/programasweights_lora/compiler/__init__.py +0 -112
  86. programasweights-0.2.5/programasweights_lora/lora_format.py +0 -193
  87. programasweights-0.2.5/programasweights_lora/runtime/__init__.py +0 -6
  88. programasweights-0.2.5/programasweights_lora/runtime/interpreter_lora.py +0 -267
  89. programasweights-0.2.5/programasweights_lora/tests/test_compile_and_run.py +0 -67
  90. programasweights-0.2.5/programasweights_lora/tests/test_lora_format.py +0 -91
  91. programasweights-0.2.5/programasweights_lora/tests/test_training.py +0 -153
  92. programasweights-0.2.5/programasweights_lora/train_lora.py +0 -101
  93. programasweights-0.2.5/programasweights_lora/training/__init__.py +0 -6
  94. programasweights-0.2.5/programasweights_lora/training/loops/lora_tuning_sft.py +0 -655
  95. programasweights-0.2.5/run_eval.sh +0 -95
  96. programasweights-0.2.5/run_training.sh +0 -70
  97. programasweights-0.2.5/scripts/filter_table_by_length.py +0 -150
  98. programasweights-0.2.5/server/.env.example +0 -46
  99. programasweights-0.2.5/server/alembic/env.py +0 -48
  100. programasweights-0.2.5/server/alembic/script.py.mako +0 -24
  101. programasweights-0.2.5/server/alembic/versions/001_initial_schema.py +0 -127
  102. programasweights-0.2.5/server/alembic/versions/002_namespaced_aliases_hf_url.py +0 -37
  103. programasweights-0.2.5/server/alembic/versions/003_fulltext_search_ranking.py +0 -41
  104. programasweights-0.2.5/server/alembic/versions/004_fix_alias_slug_constraint.py +0 -49
  105. programasweights-0.2.5/server/alembic.ini +0 -36
  106. programasweights-0.2.5/server/api/__init__.py +0 -1
  107. programasweights-0.2.5/server/api/config.py +0 -75
  108. programasweights-0.2.5/server/api/dependencies.py +0 -63
  109. programasweights-0.2.5/server/api/logging_config.py +0 -74
  110. programasweights-0.2.5/server/api/main.py +0 -285
  111. programasweights-0.2.5/server/api/middleware/__init__.py +0 -0
  112. programasweights-0.2.5/server/api/middleware/rate_limit.py +0 -172
  113. programasweights-0.2.5/server/api/models/__init__.py +0 -1
  114. programasweights-0.2.5/server/api/models/database.py +0 -41
  115. programasweights-0.2.5/server/api/models/orm.py +0 -205
  116. programasweights-0.2.5/server/api/models/schemas.py +0 -225
  117. programasweights-0.2.5/server/api/routes/__init__.py +0 -1
  118. programasweights-0.2.5/server/api/routes/auth.py +0 -286
  119. programasweights-0.2.5/server/api/routes/compile.py +0 -289
  120. programasweights-0.2.5/server/api/routes/feedback.py +0 -45
  121. programasweights-0.2.5/server/api/routes/health.py +0 -31
  122. programasweights-0.2.5/server/api/routes/infer.py +0 -115
  123. programasweights-0.2.5/server/api/routes/models_info.py +0 -17
  124. programasweights-0.2.5/server/api/routes/programs.py +0 -755
  125. programasweights-0.2.5/server/api/services/__init__.py +0 -1
  126. programasweights-0.2.5/server/api/services/auto_tag_service.py +0 -103
  127. programasweights-0.2.5/server/api/services/auto_title_service.py +0 -100
  128. programasweights-0.2.5/server/api/services/compile_provider.py +0 -745
  129. programasweights-0.2.5/server/api/services/compile_service.py +0 -546
  130. programasweights-0.2.5/server/api/services/infer_service.py +0 -263
  131. programasweights-0.2.5/server/api/services/search_service.py +0 -152
  132. programasweights-0.2.5/server/api/services/storage_service.py +0 -239
  133. programasweights-0.2.5/server/benchmarks/benchmark_api.py +0 -301
  134. programasweights-0.2.5/server/benchmarks/handcrafted_specs.json +0 -130
  135. programasweights-0.2.5/server/benchmarks/last_benchmark_results.json +0 -266
  136. programasweights-0.2.5/server/benchmarks/last_stress_results.json +0 -250
  137. programasweights-0.2.5/server/benchmarks/stress_test.py +0 -695
  138. programasweights-0.2.5/server/compiler_registry.json +0 -26
  139. programasweights-0.2.5/server/provider_configs/gpt2.json +0 -17
  140. programasweights-0.2.5/server/provider_configs/qwen3-0.6b.json +0 -16
  141. programasweights-0.2.5/server/requirements.txt +0 -25
  142. programasweights-0.2.5/server/scripts/ab_test_hf_vs_vllm.py +0 -180
  143. programasweights-0.2.5/server/scripts/ablation_search.py +0 -221
  144. programasweights-0.2.5/server/scripts/backfill_hf_browser_assets.py +0 -226
  145. programasweights-0.2.5/server/scripts/backfill_hf_safetensors.py +0 -95
  146. programasweights-0.2.5/server/scripts/backfill_interestingness.py +0 -111
  147. programasweights-0.2.5/server/scripts/backfill_tags.py +0 -76
  148. programasweights-0.2.5/server/scripts/backfill_titles.py +0 -76
  149. programasweights-0.2.5/server/scripts/benchmark_gpt2.py +0 -89
  150. programasweights-0.2.5/server/scripts/cleanup_storage.py +0 -66
  151. programasweights-0.2.5/server/scripts/eval_search.py +0 -211
  152. programasweights-0.2.5/server/scripts/evict_cold_programs.py +0 -40
  153. programasweights-0.2.5/server/scripts/generate_prefix_cache.py +0 -117
  154. programasweights-0.2.5/server/scripts/launch_gpt2_compiler.py +0 -32
  155. programasweights-0.2.5/server/scripts/launch_qwen3_compiler.py +0 -32
  156. programasweights-0.2.5/server/scripts/patch_vllm.sh +0 -65
  157. programasweights-0.2.5/server/scripts/restart.sh +0 -23
  158. programasweights-0.2.5/server/scripts/start_all.sh +0 -193
  159. programasweights-0.2.5/server/scripts/start_gpt2_services.sh +0 -67
  160. programasweights-0.2.5/server/scripts/start_provider.sh +0 -27
  161. programasweights-0.2.5/server/scripts/start_services.sh +0 -86
  162. programasweights-0.2.5/server/tests/__init__.py +0 -1
  163. programasweights-0.2.5/server/tests/conftest.py +0 -86
  164. programasweights-0.2.5/server/tests/test_auth.py +0 -52
  165. programasweights-0.2.5/server/tests/test_compile.py +0 -97
  166. programasweights-0.2.5/server/tests/test_errors.py +0 -60
  167. programasweights-0.2.5/server/tests/test_infer.py +0 -72
  168. programasweights-0.2.5/server/tests/test_integration_gpu.py +0 -183
  169. programasweights-0.2.5/server/tests/test_rate_limit.py +0 -213
  170. programasweights-0.2.5/server/tests/test_storage.py +0 -134
  171. programasweights-0.2.5/server/vllm_models/__init__.py +0 -1
  172. programasweights-0.2.5/server/vllm_models/gpt2_lora_patch.py +0 -34
  173. programasweights-0.2.5/server/vllm_models/paw_compiler.py +0 -414
  174. programasweights-0.2.5/server/vllm_models/prepare_checkpoint.py +0 -143
  175. programasweights-0.2.5/server/vllm_models/register.py +0 -17
  176. programasweights-0.2.5/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.rollout_ppl.png +0 -0
  177. programasweights-0.2.5/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.train_gt_logprob.em_es.png +0 -0
  178. programasweights-0.2.5/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.train_gt_logprob.ppl.png +0 -0
  179. programasweights-0.2.5/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.train_gt_logprob.reward.png +0 -0
  180. programasweights-0.2.5/test_1spec.py +0 -18
  181. programasweights-0.2.5/test_all_caching.py +0 -167
  182. programasweights-0.2.5/test_apple_count.py +0 -84
  183. programasweights-0.2.5/test_batch_pilot.py +0 -593
  184. programasweights-0.2.5/test_compile.py +0 -10
  185. programasweights-0.2.5/test_e2e.py +0 -363
  186. programasweights-0.2.5/test_execute.py +0 -6
  187. programasweights-0.2.5/test_nspecs.py +0 -18
  188. programasweights-0.2.5/test_one_vs_two_step.py +0 -149
  189. programasweights-0.2.5/test_onnx_correctness.py +0 -430
  190. programasweights-0.2.5/test_onnx_hf_model.py +0 -39
  191. programasweights-0.2.5/test_onnx_hf_with_images.py +0 -158
  192. programasweights-0.2.5/test_paw_format.py +0 -144
  193. programasweights-0.2.5/test_thinking_comparison.py +0 -542
  194. programasweights-0.2.5/train.py +0 -153
  195. programasweights-0.2.5/train_no_spec_direct_ans_mix_continuous_sampleref_trainonly_shorterprompt_withregularizer_generate_lora.py +0 -3581
  196. programasweights-0.2.5/training/README.md +0 -45
  197. programasweights-0.2.5/training/__init__.py +0 -42
  198. programasweights-0.2.5/training/data_generation/DATASET_CHANGELOG.md +0 -1791
  199. programasweights-0.2.5/training/data_generation/README.md +0 -74
  200. programasweights-0.2.5/training/data_generation/VERIFICATION_PIPELINE.md +0 -259
  201. programasweights-0.2.5/training/data_generation/build_user_bench.py +0 -487
  202. programasweights-0.2.5/training/data_generation/dry_run_batch.py +0 -248
  203. programasweights-0.2.5/training/data_generation/filter_test_data.py +0 -397
  204. programasweights-0.2.5/training/data_generation/generate_specs.py +0 -716
  205. programasweights-0.2.5/training/data_generation/generate_specs_batch.py +0 -368
  206. programasweights-0.2.5/training/data_generation/incremental_merge.py +0 -397
  207. programasweights-0.2.5/training/data_generation/merge_and_upload.py +0 -383
  208. programasweights-0.2.5/training/data_generation/regenerate_outputs_batch.py +0 -522
  209. programasweights-0.2.5/training/data_generation/synthesize_data.py +0 -536
  210. programasweights-0.2.5/training/data_generation/synthesize_data_batch.py +0 -389
  211. programasweights-0.2.5/training/data_generation/templates/filter_system.txt +0 -10
  212. programasweights-0.2.5/training/data_generation/templates/filter_user.txt +0 -9
  213. programasweights-0.2.5/training/data_generation/templates/pairs_system.txt +0 -3
  214. programasweights-0.2.5/training/data_generation/templates/pairs_user.txt +0 -14
  215. programasweights-0.2.5/training/data_generation/templates/specs_system.txt +0 -1
  216. programasweights-0.2.5/training/data_generation/templates/specs_user.txt +0 -11
  217. programasweights-0.2.5/training/data_generation/templates/specs_user_freeform.txt +0 -8
  218. programasweights-0.2.5/training/data_generation/templates/specs_user_freeform_with_examples.txt +0 -8
  219. programasweights-0.2.5/training/data_generation/templates/specs_user_with_examples.txt +0 -11
  220. programasweights-0.2.5/training/data_generation/templates/verify_system.txt +0 -10
  221. programasweights-0.2.5/training/data_generation/templates/verify_user.txt +0 -3
  222. programasweights-0.2.5/training/data_generation/templates_old/filter_system.txt +0 -10
  223. programasweights-0.2.5/training/data_generation/templates_old/filter_user.txt +0 -9
  224. programasweights-0.2.5/training/data_generation/templates_old/pairs_system.txt +0 -3
  225. programasweights-0.2.5/training/data_generation/templates_old/pairs_user.txt +0 -10
  226. programasweights-0.2.5/training/data_generation/templates_old/specs_system.txt +0 -1
  227. programasweights-0.2.5/training/data_generation/templates_old/specs_user.txt +0 -9
  228. programasweights-0.2.5/training/data_generation/templates_old/specs_user_freeform.txt +0 -8
  229. programasweights-0.2.5/training/data_generation/templates_old/specs_user_freeform_with_examples.txt +0 -8
  230. programasweights-0.2.5/training/data_generation/templates_old/specs_user_with_examples.txt +0 -10
  231. programasweights-0.2.5/training/data_generation/templates_old/verify_system.txt +0 -10
  232. programasweights-0.2.5/training/data_generation/templates_old/verify_user.txt +0 -3
  233. programasweights-0.2.5/training/data_generation/verify_test_data.py +0 -377
  234. programasweights-0.2.5/training/datasets/__init__.py +0 -1
  235. programasweights-0.2.5/training/datasets/jsonl_text_pairs.py +0 -186
  236. programasweights-0.2.5/training/loops/__init__.py +0 -1
  237. programasweights-0.2.5/training/loops/prefix_tuning_sft.py +0 -1297
  238. programasweights-0.2.5/ttt.py +0 -11
  239. programasweights-0.2.5/upload_model.py +0 -95
  240. programasweights-0.2.5/upload_onnx_to_huggingface.py +0 -242
  241. programasweights-0.2.5/upload_onnx_to_huggingface_with_token.py +0 -264
  242. programasweights-0.2.5/utils.py +0 -100
  243. programasweights-0.2.5/web-app/HANDOFF.md +0 -237
  244. programasweights-0.2.5/web-app/README.md +0 -187
  245. programasweights-0.2.5/web-app/frontend/README.md +0 -73
  246. programasweights-0.2.5/web-app/frontend/e2e/full.spec.ts +0 -861
  247. programasweights-0.2.5/web-app/frontend/e2e/helpers.ts +0 -14
  248. programasweights-0.2.5/web-app/frontend/e2e/smoke.spec.ts +0 -117
  249. programasweights-0.2.5/web-app/frontend/eslint.config.js +0 -23
  250. programasweights-0.2.5/web-app/frontend/index.html +0 -39
  251. programasweights-0.2.5/web-app/frontend/package-lock.json +0 -5245
  252. programasweights-0.2.5/web-app/frontend/package.json +0 -43
  253. programasweights-0.2.5/web-app/frontend/playwright.config.ts +0 -17
  254. programasweights-0.2.5/web-app/frontend/postcss.config.js +0 -6
  255. programasweights-0.2.5/web-app/frontend/public/apple-touch-icon.png +0 -0
  256. programasweights-0.2.5/web-app/frontend/public/browser-worker.html +0 -142
  257. programasweights-0.2.5/web-app/frontend/public/favicon-16x16.png +0 -0
  258. programasweights-0.2.5/web-app/frontend/public/favicon-32x32.png +0 -0
  259. programasweights-0.2.5/web-app/frontend/public/paw-192.png +0 -0
  260. programasweights-0.2.5/web-app/frontend/public/paw-512.png +0 -0
  261. programasweights-0.2.5/web-app/frontend/public/paw.svg +0 -34
  262. programasweights-0.2.5/web-app/frontend/public/react-test.html +0 -112
  263. programasweights-0.2.5/web-app/frontend/public/test.html +0 -40
  264. programasweights-0.2.5/web-app/frontend/public/vite.svg +0 -1
  265. programasweights-0.2.5/web-app/frontend/scripts/deploy.sh +0 -43
  266. programasweights-0.2.5/web-app/frontend/src/App.css +0 -42
  267. programasweights-0.2.5/web-app/frontend/src/App.tsx +0 -124
  268. programasweights-0.2.5/web-app/frontend/src/assets/react.svg +0 -1
  269. programasweights-0.2.5/web-app/frontend/src/components/AboutPage.tsx +0 -210
  270. programasweights-0.2.5/web-app/frontend/src/components/AgentsPage.tsx +0 -92
  271. programasweights-0.2.5/web-app/frontend/src/components/AuthorPage.tsx +0 -135
  272. programasweights-0.2.5/web-app/frontend/src/components/BrowserPage.tsx +0 -633
  273. programasweights-0.2.5/web-app/frontend/src/components/CasesSection.tsx +0 -195
  274. programasweights-0.2.5/web-app/frontend/src/components/DocsPage.tsx +0 -496
  275. programasweights-0.2.5/web-app/frontend/src/components/Footer.tsx +0 -104
  276. programasweights-0.2.5/web-app/frontend/src/components/Header.tsx +0 -188
  277. programasweights-0.2.5/web-app/frontend/src/components/HubPage.tsx +0 -351
  278. programasweights-0.2.5/web-app/frontend/src/components/HubProgramPage.tsx +0 -428
  279. programasweights-0.2.5/web-app/frontend/src/components/HubUploadPage.tsx +0 -21
  280. programasweights-0.2.5/web-app/frontend/src/components/LandingPage.tsx +0 -546
  281. programasweights-0.2.5/web-app/frontend/src/components/MainInterface.tsx +0 -664
  282. programasweights-0.2.5/web-app/frontend/src/components/NavigationHelper.tsx +0 -339
  283. programasweights-0.2.5/web-app/frontend/src/components/PrivacyPage.tsx +0 -101
  284. programasweights-0.2.5/web-app/frontend/src/components/ProfilePage.tsx +0 -283
  285. programasweights-0.2.5/web-app/frontend/src/components/SettingsPage.tsx +0 -215
  286. programasweights-0.2.5/web-app/frontend/src/components/SpecSuggestions.tsx +0 -49
  287. programasweights-0.2.5/web-app/frontend/src/components/TermsPage.tsx +0 -101
  288. programasweights-0.2.5/web-app/frontend/src/contexts/AuthContext.tsx +0 -45
  289. programasweights-0.2.5/web-app/frontend/src/index.css +0 -48
  290. programasweights-0.2.5/web-app/frontend/src/main.tsx +0 -13
  291. programasweights-0.2.5/web-app/frontend/src/types/index.ts +0 -206
  292. programasweights-0.2.5/web-app/frontend/src/utils/api.ts +0 -217
  293. programasweights-0.2.5/web-app/frontend/tailwind.config.js +0 -67
  294. programasweights-0.2.5/web-app/frontend/test-results/.last-run.json +0 -4
  295. programasweights-0.2.5/web-app/frontend/tsconfig.app.json +0 -28
  296. programasweights-0.2.5/web-app/frontend/tsconfig.json +0 -7
  297. programasweights-0.2.5/web-app/frontend/tsconfig.node.json +0 -26
  298. programasweights-0.2.5/web-app/frontend/vite.config.ts +0 -17
  299. programasweights-0.2.5/web-app/nginx-paw.conf +0 -56
  300. programasweights-0.2.5/web-app/nginx.conf +0 -111
  301. programasweights-0.2.5/web-app/setup_mysql.sh +0 -145
  302. programasweights-0.2.5/web-app/start.sh +0 -102
  303. programasweights-0.2.5/web-app/test_setup.py +0 -160
  304. programasweights-0.2.5/web-app/ttt.py +0 -26
  305. programasweights-0.2.5/web-sdk/.gitignore +0 -3
  306. programasweights-0.2.5/web-sdk/LICENSE +0 -21
  307. programasweights-0.2.5/web-sdk/README.md +0 -117
  308. programasweights-0.2.5/web-sdk/__tests__/e2e/browser.spec.ts +0 -223
  309. programasweights-0.2.5/web-sdk/__tests__/e2e/server.ts +0 -69
  310. programasweights-0.2.5/web-sdk/__tests__/e2e/start-server.ts +0 -2
  311. programasweights-0.2.5/web-sdk/__tests__/e2e/test-page.html +0 -122
  312. programasweights-0.2.5/web-sdk/__tests__/loader.test.ts +0 -244
  313. programasweights-0.2.5/web-sdk/__tests__/prompt.test.ts +0 -45
  314. programasweights-0.2.5/web-sdk/examples/basic.html +0 -121
  315. programasweights-0.2.5/web-sdk/package-lock.json +0 -3093
  316. programasweights-0.2.5/web-sdk/package.json +0 -58
  317. programasweights-0.2.5/web-sdk/playwright.config.ts +0 -19
  318. programasweights-0.2.5/web-sdk/serve.py +0 -12
  319. programasweights-0.2.5/web-sdk/src/index.ts +0 -55
  320. programasweights-0.2.5/web-sdk/src/loader.ts +0 -96
  321. programasweights-0.2.5/web-sdk/src/runtime.ts +0 -146
  322. programasweights-0.2.5/web-sdk/src/types.ts +0 -35
  323. programasweights-0.2.5/web-sdk/test-standalone.html +0 -188
  324. programasweights-0.2.5/web-sdk/tsconfig.json +0 -22
  325. programasweights-0.2.5/web-sdk/vitest.config.ts +0 -12
  326. programasweights-0.2.5/web-sdk/wllama/.git +0 -1
  327. programasweights-0.2.5/web-sdk/wllama/.github/workflows/build-hf-space.yml +0 -41
  328. programasweights-0.2.5/web-sdk/wllama/.github/workflows/ci.yml +0 -80
  329. programasweights-0.2.5/web-sdk/wllama/.github/workflows/generate-docs.yml +0 -63
  330. programasweights-0.2.5/web-sdk/wllama/.github/workflows/verify-generated-code.yml +0 -37
  331. programasweights-0.2.5/web-sdk/wllama/.gitignore +0 -16
  332. programasweights-0.2.5/web-sdk/wllama/.gitmodules +0 -3
  333. programasweights-0.2.5/web-sdk/wllama/.npmignore +0 -9
  334. programasweights-0.2.5/web-sdk/wllama/.prettierignore +0 -35
  335. programasweights-0.2.5/web-sdk/wllama/CMakeLists.txt +0 -23
  336. programasweights-0.2.5/web-sdk/wllama/LICENCE +0 -21
  337. programasweights-0.2.5/web-sdk/wllama/README.md +0 -210
  338. programasweights-0.2.5/web-sdk/wllama/README_banner.png +0 -0
  339. programasweights-0.2.5/web-sdk/wllama/assets/screenshot_0.png +0 -0
  340. programasweights-0.2.5/web-sdk/wllama/cpp/actions.hpp +0 -949
  341. programasweights-0.2.5/web-sdk/wllama/cpp/generate_glue_prototype.js +0 -115
  342. programasweights-0.2.5/web-sdk/wllama/cpp/glue.hpp +0 -874
  343. programasweights-0.2.5/web-sdk/wllama/cpp/helpers/wcommon.cpp +0 -580
  344. programasweights-0.2.5/web-sdk/wllama/cpp/helpers/wcommon.h +0 -561
  345. programasweights-0.2.5/web-sdk/wllama/cpp/helpers/wlog.cpp +0 -392
  346. programasweights-0.2.5/web-sdk/wllama/cpp/helpers/wlog.h +0 -102
  347. programasweights-0.2.5/web-sdk/wllama/cpp/helpers/wsampling.cpp +0 -526
  348. programasweights-0.2.5/web-sdk/wllama/cpp/helpers/wsampling.h +0 -107
  349. programasweights-0.2.5/web-sdk/wllama/cpp/test_glue.cpp +0 -80
  350. programasweights-0.2.5/web-sdk/wllama/cpp/wllama.cpp +0 -194
  351. programasweights-0.2.5/web-sdk/wllama/examples/basic/index.html +0 -176
  352. programasweights-0.2.5/web-sdk/wllama/examples/embeddings/index.html +0 -107
  353. programasweights-0.2.5/web-sdk/wllama/examples/main/.eslintrc.cjs +0 -18
  354. programasweights-0.2.5/web-sdk/wllama/examples/main/.gitignore +0 -24
  355. programasweights-0.2.5/web-sdk/wllama/examples/main/README.md +0 -6
  356. programasweights-0.2.5/web-sdk/wllama/examples/main/index.html +0 -13
  357. programasweights-0.2.5/web-sdk/wllama/examples/main/package-lock.json +0 -5800
  358. programasweights-0.2.5/web-sdk/wllama/examples/main/package.json +0 -40
  359. programasweights-0.2.5/web-sdk/wllama/examples/main/postcss.config.js +0 -6
  360. programasweights-0.2.5/web-sdk/wllama/examples/main/public/favicon.ico +0 -0
  361. programasweights-0.2.5/web-sdk/wllama/examples/main/public/wllama.png +0 -0
  362. programasweights-0.2.5/web-sdk/wllama/examples/main/src/App.tsx +0 -40
  363. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/ChatScreen.tsx +0 -196
  364. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/GuideScreen.tsx +0 -91
  365. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/LogScreen.tsx +0 -26
  366. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/MarkdownMessage.tsx +0 -58
  367. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/ModelScreen.tsx +0 -444
  368. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/Navbar.tsx +0 -27
  369. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/ScreenWrapper.tsx +0 -17
  370. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/Sidebar.tsx +0 -119
  371. programasweights-0.2.5/web-sdk/wllama/examples/main/src/config.ts +0 -96
  372. programasweights-0.2.5/web-sdk/wllama/examples/main/src/index.css +0 -56
  373. programasweights-0.2.5/web-sdk/wllama/examples/main/src/main.tsx +0 -11
  374. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/benchmark.ts +0 -116
  375. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/custom-models.tsx +0 -97
  376. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/displayed-model.tsx +0 -90
  377. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/messages.context.tsx +0 -120
  378. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/nl2br.tsx +0 -10
  379. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/types.ts +0 -38
  380. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/use-interval-when.ts +0 -48
  381. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/utils.ts +0 -133
  382. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/wllama.context.tsx +0 -293
  383. programasweights-0.2.5/web-sdk/wllama/examples/main/src/vite-env.d.ts +0 -1
  384. programasweights-0.2.5/web-sdk/wllama/examples/main/tailwind.config.cjs +0 -8
  385. programasweights-0.2.5/web-sdk/wllama/examples/main/tsconfig.app.json +0 -27
  386. programasweights-0.2.5/web-sdk/wllama/examples/main/tsconfig.json +0 -11
  387. programasweights-0.2.5/web-sdk/wllama/examples/main/tsconfig.node.json +0 -13
  388. programasweights-0.2.5/web-sdk/wllama/examples/main/vite.config.ts +0 -20
  389. programasweights-0.2.5/web-sdk/wllama/guides/intro-v2.md +0 -132
  390. programasweights-0.2.5/web-sdk/wllama/index.ts +0 -1
  391. programasweights-0.2.5/web-sdk/wllama/package-lock.json +0 -7396
  392. programasweights-0.2.5/web-sdk/wllama/package.json +0 -68
  393. programasweights-0.2.5/web-sdk/wllama/scripts/build_hf_space.sh +0 -26
  394. programasweights-0.2.5/web-sdk/wllama/scripts/build_wasm.sh +0 -19
  395. programasweights-0.2.5/web-sdk/wllama/scripts/build_worker.sh +0 -39
  396. programasweights-0.2.5/web-sdk/wllama/scripts/docker-compose.yml +0 -53
  397. programasweights-0.2.5/web-sdk/wllama/scripts/generate_wasm_from_cdn.js +0 -20
  398. programasweights-0.2.5/web-sdk/wllama/scripts/http_server.js +0 -33
  399. programasweights-0.2.5/web-sdk/wllama/scripts/post_build.sh +0 -26
  400. programasweights-0.2.5/web-sdk/wllama/src/cache-manager.ts +0 -392
  401. programasweights-0.2.5/web-sdk/wllama/src/glue/glue.ts +0 -291
  402. programasweights-0.2.5/web-sdk/wllama/src/glue/messages.ts +0 -1346
  403. programasweights-0.2.5/web-sdk/wllama/src/index.ts +0 -4
  404. programasweights-0.2.5/web-sdk/wllama/src/mjs.test.ts +0 -48
  405. programasweights-0.2.5/web-sdk/wllama/src/model-manager.test.ts +0 -200
  406. programasweights-0.2.5/web-sdk/wllama/src/model-manager.ts +0 -324
  407. programasweights-0.2.5/web-sdk/wllama/src/multi-thread/wllama.js +0 -1
  408. programasweights-0.2.5/web-sdk/wllama/src/multi-thread/wllama.wasm +0 -0
  409. programasweights-0.2.5/web-sdk/wllama/src/single-thread/wllama.js +0 -1
  410. programasweights-0.2.5/web-sdk/wllama/src/single-thread/wllama.wasm +0 -0
  411. programasweights-0.2.5/web-sdk/wllama/src/utils.test.ts +0 -231
  412. programasweights-0.2.5/web-sdk/wllama/src/utils.ts +0 -271
  413. programasweights-0.2.5/web-sdk/wllama/src/wasm-from-cdn.ts +0 -9
  414. programasweights-0.2.5/web-sdk/wllama/src/wllama.test.ts +0 -402
  415. programasweights-0.2.5/web-sdk/wllama/src/wllama.ts +0 -1396
  416. programasweights-0.2.5/web-sdk/wllama/src/worker.ts +0 -298
  417. programasweights-0.2.5/web-sdk/wllama/src/workers-code/generated.ts +0 -13
  418. programasweights-0.2.5/web-sdk/wllama/src/workers-code/llama-cpp.js +0 -383
  419. programasweights-0.2.5/web-sdk/wllama/src/workers-code/opfs-utils.js +0 -141
  420. programasweights-0.2.5/web-sdk/wllama/tsconfig.build.json +0 -34
  421. programasweights-0.2.5/web-sdk/wllama/tsup.config.ts +0 -23
  422. programasweights-0.2.5/web-sdk/wllama/vitest.config.ts +0 -44
  423. {programasweights-0.2.5 → programasweights-0.2.7}/.readthedocs.yaml +0 -0
  424. {programasweights-0.2.5 → programasweights-0.2.7}/CHANGELOG.md +0 -0
  425. {programasweights-0.2.5 → programasweights-0.2.7}/LICENSE +0 -0
  426. {programasweights-0.2.5 → programasweights-0.2.7}/docs/adr/001-llama-cpp-over-pytorch.md +0 -0
  427. {programasweights-0.2.5 → programasweights-0.2.7}/docs/adr/002-q4_0-adapter-format.md +0 -0
  428. {programasweights-0.2.5 → programasweights-0.2.7}/docs/adr/003-single-spec-field.md +0 -0
  429. {programasweights-0.2.5 → programasweights-0.2.7}/docs/adr/004-compiler-naming.md +0 -0
  430. {programasweights-0.2.5 → programasweights-0.2.7}/docs/adr/005-vllm-hidden-states.md +0 -0
  431. {programasweights-0.2.5 → programasweights-0.2.7}/docs/adr/006-email-api-key-auth.md +0 -0
  432. {programasweights-0.2.5 → programasweights-0.2.7}/docs/advanced/adrs.md +0 -0
  433. {programasweights-0.2.5 → programasweights-0.2.7}/docs/advanced/architecture.md +0 -0
  434. {programasweights-0.2.5 → programasweights-0.2.7}/docs/api-reference/cli.md +0 -0
  435. {programasweights-0.2.5 → programasweights-0.2.7}/docs/api-reference/python-sdk.md +0 -0
  436. {programasweights-0.2.5 → programasweights-0.2.7}/docs/architecture.md +0 -0
  437. {programasweights-0.2.5 → programasweights-0.2.7}/docs/getting-started/first-program.md +0 -0
  438. {programasweights-0.2.5 → programasweights-0.2.7}/docs/getting-started/installation.md +0 -0
  439. {programasweights-0.2.5 → programasweights-0.2.7}/docs/getting-started/naming-programs.md +0 -0
  440. {programasweights-0.2.5 → programasweights-0.2.7}/docs/guide/browser-inference.md +0 -0
  441. {programasweights-0.2.5 → programasweights-0.2.7}/docs/guide/how-it-works.md +0 -0
  442. {programasweights-0.2.5 → programasweights-0.2.7}/docs/guide/local-inference.md +0 -0
  443. {programasweights-0.2.5 → programasweights-0.2.7}/docs/guide/writing-good-specs.md +0 -0
  444. {programasweights-0.2.5 → programasweights-0.2.7}/docs/hub/browsing-programs.md +0 -0
  445. {programasweights-0.2.5 → programasweights-0.2.7}/docs/hub/feedback-cases.md +0 -0
  446. {programasweights-0.2.5 → programasweights-0.2.7}/docs/hub/publishing-programs.md +0 -0
  447. {programasweights-0.2.5 → programasweights-0.2.7}/docs/requirements.txt +0 -0
  448. {programasweights-0.2.5 → programasweights-0.2.7}/examples/flask_app.py +0 -0
  449. {programasweights-0.2.5 → programasweights-0.2.7}/examples/jupyter_notebook.py +0 -0
  450. {programasweights-0.2.5 → programasweights-0.2.7}/examples/langchain_integration.py +0 -0
  451. {programasweights-0.2.5 → programasweights-0.2.7}/examples/replace_openai.py +0 -0
  452. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/artifacts.py +0 -0
  453. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/cli.py +0 -0
  454. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/compiler/__init__.py +0 -0
  455. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/compiler/dummy.py +0 -0
  456. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/convert_peft_to_paw.py +0 -0
  457. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/paw_format.py +0 -0
  458. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/runtime/__init__.py +0 -0
  459. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/runtime/interpreter.py +0 -0
  460. {programasweights-0.2.5 → programasweights-0.2.7}/programasweights/runtime/interpreter_onnx.py +0 -0
  461. {programasweights-0.2.5 → programasweights-0.2.7}/tests/test_offline_cache.py +0 -0
  462. {programasweights-0.2.5 → programasweights-0.2.7}/tests/test_sdk.py +0 -0
  463. {programasweights-0.2.5 → programasweights-0.2.7}/tests/test_sdk.sh +0 -0
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .eggs/
7
+ *.egg
8
+ .venv/
9
+ venv/
10
+ .env
11
+ .mypy_cache/
12
+ .pytest_cache/
13
+ .ruff_cache/
14
+ *.so
@@ -3,7 +3,7 @@
3
3
  PAW compiles natural language specifications into tiny neural functions that run locally. Each function takes a single text input and returns a single text output. Use it when you need fuzzy text processing — classification, extraction, format repair, search, triage — that regex can't handle but a full LLM is overkill for.
4
4
 
5
5
  Website: https://programasweights.com
6
- Docs: https://programasweights.readthedocs.io
6
+ Full documentation: https://programasweights.readthedocs.io
7
7
 
8
8
  ## Install
9
9
 
@@ -20,7 +20,7 @@ import programasweights as paw
20
20
  # "email-triage" is an official pre-compiled program (slug)
21
21
  fn = paw.function("email-triage")
22
22
  fn("Urgent: server is down!") # "immediate"
23
- fn("Newsletter: spring picnic") # "wait"
23
+ fn("Newsletter: spring picnic") # "can wait"
24
24
 
25
25
  # Compile your own from a description
26
26
  program = paw.compile(
@@ -37,16 +37,8 @@ fn("I love this!") # "positive"
37
37
 
38
38
  ## Two Compilers
39
39
 
40
- | | Standard (Qwen3 0.6B) | Compact (GPT-2 124M) |
41
- |---|---|---|
42
- | Compiler name | `paw-4b-qwen3-0.6b` | `paw-4b-gpt2` |
43
- | Accuracy | Higher | Lower |
44
- | Base model size | 594 MB | 105 MB |
45
- | Program size | ~22 MB | ~5 MB |
46
- | Inference speed | ~90ms (server) | ~50ms (server) |
47
- | Runs in browser | No | Yes (must use this compiler) |
48
-
49
- Default is Standard. Use Compact for smaller files or browser deployment.
40
+ - **Standard** (`paw-4b-qwen3-0.6b`) higher accuracy, 594 MB base + ~22 MB/program. Default.
41
+ - **Compact** (`paw-4b-gpt2`) — smaller (105 MB base + ~5 MB/program), runs in browser via WebAssembly.
50
42
 
51
43
  ## When to Use PAW
52
44
 
@@ -60,7 +52,9 @@ Default is Standard. Use Compact for smaller files or browser deployment.
60
52
 
61
53
  ## Writing Good Specs
62
54
 
63
- Description + examples. Use `Input: ... Output: ...` format.
55
+ **The #1 practice: iterate with test cases.** Do not accept low performance on the first try. Build a test suite of input/output pairs, measure accuracy, then iteratively adjust wording and formatting until performance is good enough. Treat spec writing like software engineering: test, debug specific failures, fix the wording, retest.
56
+
57
+ A good spec has a description plus `Input: ... Output: ...` examples.
64
58
 
65
59
  ```python
66
60
  fn = paw.compile_and_load("""
@@ -77,9 +71,12 @@ Output: delete
77
71
  """)
78
72
  ```
79
73
 
80
- - State output constraints explicitly if any: "Return ONLY one of: X, Y, Z"
81
- - Each function is stateless: one input, one output. No conversation history.
82
- - Write a few test inputs with expected outputs, then try different spec phrasings and pick the one that passes the most.
74
+ **Spec-tuning tips:**
75
+
76
+ - Each function is stateless: one text input, one text output. No conversation history.
77
+ - **State output constraints explicitly**: "Return ONLY one of: X, Y, Z". Without this the model may produce free-form text.
78
+ - **Include examples from your actual data**: Examples outperform prose-only descriptions.
79
+ - **Debug failures before sweeping**: Look at specific failing examples and understand WHY before trying many variants.
83
80
 
84
81
  ## Chaining Functions
85
82
 
@@ -94,7 +91,39 @@ if label != "other":
94
91
  fix = fixer(f"{label}: {code_snippet}")
95
92
  ```
96
93
 
97
- Each function is independent -- chain them with regular Python logic.
94
+ Chain them with regular Python logic.
95
+
96
+ ## Case Studies
97
+
98
+ Production examples with iterative spec-tuning walkthroughs: [site navigation](https://programasweights.readthedocs.io/en/latest/case-studies/site-navigation/) (5-program pipeline, Cmd+K helper) and [semantic search](https://programasweights.readthedocs.io/en/latest/case-studies/semantic-search/) (reranking without a vector database).
99
+
100
+ ## Event-Driven Monitoring
101
+
102
+ PAW functions can classify log output. Compile once with examples from your specific logs, then reuse the function locally forever:
103
+
104
+ ```python
105
+ program = paw.compile("""
106
+ Classify log lines. Return ONLY one word: ALERT or QUIET.
107
+
108
+ Input: [step 100] loss=0.05 lr=0.0001
109
+ Output: QUIET
110
+
111
+ Input: [Checkpoint] Saved model at step 1000
112
+ Output: ALERT
113
+
114
+ Input: Traceback (most recent call last):
115
+ Output: ALERT
116
+
117
+ Input: Training complete. Final loss: 0.11
118
+ Output: ALERT
119
+ """)
120
+
121
+ fn = paw.function(program.id) # reuse with saved program.id
122
+ fn("[step 200] loss=0.04") # "QUIET"
123
+ fn("[Checkpoint] Saved model") # "ALERT"
124
+ ```
125
+
126
+ Full tool with file watching, truncation, and stall detection: [examples/paw_monitor.py](https://github.com/programasweights/programasweights-python/blob/main/examples/paw_monitor.py)
98
127
 
99
128
  ## Browser / JavaScript SDK
100
129
 
@@ -129,19 +158,7 @@ Generate API keys at https://programasweights.com/settings.
129
158
 
130
159
  ## CLI
131
160
 
132
- ```bash
133
- paw compile --spec "Classify sentiment" --json
134
- paw run --program <program_id> --input "I love this!" --json
135
- paw info <program_id> # show program metadata
136
- paw rename <program_id> my-slug # name a program (requires auth)
137
- paw login # save API key
138
- ```
139
-
140
- `--json` gives structured output. Example:
141
-
142
- ```json
143
- {"program_id": "a6b454023d41ac9ca845", "slug": null, "status": "ready", "error": null, "timings": {"total_ms": 2800}}
144
- ```
161
+ Commands: `paw compile --spec "..." --json`, `paw run --program <id> --input "..."`, `paw info <id>`, `paw rename <id> <slug>`, `paw login`. All support `--json` for structured output.
145
162
 
146
163
  ## Full API Reference
147
164
 
@@ -177,17 +194,13 @@ paw.login()
177
194
 
178
195
  ## Performance
179
196
 
180
- - **First call** ~500ms (loads base model). Subsequent calls ~50-90ms.
181
- - **Base model shared** across functions. Each LoRA adapter adds ~22 MB.
182
- - **Thread-safe** and **blocking**.
197
+ - **First call** ~5-15s (loads base model). Subsequent calls 0.5-5s depending on input length.
198
+ - **Base model shared** across functions on disk. Each LoRA adapter adds ~22 MB.
183
199
  - **Cache**: `~/.cache/programasweights/`. Override with `PAW_CACHE_DIR`.
184
200
  - **Offline** after first download.
185
201
 
186
202
  ## Limits
187
203
 
188
- - Spec + input + output share a ~2048 token context window, and inputs that exceed the context window will error out (not silently truncated).
189
- - Setting `max_tokens` high is safe -- generation stops at EOS or when the window is full.
190
-
191
- ## Browse Programs
204
+ - Spec + input + output share a ~2048 token context window. Inputs that exceed it will error.
205
+ - `max_tokens` defaults to `None`: generation runs until EOS or the context limit.
192
206
 
193
- https://programasweights.com/hub
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: programasweights
3
- Version: 0.2.5
3
+ Version: 0.2.7
4
4
  Summary: Compile natural language specifications into neural programs that run locally via llama.cpp.
5
5
  Project-URL: Homepage, https://programasweights.com
6
6
  Project-URL: Repository, https://github.com/programasweights/programasweights-python
@@ -23,7 +23,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
24
  Requires-Python: >=3.9
25
25
  Requires-Dist: httpx<1.0,>=0.27.0
26
- Requires-Dist: llama-cpp-python<=0.3.18,>=0.3.0
26
+ Requires-Dist: llama-cpp-python<=0.3.19,>=0.3.0
27
27
  Provides-Extra: test
28
28
  Requires-Dist: pytest; extra == 'test'
29
29
  Description-Content-Type: text/markdown
@@ -48,7 +48,7 @@ import programasweights as paw
48
48
  # Use a pre-compiled function (downloads once, runs locally forever)
49
49
  fn = paw.function("email-triage")
50
50
  fn("Urgent: the server is down!") # "immediate"
51
- fn("Newsletter: spring picnic") # "wait"
51
+ fn("Newsletter: spring picnic") # "can wait"
52
52
 
53
53
  # Compile your own from a description
54
54
  program = paw.compile(
@@ -18,7 +18,7 @@ import programasweights as paw
18
18
  # Use a pre-compiled function (downloads once, runs locally forever)
19
19
  fn = paw.function("email-triage")
20
20
  fn("Urgent: the server is down!") # "immediate"
21
- fn("Newsletter: spring picnic") # "wait"
21
+ fn("Newsletter: spring picnic") # "can wait"
22
22
 
23
23
  # Compile your own from a description
24
24
  program = paw.compile(
@@ -0,0 +1,113 @@
1
+ # ProgramAsWeights
2
+
3
+ **Compile natural language specs into tiny neural functions that run locally.**
4
+
5
+ Define what a function should do in plain English. PAW compiles it into a small neural program that runs on your machine — no API keys at runtime, no internet needed after setup, fully deterministic.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install programasweights
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```python
16
+ import programasweights as paw
17
+
18
+ # Use a pre-compiled function (downloads once, runs locally forever)
19
+ fn = paw.function("email-triage")
20
+ fn("Urgent: the server is down!") # "immediate"
21
+ fn("Newsletter: spring picnic") # "can wait"
22
+
23
+ # Compile your own from a description
24
+ program = paw.compile(
25
+ "Fix malformed JSON: repair missing quotes and trailing commas",
26
+ compiler="paw-4b-qwen3-0.6b" # or "paw-4b-gpt2" for smaller/faster
27
+ )
28
+ fn = paw.function(program.id)
29
+ fn("{name: 'Alice',}") # '{"name": "Alice"}'
30
+ ```
31
+
32
+ ## Two Compilers
33
+
34
+ | | Standard (Qwen3 0.6B) | Compact (GPT-2 124M) |
35
+ |--------------------|-------------------------|------------------------|
36
+ | Compiler name | `paw-4b-qwen3-0.6b` | `paw-4b-gpt2` |
37
+ | Accuracy | Higher | Lower |
38
+ | Base model size | 594 MB | 105 MB |
39
+ | Program size | ~22 MB | ~5 MB |
40
+ | Inference speed | ~90ms (server) | ~50ms (server) |
41
+ | Runs in browser | No | Yes |
42
+
43
+ Default is Standard (Qwen3 0.6B). Use Compact (GPT-2) when you need smaller files or browser deployment.
44
+
45
+ ## Browser SDK
46
+
47
+ Programs compiled with GPT-2 also run entirely in the browser via WebAssembly — no server needed, data never leaves the user's device.
48
+
49
+ ```bash
50
+ npm install @programasweights/web
51
+ ```
52
+
53
+ ```javascript
54
+ import paw from '@programasweights/web';
55
+
56
+ const fn = await paw.function('programasweights/email-triage');
57
+ const result = await fn('Urgent: the server is down!');
58
+ // result: "immediate"
59
+ ```
60
+
61
+ See the [browser SDK repo](https://github.com/programasweights/programasweights-js) for full documentation.
62
+
63
+ ## Use with AI Agents
64
+
65
+ PAW works with Cursor, Claude, Codex, and other AI coding assistants. Paste this into your agent's chat:
66
+
67
+ > I want to use ProgramAsWeights (PAW) to create fuzzy text functions that run locally. Read the instructions at https://programasweights.com/agents and help me integrate it.
68
+
69
+ Or save [`AGENTS.md`](https://programasweights.com/agents) to your project root — agents read it automatically.
70
+
71
+ ## When to Use PAW
72
+
73
+ - **Fuzzy search** — typo-tolerant matching, semantic search, near-duplicate detection
74
+ - **Format repair** — fix broken JSON, normalize dates, repair malformed inputs
75
+ - **Classification** — sentiment, urgency, categories defined in your own words
76
+ - **Extraction** — emails, names, dates from messy unstructured text
77
+ - **Log triage** — extract errors from verbose output, filter noise
78
+ - **Intent routing** — map user descriptions to the closest URL, menu item, or setting
79
+ - **Agent preprocessing** — parse tool calls, validate outputs, route tasks
80
+
81
+ ## Authentication
82
+
83
+ ```bash
84
+ # Option 1: environment variable (recommended)
85
+ export PAW_API_KEY=paw_sk_...
86
+
87
+ # Option 2: CLI login (opens browser to generate key)
88
+ paw login
89
+ ```
90
+
91
+ Generate API keys at [programasweights.com/settings](https://programasweights.com/settings). Authenticated users get higher rate limits.
92
+
93
+ ## CLI
94
+
95
+ ```bash
96
+ paw compile --spec "Extract error lines from logs" --json
97
+ paw run --program <program_id> --input "[ERROR] timeout" --json
98
+ paw login
99
+ ```
100
+
101
+ `--json` gives structured output for programmatic use.
102
+
103
+ ## Links
104
+
105
+ - **Website**: [programasweights.com](https://programasweights.com)
106
+ - **Documentation**: [programasweights.readthedocs.io](https://programasweights.readthedocs.io)
107
+ - **Python SDK**: [github.com/programasweights/programasweights-python](https://github.com/programasweights/programasweights-python)
108
+ - **Browser SDK**: [github.com/programasweights/programasweights-js](https://github.com/programasweights/programasweights-js)
109
+ - **Program Hub**: [programasweights.com/hub](https://programasweights.com/hub)
110
+
111
+ ## License
112
+
113
+ MIT
@@ -34,11 +34,7 @@ Compile a specification.
34
34
  | `name` | string | No | Display title. Auto-generated if omitted. |
35
35
  | `tags` | string[] | No | Tags for discovery. |
36
36
 
37
- **Response:**
38
- - **202 Accepted** on success — JSON with `job_id`, `status`, `program_id`, `slug` (if created), `pseudo_program`, and `timings`
39
- - **400** — unknown compiler
40
- - **422** — spec too short, too long, or token limit exceeded
41
- - **500** — compilation failed (server error)
37
+ **Response (JSON):** includes `job_id`, `status`, `program_id`, `slug` (if created), `pseudo_program`, and `timings`.
42
38
 
43
39
  ### `POST /infer`
44
40
 
@@ -92,11 +88,7 @@ Owner-only fields: `public`, `name`, `tags`. Any authenticated user can set thei
92
88
 
93
89
  ### `GET /programs/{id_or_slug}/download`
94
90
 
95
- Downloads the `.paw` artifact. Returns one of:
96
- - **302** redirect to HuggingFace CDN (program already uploaded)
97
- - **200** file from server (freshly compiled, not yet on HF)
98
- - **202 Accepted** with `Retry-After` header (program assets still generating, retry after the indicated seconds)
99
- - **404** if program not found or private and not owned by the requester
91
+ Redirects to the Hugging Face CDN for the `.paw` artifact. Private programs return 404 to non-owners.
100
92
 
101
93
  ### `GET /programs/resolve/{slug}`
102
94
 
@@ -0,0 +1,146 @@
1
+ # Semantic Search Without a Vector Database
2
+
3
+ Most websites rely on keyword search — PostgreSQL full-text search, Elasticsearch, or similar. These work for exact terms but miss intent: a search for "something that works in the browser" won't match a program described as "runs client-side via WebAssembly." Adding semantic understanding normally requires vector databases, embedding pipelines, and external services. PAW lets you add intent-aware reranking on top of your existing search — no infrastructure changes, no embeddings, no external dependencies.
4
+
5
+ **Try it live:** Search at [programasweights.com/hub](https://programasweights.com/hub) — try queries like "something that works in the browser" or "not a classifier."
6
+
7
+ ## How we built it
8
+
9
+ ### Attempt 1: Numeric relevance scoring (1–10)
10
+
11
+ The obvious approach: compile a scorer that rates each search result on a 1–10 scale.
12
+
13
+ ```
14
+ Rate the relevance of this search result to the query on a scale of 1-10.
15
+ Query: "counting tasks"
16
+ ```
17
+
18
+ **Result:** The model clustered everything at 8–10. A search for "counting tasks" gave 9/10 to a sentiment classifier because it vaguely involved processing text. No discrimination.
19
+
20
+ **Lesson:** Small models can't produce fine-grained numeric scores. They don't have a calibrated sense of what "7 vs 8" means.
21
+
22
+ ### Attempt 2: Binary yes/no
23
+
24
+ Simplify to binary: is this result relevant or not?
25
+
26
+ ```
27
+ Is this search result relevant to the query? Return YES or NO.
28
+ ```
29
+
30
+ **Result:** Better discrimination, but couldn't distinguish "perfect match" from "vaguely related." Everything relevant got YES, so the top results were still unordered.
31
+
32
+ **Lesson:** Binary lacks granularity. You need at least 3–4 buckets to produce a meaningful ranking.
33
+
34
+ ### Attempt 3: Discrete categories
35
+
36
+ Use 3–4 named categories that map to sort order:
37
+
38
+ ```
39
+ Rate how well the candidate matches the query.
40
+ Return ONLY one of: exact_match, highly_relevant, somewhat_relevant, not_relevant
41
+ ```
42
+
43
+ **Result:** Much better. The model could reliably distinguish "this is exactly what they asked for" from "this is tangentially related." Mapping `exact_match=3, highly_relevant=2, somewhat_relevant=1, not_relevant=0` produced clean rankings.
44
+
45
+ **Lesson:** Discrete named categories work where numeric scales fail. The names give the model clear semantic anchors.
46
+
47
+ ### Attempt 4: Explicit exclusion rules
48
+
49
+ A search for "not a classifier" still returned classifiers ranked highly. The model ignored the negation.
50
+
51
+ **Fix:** Add an explicit rule for exclusions in the spec:
52
+
53
+ ```
54
+ If the query excludes something, those candidates are not_relevant.
55
+ ```
56
+
57
+ **Result:** Negation queries started working. "Not a classifier" correctly demoted classifiers.
58
+
59
+ **Lesson:** State rules explicitly. Don't assume the model infers constraints from the query — spell them out in the spec.
60
+
61
+ ## The solution
62
+
63
+ ### Spec template
64
+
65
+ ```python
66
+ SCORER_SPEC = """
67
+ You are a search matcher. Rate how well the candidate matches the query.
68
+ Match all constraints: {constraint_types}.
69
+ If the query excludes something, those candidates are not_relevant.
70
+
71
+ Query: "{query}"
72
+
73
+ Return ONLY one of: exact_match, highly_relevant, somewhat_relevant, not_relevant
74
+ """
75
+
76
+ scorer = paw.compile(SCORER_SPEC.format(
77
+ constraint_types="topic, author, and category",
78
+ query="counting tasks by da03",
79
+ ))
80
+ ```
81
+
82
+ Replace `constraint_types` with whatever metadata your search results have (topic, author, date, category, price range, etc.).
83
+
84
+ ### Architecture
85
+
86
+ ```
87
+ User query
88
+
89
+
90
+ Keyword search (FTS / Elasticsearch / etc.)
91
+ │ returns top N candidates
92
+
93
+ Compile PAW scorer for this query (cached by query text)
94
+
95
+
96
+ Score each candidate ──► exact_match / highly_relevant / somewhat / not_relevant
97
+ │ │
98
+ ▼ ▼
99
+ Map to integers Sort descending
100
+
101
+
102
+ Return reranked results
103
+ ```
104
+
105
+ ### Candidate formatting
106
+
107
+ Each candidate is passed to the scorer as a text block. Include the fields that matter for your domain:
108
+
109
+ ```python
110
+ SCORE_MAP = {"exact_match": 3, "highly_relevant": 2, "somewhat_relevant": 1, "not_relevant": 0}
111
+
112
+ def rerank(query: str, candidates: list[dict]) -> list[dict]:
113
+ scorer = paw.compile_and_load(SCORER_SPEC.format(
114
+ constraint_types="topic, author, and category",
115
+ query=query,
116
+ ))
117
+
118
+ scored = []
119
+ for c in candidates:
120
+ text = f"Name: {c['name']}\nAuthor: {c['author']}\nDescription: {c['description']}"
121
+ label = scorer(text)
122
+ scored.append((SCORE_MAP.get(label, 0), c))
123
+
124
+ scored.sort(key=lambda x: x[0], reverse=True)
125
+ return [c for _, c in scored]
126
+ ```
127
+
128
+ ### Progressive UX
129
+
130
+ Show keyword results immediately. If the server isn't busy, fire the reranking in the background and update the results once scoring completes. Users see instant results that get refined — no loading spinner.
131
+
132
+ ## Adapting this for your site
133
+
134
+ 1. **Start with your existing search.** PAW reranking is a layer on top — it doesn't replace your keyword search.
135
+ 2. **Pick your constraint types.** What metadata do your results have? Topic, author, price, date, location?
136
+ 3. **Compile a scorer** with the template above, replacing `constraint_types` and `query`.
137
+ 4. **Score your top 10–20 results.** Don't score everything — just the candidates that keyword search already found promising.
138
+ 5. **Build a test set** of 10–20 queries with known-good rankings. Iterate on the spec until it discriminates well.
139
+ 6. The scorer is cached by query text — repeated searches are instant.
140
+
141
+ ## Takeaways
142
+
143
+ - **Discrete categories beat numeric scales** for small models. Use 3–4 named buckets.
144
+ - **State constraints and exclusions explicitly** in the spec. The model won't infer them from the query alone.
145
+ - **Rerank, don't replace.** Layer PAW scoring on top of existing keyword search for the best of both worlds.
146
+ - **Test with adversarial queries** — negations, ambiguous terms, author-specific searches — to find spec weaknesses early.
@@ -0,0 +1,127 @@
1
+ # Natural Language Site Navigation
2
+
3
+ Every website with more than a handful of pages forces users to click through menus and navigation layers to find what they need. A Cmd+K / "Quick Find" helper that understands natural language can route users instantly — but normally requires a full LLM backend. PAW lets you build this with a pipeline of tiny compiled functions.
4
+
5
+ **Try it live:** Press Cmd+K (or Ctrl+K) on [programasweights.com](https://programasweights.com) and type something like "how do I run in the browser" or "where do I get an API key."
6
+
7
+ ## How we built it
8
+
9
+ ### Attempt 1: Generate the URL directly
10
+
11
+ The simplest idea: compile one program with all your pages listed in the spec, ask it to output the matching URL.
12
+
13
+ ```
14
+ Given a user query, return the URL of the most relevant page.
15
+ Pages: /playground, /hub, /browser, /docs, /settings, /about
16
+ ```
17
+
18
+ **Result:** The model hallucinated plausible-sounding but wrong paths (`/programs`, `/SDK`, `/api`). Small models are unreliable at generating precise strings from memory.
19
+
20
+ **Lesson:** Don't ask the model to generate structured output like URLs. It will hallucinate.
21
+
22
+ ### Attempt 2: Reframe as classification
23
+
24
+ Instead of generating URLs, output a digit: 1 = Playground, 2 = Hub, 3 = Browser, etc. The frontend maps digits to actual routes.
25
+
26
+ ```
27
+ Classify the user's intent. Return ONLY a single digit.
28
+ 1 = Create or compile a new program
29
+ 2 = Browse or search existing programs
30
+ 3 = Run a program in the browser
31
+ ...
32
+ 0 = None of the above
33
+ ```
34
+
35
+ **Result:** Accuracy jumped from ~67% to ~88%. Classification is far more reliable than generation for routing.
36
+
37
+ **Lesson:** Reframe generation tasks as classification whenever possible. Output a label or digit, map it to the real value in your code.
38
+
39
+ ### Attempt 3: Add Q&A support
40
+
41
+ Users don't only navigate — they also ask questions ("is PAW free?", "what languages are supported?"). We tried adding Q&A to the same program.
42
+
43
+ **Result:** Cramming routing + Q&A into one spec degraded both tasks. The model couldn't handle the complexity.
44
+
45
+ **Lesson:** One program, one job. When accuracy drops, split the task.
46
+
47
+ ### Attempt 4: Multi-program pipeline
48
+
49
+ Split into specialized programs, each doing one thing well:
50
+
51
+ 1. **Page classifier** — routes to a page or says "this is a question"
52
+ 2. **Question-type classifier** — is it a yes/no question or a how/what question?
53
+ 3. **Yes/no answerer** — answers factual yes/no questions (facts baked into the spec)
54
+ 4. **How/what answerer** — answers descriptive questions
55
+ 5. **Answer validator** — checks "does this answer actually address the question?"
56
+
57
+ The validator was the key final addition. Without it, the pipeline would sometimes produce answers like "yes" for "what is the license?" — grammatically fine but useless. The validator catches these.
58
+
59
+ **Result:** The pipeline handles navigation, FAQ, and edge cases reliably. Each program compiles in seconds and runs in milliseconds.
60
+
61
+ ## The solution
62
+
63
+ ```python
64
+ import programasweights as paw
65
+
66
+ router = paw.function("my-page-router")
67
+ q_type = paw.function("my-question-type")
68
+ yes_no = paw.function("my-yes-no-answerer")
69
+ howto = paw.function("my-howto-answerer")
70
+ validator = paw.function("my-answer-validator")
71
+
72
+ def handle_query(user_query: str):
73
+ destination = router(user_query)
74
+ if destination != "0":
75
+ return {"action": "navigate", "page": PAGES[int(destination)]}
76
+
77
+ category = q_type(user_query)
78
+ if category == "yes_no":
79
+ answer = yes_no(user_query)
80
+ elif category == "how_what":
81
+ answer = howto(user_query)
82
+ else:
83
+ return {"action": "fallback", "message": "Try browsing the docs."}
84
+
85
+ if validator(f"Q: {user_query}\nA: {answer}") != "valid":
86
+ return {"action": "fallback", "message": "I'm not sure. Try the docs."}
87
+
88
+ return {"action": "answer", "text": answer}
89
+ ```
90
+
91
+ Each program has a focused spec. For example, the page classifier:
92
+
93
+ ```python
94
+ router = paw.compile("""
95
+ Classify the user's intent. Return ONLY a single digit.
96
+ 1 = Create or compile something new
97
+ 2 = Browse or search existing items
98
+ 3 = Run something in the browser
99
+ 4 = Read documentation
100
+ 5 = Manage account or API keys
101
+ 0 = None of the above (likely a question)
102
+
103
+ Input: how do I get started
104
+ Output: 4
105
+
106
+ Input: browse community programs
107
+ Output: 2
108
+
109
+ Input: is it free?
110
+ Output: 0
111
+ """)
112
+ ```
113
+
114
+ ## Adapting this for your site
115
+
116
+ 1. **List your pages** with short descriptions of what users do there
117
+ 2. **Compile a classifier** that maps intents to page numbers
118
+ 3. **Test with 20-30 real queries** your users would type — iterate on the spec wording
119
+ 4. If users also ask questions, add Q&A programs and a validator
120
+ 5. Each program compiles once and is cached forever — the pipeline runs locally with no API calls
121
+
122
+ ## Takeaways
123
+
124
+ - **Classification beats generation** for routing. Output a label, map it in code.
125
+ - **Multiple small programs beat one complex program.** When accuracy drops, split.
126
+ - **A validator catches failures** the other programs miss — cheap insurance.
127
+ - **Iterate with real queries.** Build a small test set, measure, adjust wording, repeat.
@@ -20,7 +20,7 @@ result = fn("Thesis defense committee needs your signature by EOD")
20
20
  print(result) # "immediate"
21
21
 
22
22
  result = fn("Department newsletter: spring picnic next Friday")
23
- print(result) # "wait"
23
+ print(result) # "can wait"
24
24
  ```
25
25
 
26
26
  ## Compile Your Own