| |
| |
| |
|
|
| \restrict THevuI5nL8va278qqO7jMSTP5LK8tqxqzRceXTedW4fR4pqR5ttaHEIfQb9Nuug |
|
|
| |
| |
|
|
| SET statement_timeout = 0; |
| SET lock_timeout = 0; |
| SET idle_in_transaction_session_timeout = 0; |
| SET client_encoding = 'UTF8'; |
| SET standard_conforming_strings = on; |
| SELECT pg_catalog.set_config('search_path', '', false); |
| SET check_function_bodies = false; |
| SET xmloption = content; |
| SET client_min_messages = warning; |
| SET row_security = off; |
|
|
| |
| |
| |
|
|
| CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE EXTENSION IF NOT EXISTS vector WITH SCHEMA public; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON EXTENSION vector IS 'vector data type and ivfflat and hnsw access methods'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TYPE public.capability_tag_t AS ENUM ( |
| 'concise', |
| 'summarization', |
| 'thinking_mode', |
| 'tool_calling' |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TYPE public.pipeline_status_t AS ENUM ( |
| 'INGESTED', |
| 'DEDUPED', |
| 'SCORED', |
| 'PUBLISHABLE' |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TYPE public.review_dimension AS ENUM ( |
| 'overall', |
| 'correctness', |
| 'teaching_value', |
| 'language_quality', |
| 'completeness', |
| 'cultural_accuracy' |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE FUNCTION public.model_format_spec_touch_updated_at() RETURNS trigger |
| LANGUAGE plpgsql |
| AS $$ |
| BEGIN |
| NEW.updated_at := now(); |
| RETURN NEW; |
| END; |
| $$; |
|
|
|
|
| |
| |
| |
|
|
| CREATE FUNCTION public.set_pipeline_status(p_content_hash text, p_status public.pipeline_status_t, p_reason text DEFAULT NULL::text) RETURNS void |
| LANGUAGE sql |
| AS $$ |
| UPDATE samples SET pipeline_status = p_status, |
| pipeline_status_reason = p_reason, |
| pipeline_status_updated_at = now() |
| WHERE content_hash = p_content_hash; |
| $$; |
|
|
|
|
| SET default_tablespace = ''; |
|
|
| SET default_table_access_method = heap; |
|
|
| |
| |
| |
|
|
| CREATE TABLE public.backfill_progress ( |
| pass_name text NOT NULL, |
| blob_path text NOT NULL, |
| done boolean DEFAULT false NOT NULL, |
| rows_seen integer DEFAULT 0 NOT NULL, |
| updated_at timestamp with time zone DEFAULT now() NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.chunks ( |
| chunk_hash text NOT NULL, |
| parent_hash text NOT NULL, |
| "position" integer NOT NULL, |
| chunk_text text NOT NULL, |
| n_chars integer NOT NULL, |
| embedding public.vector(768), |
| lang text, |
| created_at timestamp with time zone DEFAULT now() NOT NULL, |
| kb_doc_id bigint |
| ) |
| WITH (autovacuum_vacuum_insert_scale_factor='0.02'); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON TABLE public.chunks IS 'RAG retrieval chunks split from rag_pool-eligible samples (encyclopedic/news/cultural kinds or known factual-crawl sources). ~1200-char chunks, 150-char overlap, sentence-boundary aware. embedding is NULL at write time — populated later by an extended bitdeer embed worker (see generation/embed_worker_bitdeer.py, owned by another task/agent).'; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON COLUMN public.chunks.kb_doc_id IS 'FK to kb_documents — makes this chunk citable with real source/version/license metadata. NULL for chunks ingested before the kb layer existed (e.g. legacy wiki/fineweb chunks); backfill separately, this column addition does not retroactively populate it.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.coldstart_coding_rollouts ( |
| rollout_id bigint NOT NULL, |
| trajectory_id text NOT NULL, |
| content_hash text NOT NULL, |
| format text DEFAULT 'rowc.selfscaffold.v1'::text, |
| role_in_dataset text DEFAULT 'sft_coldstart'::text, |
| teacher_model text NOT NULL, |
| teacher_quant text, |
| teacher_provider text, |
| teacher_license text, |
| teacher_model_id smallint, |
| source text NOT NULL, |
| source_id smallint, |
| domain text, |
| language text, |
| task_kind text, |
| generated boolean DEFAULT true, |
| test_gated boolean DEFAULT false, |
| test_passed boolean, |
| gate_detail jsonb, |
| upstream_task_id text, |
| upstream_repo text, |
| upstream_commit text, |
| task_source text, |
| task_source_license text, |
| trajectory_blob_path text, |
| scaffold_text text, |
| stage1_token_count integer, |
| stage2_token_count integer, |
| obs_token_count integer, |
| trainable_token_count integer, |
| prompt_tokens integer, |
| completion_tokens integer, |
| gen_seconds real, |
| created_at timestamp with time zone DEFAULT now() |
| ); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.coldstart_coding_rollouts ALTER COLUMN rollout_id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.coldstart_coding_rollouts_rollout_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.samples ( |
| content_hash text NOT NULL, |
| kind text NOT NULL, |
| lang text, |
| source text NOT NULL, |
| minhash bigint[], |
| embedding public.vector(768), |
| sprapp_filter_score jsonb, |
| sprapp_filter_flagged text[], |
| quarantined boolean DEFAULT false, |
| verify_status text, |
| register text, |
| promoted boolean DEFAULT false, |
| blob_path text NOT NULL, |
| row_len_chars integer, |
| created_at timestamp with time zone DEFAULT now(), |
| near_dup_of text, |
| textbook_quality double precision, |
| cultural_nuance boolean DEFAULT false, |
| cultural_markers text[], |
| minhash_algo text DEFAULT 'datasketch_v1'::text, |
| license text, |
| review_score double precision, |
| generated_by_model smallint, |
| reviewed_by_model smallint, |
| generation_score double precision, |
| structural_quality double precision, |
| structural_signals jsonb, |
| split text, |
| perplexity double precision, |
| quality_tier text, |
| composite_score double precision, |
| composite_profile text, |
| contaminated boolean DEFAULT false, |
| translated_from text, |
| text_inline text, |
| model_quality_score double precision, |
| langid_pred text, |
| langid_conf double precision, |
| source_id smallint, |
| usage_tags text[] DEFAULT '{}'::text[], |
| fts tsvector GENERATED ALWAYS AS (to_tsvector('simple'::regconfig, COALESCE(text_inline, ''::text))) STORED, |
| minhash_packed bytea, |
| embedding_h public.halfvec(768), |
| shard_id integer, |
| kind_id smallint, |
| lang_id smallint, |
| license_id smallint, |
| register_id smallint, |
| quality_tier_id smallint, |
| split_id smallint, |
| gen_temperature double precision, |
| gen_max_tokens integer, |
| gen_repeat_penalty double precision, |
| gen_seed bigint, |
| gen_provider text, |
| gen_quantization text, |
| gen_prompt_variant text, |
| pipeline_status public.pipeline_status_t DEFAULT 'INGESTED'::public.pipeline_status_t NOT NULL, |
| pipeline_status_updated_at timestamp with time zone DEFAULT now() NOT NULL, |
| pipeline_status_reason text, |
| restricted_overlap boolean DEFAULT false, |
| restricted_overlap_source text, |
| capability_tags public.capability_tag_t[], |
| pii_detected boolean DEFAULT false, |
| pii_types text[], |
| input_tokens integer, |
| output_tokens integer, |
| token_count integer, |
| token_count_tokenizer text, |
| best_of_n_score double precision, |
| cpt_eligible boolean DEFAULT false, |
| sft_eligible boolean DEFAULT false, |
| ingest_origin text |
| ) |
| WITH (fillfactor='90', autovacuum_vacuum_scale_factor='0.02', autovacuum_analyze_scale_factor='0.01'); |
| ALTER TABLE ONLY public.samples ALTER COLUMN sprapp_filter_score SET COMPRESSION lz4; |
| ALTER TABLE ONLY public.samples ALTER COLUMN structural_signals SET COMPRESSION lz4; |
| ALTER TABLE ONLY public.samples ALTER COLUMN text_inline SET COMPRESSION lz4; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON COLUMN public.samples.gen_temperature IS 'Sampling temperature used for this row''s generation call, e.g. 0.7-0.85 across the *_ms.py drivers (per-family default from generation/optimal_configs.json via cfg_for()), or gen_sea_data.py''s fixed 0.8 for API generators. NULL = not recorded (pre-2026-07-05 row) or not generated (real/relicensed text).'; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON COLUMN public.samples.gen_max_tokens IS 'max_tokens request cap sent to the generating backend for this row. NOT the actual completion length (row_len_chars is) — this is the ceiling; hitting it exactly is a truncation signal cross-checked by structural_quality.py separately.'; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON COLUMN public.samples.gen_repeat_penalty IS 'llama.cpp/vLLM repeat_penalty param (repeat_last_n=256 fixed across drivers, not itself stored — only the penalty value varies by family). NULL for API generators (MiniMax/GLM) that do not expose this knob via gen_sea_data.py''s call().'; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON COLUMN public.samples.gen_seed IS 'Per-request sampling seed, when the backend accepts one. llama.cpp''s /v1/chat/completions takes an integer "seed" field — wired through from the *_ms.py drivers'' worker RNG (NOT reproducible-guaranteed; llama.cpp seed affects the initial RNG state only, not full determinism under batching). MiniMax/GLM APIs (gen_sea_data.py) expose no seed parameter at all as of 2026-07 — always NULL for those rows, by design, not an omission.'; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON COLUMN public.samples.gen_provider IS 'Where generation actually ran: ''local-llamacpp'' (the 6 *_ms.py drivers, bitdeer CPU fleet ports 8091-8098/8191), ''minimax-api'' or ''glm-api'' (gen_sea_data.py / gen_concurrent.py), ''local-vllm'' (if/when a vLLM backend is used instead of llama.cpp — same OpenAI-compatible request shape). NULL means unrecorded (older row) or non-generated source — see samples.source/sources table for the latter case.'; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON COLUMN public.samples.gen_quantization IS 'Quantization level of the weights that generated this row, stated EXPLICITLY — never left blank/assumed-full-precision. Known values: ''q8_0'' (current local qwen3.6-35b-a3b-q8.gguf teacher, hardcoded at the driver since the binary itself does not report it back over the API). For API-served models (MiniMax, GLM): ''unknown'' — these providers do NOT disclose quant level in responses, and are known to silently serve quantized variants without saying so in the model name; ''unknown'' here is an honest gap, not a placeholder for ''none''. NULL (distinct from ''unknown'') means this column was not populated at all for the row (older ingest, pre-2026-07-05).'; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON COLUMN public.samples.gen_prompt_variant IS 'template_bandit.py mutator variant_id applied to this row''s prompt before sending to the teacher (e.g. ''toggle_exemplar'', ''format_explicitness'', ''control'' = unmutated base prompt). Populated by gen_sft_ms.py''s apply_prompt_variant() via the driver''s gen_params dict, same wiring as gen_temperature etc above. NULL means EITHER the family has no prompt_variant entry in optimal_configs.json at gen time, OR the row predates this column (pre-2026-07-05 follow-up) — see the NULL-ambiguity note below, same caveat applies here.'; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON COLUMN public.samples.best_of_n_score IS 'gen_params.best_of_n_score from generation/best_of_n.py''s select_best_of_n() (reward_selection_bestofN_v1 selection_algorithm), when the producing driver ran with --best-of-n N>1. NULL = either N=1 (no-op best-of-n) or row predates this column (pre-2026-07-07 ingest) — same NULL-ambiguity caveat as the other gen_* columns in generation_params_schema.sql.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.composition_report AS |
| SELECT kind, |
| lang, |
| source, |
| count(*) AS n, |
| count(*) FILTER (WHERE promoted) AS n_promoted, |
| count(*) FILTER (WHERE quarantined) AS n_quarantined |
| FROM public.samples |
| GROUP BY kind, lang, source |
| ORDER BY (count(*)) DESC; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.contamination_hashes ( |
| content_hash text NOT NULL, |
| eval_set text NOT NULL, |
| added_at timestamp with time zone DEFAULT now() |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.context_size_composition AS |
| SELECT lang, |
| kind, |
| count(*) FILTER (WHERE (input_tokens IS NOT NULL)) AS n_split, |
| count(*) FILTER (WHERE (token_count IS NOT NULL)) AS n_bulk, |
| avg(input_tokens) AS avg_input_tokens, |
| avg(output_tokens) AS avg_output_tokens, |
| avg(token_count) AS avg_token_count |
| FROM public.samples |
| WHERE ((input_tokens IS NOT NULL) OR (token_count IS NOT NULL)) |
| GROUP BY lang, kind |
| ORDER BY (count(*) FILTER (WHERE (input_tokens IS NOT NULL)) + count(*) FILTER (WHERE (token_count IS NOT NULL))) DESC; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.corpus_snapshot_members ( |
| snapshot text NOT NULL, |
| content_hash text NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.corpus_snapshots ( |
| name text NOT NULL, |
| profile text, |
| filter_sql text, |
| n_rows bigint, |
| manifest_hash text, |
| created_at timestamp with time zone DEFAULT now(), |
| notes text, |
| parent_snapshot text, |
| as_of timestamp with time zone, |
| selection_algorithm text |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.corpus_version ( |
| version bigint NOT NULL, |
| pass_name text NOT NULL, |
| rows_affected bigint NOT NULL, |
| at timestamp with time zone DEFAULT now() NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON TABLE public.corpus_version IS 'Monotonic version counter bumped by pipeline passes after they finish a run (one row per pass-run, not per-row). GET /version on the serving API exposes MAX(version) as the freshness contract for consumers pinning to a corpus state — see CURATION_DOCTRINE.md "Trust layer" section.'; |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.corpus_version ALTER COLUMN version ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.corpus_version_version_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.cpt_pool AS |
| SELECT content_hash, |
| kind, |
| lang, |
| source, |
| minhash, |
| embedding, |
| sprapp_filter_score, |
| sprapp_filter_flagged, |
| quarantined, |
| verify_status, |
| register, |
| promoted, |
| blob_path, |
| row_len_chars, |
| created_at, |
| near_dup_of, |
| textbook_quality, |
| cultural_nuance, |
| cultural_markers, |
| minhash_algo, |
| license, |
| review_score, |
| generated_by_model, |
| reviewed_by_model, |
| generation_score, |
| structural_quality, |
| structural_signals, |
| split, |
| perplexity, |
| quality_tier, |
| composite_score, |
| composite_profile, |
| contaminated, |
| translated_from, |
| text_inline, |
| model_quality_score, |
| langid_pred, |
| langid_conf, |
| source_id, |
| usage_tags, |
| fts |
| FROM public.samples |
| WHERE ((license = ANY (ARRAY['Apache-2.0'::text, 'MIT'::text, 'CC0-1.0'::text, 'CC-BY-4.0'::text, 'CC-BY-SA-4.0'::text, 'CC-BY-SA-3.0'::text, 'ODC-By-1.0'::text])) AND (split = 'train'::text) AND (COALESCE(contaminated, false) = false) AND (near_dup_of IS NULL) AND (COALESCE(quarantined, false) = false) AND ((quality_tier = ANY (ARRAY['head'::text, 'middle'::text])) OR ((quality_tier IS NULL) AND (composite_score >= (0.5)::double precision)))); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON VIEW public.cpt_pool IS 'Base CPT pool: license-safe (excludes ToS-unverified), split=train, not contaminated/near-dup/quarantined, head|middle quality tier (or un-tiered rows with composite_score>=0.5 as a fallback). Per DatologyAI: quality is the globally-beneficial signal — this pool is NOT per-language filtered beyond the shared quality bar. License whitelist per 2026-07-04 policy ruling: Apache-2.0, MIT, CC0-1.0, CC-BY-4.0, CC-BY-SA-4.0, CC-BY-SA-3.0, ODC-By-1.0 — attribution/ShareAlike obligations for the CC-BY*/ODC-By licenses are handled in the model card, not by exclusion here.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.gold_candidates AS |
| SELECT content_hash, |
| kind, |
| lang, |
| source, |
| minhash, |
| embedding, |
| sprapp_filter_score, |
| sprapp_filter_flagged, |
| quarantined, |
| verify_status, |
| register, |
| promoted, |
| blob_path, |
| row_len_chars, |
| created_at, |
| near_dup_of, |
| textbook_quality, |
| cultural_nuance, |
| cultural_markers, |
| minhash_algo, |
| license, |
| review_score, |
| generated_by_model, |
| reviewed_by_model, |
| generation_score, |
| structural_quality, |
| structural_signals, |
| split, |
| perplexity, |
| quality_tier, |
| composite_score, |
| composite_profile, |
| contaminated, |
| translated_from, |
| text_inline, |
| model_quality_score, |
| langid_pred, |
| langid_conf |
| FROM public.samples |
| WHERE ((NOT quarantined) AND (NOT contaminated) AND (near_dup_of IS NULL) AND (verify_status IS DISTINCT FROM 'fail'::text) AND ((textbook_quality IS NULL) OR (textbook_quality >= (0.4)::double precision)) AND ((structural_quality IS NULL) OR (structural_quality >= (0.5)::double precision)) AND (license = ANY (ARRAY['Apache-2.0'::text, 'MIT'::text, 'CC0'::text, 'CC-BY-4.0'::text]))) |
| ORDER BY textbook_quality DESC NULLS LAST, cultural_nuance DESC; |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.heal_pool AS |
| SELECT content_hash, |
| kind, |
| lang, |
| source, |
| minhash, |
| embedding, |
| sprapp_filter_score, |
| sprapp_filter_flagged, |
| quarantined, |
| verify_status, |
| register, |
| promoted, |
| blob_path, |
| row_len_chars, |
| created_at, |
| near_dup_of, |
| textbook_quality, |
| cultural_nuance, |
| cultural_markers, |
| minhash_algo, |
| license, |
| review_score, |
| generated_by_model, |
| reviewed_by_model, |
| generation_score, |
| structural_quality, |
| structural_signals, |
| split, |
| perplexity, |
| quality_tier, |
| composite_score, |
| composite_profile, |
| contaminated, |
| translated_from, |
| text_inline, |
| model_quality_score, |
| langid_pred, |
| langid_conf, |
| source_id, |
| usage_tags, |
| fts, |
| minhash_packed, |
| embedding_h, |
| shard_id, |
| kind_id, |
| lang_id, |
| license_id, |
| register_id, |
| quality_tier_id, |
| split_id |
| FROM public.samples |
| WHERE ((license = ANY (ARRAY['Apache-2.0'::text, 'MIT'::text, 'CC0-1.0'::text, 'CC-BY-4.0'::text, 'CC-BY-SA-4.0'::text, 'CC-BY-SA-3.0'::text, 'ODC-By-1.0'::text])) AND ((split IS NULL) OR (split = 'train'::text)) AND (COALESCE(contaminated, false) = false) AND (near_dup_of IS NULL) AND (COALESCE(quarantined, false) = false) AND ((structural_quality IS NULL) OR (structural_quality >= (0.5)::double precision))); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON VIEW public.heal_pool IS 'Ternary QAT-heal data pool: license-safe (CPT whitelist incl ODC-By/CC-BY-SA), split=train-or-unscored, not contaminated/near-dup/quarantined, structural_quality>=0.5-or-unscored. DOMAIN-FLOOR CONTRACT (enforced by the exporter, pipeline/heal_mix_export.py, not by this view): a heal mix drawn from this pool must be (a) >=40% general-web tokens (fineweb2/cc100-style sources), (b) the remaining <=60% floor-mixed across kind-groups (reasoning/sft/cultural/encyclopedic/news/dialogue/other) so no single domain dominates via repetition/cycling, and (c) globally shuffle-interleaved in final row order (measured: sequential domain files caused late-phase overfit twice, DATA_BUDGET_PROJECTION.md §4/§7). This view only answers "is this row heal-eligible at all" — it deliberately has no notion of proportion or order, since a SQL view result has no meaningful row order to depend on.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.heal_pool_supply AS |
| SELECT |
| CASE |
| WHEN ((kind = ANY (ARRAY['web'::text, 'webtext'::text, 'web-informal'::text])) OR (source ~~* '%fineweb%'::text) OR (source = 'cc100_ms'::text)) THEN 'general_web'::text |
| WHEN (kind = 'encyclopedic'::text) THEN 'encyclopedic'::text |
| WHEN (kind = ANY (ARRAY['d1-logic'::text, 'd1-plan'::text, 'd1-math'::text, 'd1-estimate'::text])) THEN 'reasoning'::text |
| WHEN (kind = ANY (ARRAY['d2-openbook'::text, 'd3-tool'::text, 'd5-code'::text, 'long-form'::text])) THEN 'sft'::text |
| WHEN (kind = 'cultural'::text) THEN 'cultural'::text |
| WHEN (kind = 'news'::text) THEN 'news'::text |
| WHEN (kind = ANY (ARRAY['factual-qa'::text, 'parallel-translation'::text])) THEN 'dialogue'::text |
| ELSE 'other'::text |
| END AS kind_group, |
| count(*) AS n_rows, |
| (sum( |
| CASE |
| WHEN (text_inline IS NOT NULL) THEN ((array_length(regexp_split_to_array(TRIM(BOTH FROM text_inline), '\s+'::text), 1))::numeric * 1.3) |
| ELSE (((COALESCE(row_len_chars, 0))::numeric / 7.04) * 1.3) |
| END))::bigint AS est_tokens |
| FROM public.heal_pool |
| GROUP BY |
| CASE |
| WHEN ((kind = ANY (ARRAY['web'::text, 'webtext'::text, 'web-informal'::text])) OR (source ~~* '%fineweb%'::text) OR (source = 'cc100_ms'::text)) THEN 'general_web'::text |
| WHEN (kind = 'encyclopedic'::text) THEN 'encyclopedic'::text |
| WHEN (kind = ANY (ARRAY['d1-logic'::text, 'd1-plan'::text, 'd1-math'::text, 'd1-estimate'::text])) THEN 'reasoning'::text |
| WHEN (kind = ANY (ARRAY['d2-openbook'::text, 'd3-tool'::text, 'd5-code'::text, 'long-form'::text])) THEN 'sft'::text |
| WHEN (kind = 'cultural'::text) THEN 'cultural'::text |
| WHEN (kind = 'news'::text) THEN 'news'::text |
| WHEN (kind = ANY (ARRAY['factual-qa'::text, 'parallel-translation'::text])) THEN 'dialogue'::text |
| ELSE 'other'::text |
| END |
| ORDER BY ((sum( |
| CASE |
| WHEN (text_inline IS NOT NULL) THEN ((array_length(regexp_split_to_array(TRIM(BOTH FROM text_inline), '\s+'::text), 1))::numeric * 1.3) |
| ELSE (((COALESCE(row_len_chars, 0))::numeric / 7.04) * 1.3) |
| END))::bigint) DESC; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON VIEW public.heal_pool_supply IS 'Human-facing sanity check only — approximate token supply per kind-group in heal_pool, same estimator convention as heal_mix_export.py (words*1.3; CHARS_PER_WORD_BULK=7.04 for rows without text_inline, measured from /mnt/raid0/cpt_ms_bulk/filter_summary.json). Not read by the exporter itself.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.kb_documents ( |
| id bigint NOT NULL, |
| title text NOT NULL, |
| source_url text, |
| source_org text, |
| license text NOT NULL, |
| version_date date, |
| retrieval_date date DEFAULT CURRENT_DATE NOT NULL, |
| doc_type text NOT NULL, |
| content_hash text, |
| created_at timestamp with time zone DEFAULT now() NOT NULL, |
| CONSTRAINT kb_documents_doc_type_check CHECK ((doc_type = ANY (ARRAY['first-aid'::text, 'encyclopedic'::text, 'faq'::text, 'legal'::text]))) |
| ); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON TABLE public.kb_documents IS 'Knowledge-base document registry: real source/version/license metadata so a RAG answer can cite "per kb_documents.title (kb_documents.source_org), dated kb_documents.version_date, kb_documents.license" instead of just a free-text samples.source label. One row per distinct fetched document (article/guide/page), NOT per chunk — chunks.kb_doc_id (see below) links many chunks to one kb_documents row.'; |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.kb_documents ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.kb_documents_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.kinds ( |
| id smallint NOT NULL, |
| name text NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.kinds ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.kinds_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.label_audit ( |
| id bigint NOT NULL, |
| content_hash text NOT NULL, |
| column_name text NOT NULL, |
| old_value text, |
| new_value text, |
| pass_name text NOT NULL, |
| changed_at timestamp with time zone DEFAULT now() NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON TABLE public.label_audit IS 'Lineage trail for samples column changes. Populated BY CONVENTION (no trigger — avoids write-amplification on the hot `samples` table): each pipeline pass that mutates a column calls pipeline/audit_helper.py log_label_change()/bulk_log_label_changes() itself. Absence of rows for a given (content_hash, column) does not prove the value never changed — only that no pass has adopted the convention for that change yet.'; |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.label_audit ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.label_audit_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.lang_quality_config ( |
| lang text NOT NULL, |
| textbook_min double precision DEFAULT 0.40, |
| structural_min double precision DEFAULT 0.50, |
| composite_min double precision DEFAULT 0.55, |
| perplexity_head_max double precision, |
| perplexity_tail_min double precision, |
| set_by text, |
| notes text, |
| updated_at timestamp with time zone DEFAULT now() |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.lang_token_budget AS |
| SELECT lang, |
| count(*) AS n_rows, |
| count(*) FILTER (WHERE (split = 'train'::text)) AS n_train, |
| sum(row_len_chars) AS total_chars, |
| round(((sum(row_len_chars))::numeric / 4.0)) AS approx_tokens, |
| round((avg(composite_score))::numeric, 3) AS avg_composite, |
| count(*) FILTER (WHERE (quality_tier = 'head'::text)) AS n_head |
| FROM public.samples |
| GROUP BY lang |
| ORDER BY (round(((sum(row_len_chars))::numeric / 4.0))) DESC NULLS LAST; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.langs ( |
| id smallint NOT NULL, |
| name text NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.langs ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.langs_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.licenses ( |
| id smallint NOT NULL, |
| name text NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.licenses ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.licenses_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.lora_pool_high AS |
| SELECT content_hash, |
| kind, |
| lang, |
| source, |
| minhash, |
| embedding, |
| sprapp_filter_score, |
| sprapp_filter_flagged, |
| quarantined, |
| verify_status, |
| register, |
| promoted, |
| blob_path, |
| row_len_chars, |
| created_at, |
| near_dup_of, |
| textbook_quality, |
| cultural_nuance, |
| cultural_markers, |
| minhash_algo, |
| license, |
| review_score, |
| generated_by_model, |
| reviewed_by_model, |
| generation_score, |
| structural_quality, |
| structural_signals, |
| split, |
| perplexity, |
| quality_tier, |
| composite_score, |
| composite_profile, |
| contaminated, |
| translated_from, |
| text_inline, |
| model_quality_score, |
| langid_pred, |
| langid_conf, |
| source_id, |
| usage_tags, |
| fts |
| FROM public.cpt_pool |
| WHERE (register = 'HIGH'::text); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON VIEW public.lora_pool_high IS 'Register-pure (HIGH) slice of cpt_pool — register-LoRA training only, never a CPT substitute.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.lora_pool_low AS |
| SELECT content_hash, |
| kind, |
| lang, |
| source, |
| minhash, |
| embedding, |
| sprapp_filter_score, |
| sprapp_filter_flagged, |
| quarantined, |
| verify_status, |
| register, |
| promoted, |
| blob_path, |
| row_len_chars, |
| created_at, |
| near_dup_of, |
| textbook_quality, |
| cultural_nuance, |
| cultural_markers, |
| minhash_algo, |
| license, |
| review_score, |
| generated_by_model, |
| reviewed_by_model, |
| generation_score, |
| structural_quality, |
| structural_signals, |
| split, |
| perplexity, |
| quality_tier, |
| composite_score, |
| composite_profile, |
| contaminated, |
| translated_from, |
| text_inline, |
| model_quality_score, |
| langid_pred, |
| langid_conf, |
| source_id, |
| usage_tags, |
| fts |
| FROM public.cpt_pool |
| WHERE (register = 'LOW'::text); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON VIEW public.lora_pool_low IS 'Register-pure (LOW) slice of cpt_pool — register-LoRA training only, never a CPT substitute.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.lora_pool_mid AS |
| SELECT content_hash, |
| kind, |
| lang, |
| source, |
| minhash, |
| embedding, |
| sprapp_filter_score, |
| sprapp_filter_flagged, |
| quarantined, |
| verify_status, |
| register, |
| promoted, |
| blob_path, |
| row_len_chars, |
| created_at, |
| near_dup_of, |
| textbook_quality, |
| cultural_nuance, |
| cultural_markers, |
| minhash_algo, |
| license, |
| review_score, |
| generated_by_model, |
| reviewed_by_model, |
| generation_score, |
| structural_quality, |
| structural_signals, |
| split, |
| perplexity, |
| quality_tier, |
| composite_score, |
| composite_profile, |
| contaminated, |
| translated_from, |
| text_inline, |
| model_quality_score, |
| langid_pred, |
| langid_conf, |
| source_id, |
| usage_tags, |
| fts |
| FROM public.cpt_pool |
| WHERE (register = 'MID'::text); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON VIEW public.lora_pool_mid IS 'Register-pure (MID) slice of cpt_pool — register-LoRA training only, never a CPT substitute.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.model_format_spec ( |
| id bigint NOT NULL, |
| model_id text NOT NULL, |
| model_family text NOT NULL, |
| task_type text NOT NULL, |
| assistant_target_template text NOT NULL, |
| think_block_convention text, |
| eval_harness_ref text, |
| direction text, |
| example text, |
| notes text, |
| created_at timestamp with time zone DEFAULT now() NOT NULL, |
| updated_at timestamp with time zone DEFAULT now() NOT NULL, |
| CONSTRAINT model_format_spec_think_block_convention_check CHECK ((think_block_convention = ANY (ARRAY['none'::text, 'empty_marker_kept'::text, 'stripped_at_eval'::text, 'pending_verify'::text]))) |
| ); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON TABLE public.model_format_spec IS 'Per-(model_id, task_type) assistant-target output-format registry. Generation + pretok pipelines look up the exact required output shape + eval-parse contract here so we never train the wrong assistant-target format. See header of pipeline/model_format_spec_schema.sql for the Nanbeige-3B SEA-HELM bug it encodes.'; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON COLUMN public.model_format_spec.assistant_target_template IS 'Exact assistant-target output shape. {text} is the model-generated payload slot. Literal sentinels like ''clean-answer-no-think-prefix'' / ''rowc.selfscaffold.v1'' name a format contract rather than a fill template.'; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON COLUMN public.model_format_spec.think_block_convention IS 'How the <think>...</think> block is handled in the assistant target: ''none'' = no think block at all (clean answer only); ''empty_marker_kept'' = the empty "<think>\n\n</think>\n\n" marker is intentionally retained but MUST be stripped by the parser and never leak into the parsed answer; ''stripped_at_eval'' = think block present in the SFT target but removed before the harness parses; ''pending_verify'' = convention not yet decided — the verify stream chooses ''none'' vs ''empty_marker_kept''; current live state is the leak BUG.'; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON COLUMN public.model_format_spec.direction IS 'Translation direction (source->target), e.g. ''ms->en''. NULL for non-directional axes.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE SEQUENCE public.model_format_spec_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1; |
|
|
|
|
| |
| |
| |
|
|
| ALTER SEQUENCE public.model_format_spec_id_seq OWNED BY public.model_format_spec.id; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.models ( |
| id smallint NOT NULL, |
| name text NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.models ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.models_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.ms_train_gold AS |
| SELECT content_hash, |
| kind, |
| lang, |
| source, |
| minhash, |
| embedding, |
| sprapp_filter_score, |
| sprapp_filter_flagged, |
| quarantined, |
| verify_status, |
| register, |
| promoted, |
| blob_path, |
| row_len_chars, |
| created_at, |
| near_dup_of, |
| textbook_quality, |
| cultural_nuance, |
| cultural_markers, |
| minhash_algo, |
| license, |
| review_score, |
| generated_by_model, |
| reviewed_by_model, |
| generation_score, |
| structural_quality, |
| structural_signals, |
| split, |
| perplexity, |
| quality_tier, |
| composite_score, |
| composite_profile, |
| contaminated, |
| translated_from, |
| text_inline, |
| model_quality_score, |
| langid_pred, |
| langid_conf |
| FROM public.samples |
| WHERE ((lang = 'ms'::text) AND (split = 'train'::text) AND (NOT contaminated) AND (NOT quarantined) AND (near_dup_of IS NULL) AND (verify_status IS DISTINCT FROM 'fail'::text) AND ((structural_quality IS NULL) OR (structural_quality >= (0.5)::double precision)) AND (license = ANY (ARRAY['Apache-2.0'::text, 'MIT'::text, 'CC0'::text, 'CC-BY-4.0'::text, 'ODC-By-1.0'::text]))); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.near_dup_scan_progress ( |
| id integer NOT NULL, |
| table_name text NOT NULL, |
| kind text, |
| lang text, |
| source text, |
| label_provenance text, |
| minhash_algo text NOT NULL, |
| threshold double precision NOT NULL, |
| row_count integer, |
| dup_marked integer, |
| started_at timestamp with time zone DEFAULT now(), |
| finished_at timestamp with time zone, |
| status text DEFAULT 'running'::text |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE SEQUENCE public.near_dup_scan_progress_id_seq |
| AS integer |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1; |
|
|
|
|
| |
| |
| |
|
|
| ALTER SEQUENCE public.near_dup_scan_progress_id_seq OWNED BY public.near_dup_scan_progress.id; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.parked_datasets ( |
| id smallint NOT NULL, |
| hf_repo text NOT NULL, |
| name text NOT NULL, |
| decline_reason text, |
| decline_category text, |
| cleanroom_viable boolean, |
| cleanroom_notes text, |
| cleanroom_output_source text, |
| discovered_date date, |
| reviewed_by text DEFAULT 'agent-review'::text, |
| CONSTRAINT parked_datasets_decline_category_check CHECK ((decline_category = ANY (ARRAY['license-unclear'::text, 'language-mismatch'::text, 'synthetic-competing-weights'::text, 'other'::text]))) |
| ); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.parked_datasets ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.parked_datasets_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.pii_composition AS |
| SELECT lang, |
| unnest(pii_types) AS pii_type, |
| count(*) AS n |
| FROM public.samples |
| WHERE (pii_detected = true) |
| GROUP BY lang, (unnest(pii_types)) |
| ORDER BY (count(*)) DESC; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.processing_state ( |
| content_hash text NOT NULL, |
| tbl text NOT NULL, |
| pass_name text NOT NULL, |
| pass_version text NOT NULL, |
| status text DEFAULT 'done'::text NOT NULL, |
| detail text, |
| updated_at timestamp with time zone DEFAULT now() |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.quality_profiles ( |
| name text NOT NULL, |
| weights jsonb NOT NULL, |
| description text, |
| is_active boolean DEFAULT false, |
| created_at timestamp with time zone DEFAULT now() |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.quality_tiers ( |
| id smallint NOT NULL, |
| name text NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.quality_tiers ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.quality_tiers_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.rag_pool AS |
| SELECT content_hash, |
| kind, |
| lang, |
| source, |
| minhash, |
| embedding, |
| sprapp_filter_score, |
| sprapp_filter_flagged, |
| quarantined, |
| verify_status, |
| register, |
| promoted, |
| blob_path, |
| row_len_chars, |
| created_at, |
| near_dup_of, |
| textbook_quality, |
| cultural_nuance, |
| cultural_markers, |
| minhash_algo, |
| license, |
| review_score, |
| generated_by_model, |
| reviewed_by_model, |
| generation_score, |
| structural_quality, |
| structural_signals, |
| split, |
| perplexity, |
| quality_tier, |
| composite_score, |
| composite_profile, |
| contaminated, |
| translated_from, |
| text_inline, |
| model_quality_score, |
| langid_pred, |
| langid_conf, |
| source_id, |
| usage_tags, |
| fts |
| FROM public.samples |
| WHERE (((kind = ANY (ARRAY['encyclopedic'::text, 'news'::text, 'cultural'::text])) OR (source ~~* '%wiki%'::text) OR (source ~~* '%fineweb%'::text) OR (source ~~* '%news%'::text)) AND (embedding IS NOT NULL) AND (COALESCE(quarantined, false) = false) AND (COALESCE(contaminated, false) = false)); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON VIEW public.rag_pool IS 'RAG retrieval pool: kind in (encyclopedic,news,cultural) OR source matches known factual-crawl patterns (wiki/fineweb/news), requires embedding NOT NULL. NOTE: as of 2026-07-04 no rows carry kind=encyclopedic/news yet (legacy ingests labelled webtext/unknown) — the source-pattern clause is the effective filter today; re-tag `kind` upstream to tighten.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE UNLOGGED TABLE public.reg_backfill_staging ( |
| content_hash text NOT NULL, |
| register text NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.registers ( |
| id smallint NOT NULL, |
| name text NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.registers ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.registers_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.restricted_corpus_hashes ( |
| shingle_hash text NOT NULL, |
| source_name text NOT NULL, |
| source_kind text DEFAULT 'parked_dataset'::text NOT NULL, |
| added_at timestamp with time zone DEFAULT now(), |
| notes text |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.review_batch_rows ( |
| batch_id text NOT NULL, |
| content_hash text NOT NULL, |
| "position" integer NOT NULL, |
| reviewed boolean DEFAULT false NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON TABLE public.review_batch_rows IS 'The (up to 165) content_hash rows assigned to one batch, in sampled order (position). reviewed flips to TRUE once the reviewer submits a score for that row via POST /survey/submit, which also writes the real score into the existing `reviews` table (pipeline/reviews_schema.sql) — this table is purely batch/progress bookkeeping, never the score of record.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.review_batches ( |
| batch_id text NOT NULL, |
| created_at timestamp with time zone DEFAULT now() NOT NULL, |
| created_by text NOT NULL, |
| dimension text DEFAULT 'overall'::text NOT NULL, |
| rubric_version text DEFAULT 'r1'::text NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON TABLE public.review_batches IS 'One row per calibration-survey session a human reviewer starts. A reviewer with an incomplete batch (unreviewed rows remain) resumes it rather than getting a fresh 165-row sample — see serving/perahu_survey.py get_or_create_batch().'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.reviews ( |
| id bigint NOT NULL, |
| content_hash text NOT NULL, |
| judge smallint NOT NULL, |
| dimension public.review_dimension DEFAULT 'overall'::public.review_dimension NOT NULL, |
| score double precision NOT NULL, |
| reason text, |
| rubric_version text DEFAULT 'r1'::text NOT NULL, |
| created_at timestamp with time zone DEFAULT now() NOT NULL, |
| CONSTRAINT reviews_score_check CHECK (((score >= (0)::double precision) AND (score <= (1)::double precision))) |
| ); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON TABLE public.reviews IS 'Multi-judge, multi-dimension review layer. Many rows per content_hash (one per judge x dimension x rubric_version). samples.review_score / samples.reviewed_by_model are a CACHED AGGREGATE of the overall-dimension consensus (see review_consensus view + reviews_helper.refresh_review_score_cache) - kept for backward compat, THIS TABLE is the source of truth going forward.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.review_consensus AS |
| SELECT content_hash, |
| dimension, |
| rubric_version, |
| count(*) AS n_judges, |
| avg(score) AS avg_score, |
| percentile_cont((0.5)::double precision) WITHIN GROUP (ORDER BY score) AS median_score, |
| stddev_samp(score) AS score_stddev |
| FROM public.reviews |
| GROUP BY content_hash, dimension, rubric_version; |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON VIEW public.review_consensus IS 'Per (content_hash, dimension, rubric_version) aggregate across all judges: n_judges, avg/median score, stddev as a disagreement measure (NULL with a single judge). samples.review_score is refreshed FROM this view''s dimension=''overall'' rows — see reviews_helper.refresh_review_score_cache().'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.review_disagreement AS |
| SELECT content_hash, |
| dimension, |
| rubric_version, |
| n_judges, |
| avg_score, |
| median_score, |
| score_stddev |
| FROM public.review_consensus |
| WHERE ((n_judges >= 2) AND (score_stddev > (0.15)::double precision)); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON VIEW public.review_disagreement IS 'Ambiguity queue: (content_hash, dimension, rubric_version) cells where >=2 judges scored the same row and disagree by stddev > 0.15. Feeds active_learning_sample.py as a review-priority signal (judges disagreeing is itself informative — these rows are the ones worth a tie-breaking human/LLM pass or extra scrutiny before promotion).'; |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.reviews ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.reviews_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.rl_coding_rollouts ( |
| rollout_id bigint NOT NULL, |
| task_id text NOT NULL, |
| trajectory_id text, |
| format text DEFAULT 'rowc.selfscaffold.v1'::text, |
| role_in_dataset text, |
| model_checkpoint text, |
| training_step bigint, |
| behavior_step bigint, |
| staleness integer, |
| staleness_weight real, |
| trajectory_blob_path text, |
| scaffold_text text, |
| rollout_trace text, |
| stage1_token_count integer, |
| stage2_token_count integer, |
| obs_token_count integer, |
| trainable_token_count integer, |
| milestone_reached smallint, |
| milestone_bitmap smallint, |
| milestone_after_last smallint, |
| reward_dense real, |
| reward_milestones jsonb, |
| reward_verifier real, |
| reward_judge real, |
| reward_total real, |
| grpo_group_id text, |
| advantage real, |
| stage1_credit_weight real DEFAULT 1.0, |
| stage2_credit_weight real DEFAULT 1.0, |
| flagged_cheating text, |
| cheating_layer smallint, |
| excluded_from_advantage boolean DEFAULT false, |
| env_run_id text, |
| created_at timestamp with time zone DEFAULT now(), |
| ingest_origin text |
| ); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.rl_coding_rollouts ALTER COLUMN rollout_id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.rl_coding_rollouts_rollout_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.rl_coding_tasks ( |
| task_id text NOT NULL, |
| source_id smallint, |
| repo_url text NOT NULL, |
| repo_license text, |
| base_commit text NOT NULL, |
| generator_method text, |
| task_description text NOT NULL, |
| category text, |
| difficulty text, |
| language text, |
| test_command text NOT NULL, |
| failing_test_ids text[], |
| passing_test_ids text[], |
| gold_patch text, |
| gold_patch_source_model smallint, |
| harness_type text, |
| harness_ref text, |
| env_verified boolean DEFAULT false, |
| license_ok boolean, |
| build_command text, |
| lint_command text, |
| typecheck_command text, |
| k_of_n_threshold smallint, |
| milestone_weights jsonb, |
| test_report_format text, |
| withheld_paths text[], |
| trust_boundary_ref text, |
| allowed_tool_surface jsonb, |
| scaffold_seed text, |
| ingested_at timestamp with time zone DEFAULT now(), |
| notes text, |
| seed_key text |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.safety_checks ( |
| check_id bigint NOT NULL, |
| content_hash text NOT NULL, |
| arm text NOT NULL, |
| classifier text NOT NULL, |
| classifier_version text, |
| verdict text NOT NULL, |
| categories text[], |
| score double precision, |
| input_text_sha text, |
| translator text DEFAULT 'none'::text NOT NULL, |
| translator_version text, |
| check_method text NOT NULL, |
| run_id text NOT NULL, |
| checked_by text NOT NULL, |
| ingest_origin text NOT NULL, |
| checked_at timestamp with time zone DEFAULT now() NOT NULL, |
| notes text |
| ); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON TABLE public.safety_checks IS 'Standardized external + internal safety-classifier verdicts over the Malay corpus. Signal-only (never a gate); LICENSE-SAFE: Aegis/Nemotron verdicts are eval/filter signals, NOT trained into model weights (Llama2/Gemma ToS non-compete). One row = (sample, arm, classifier, run). arm=raw_ms vs translated_en is the bias probe; eval_gold_en = Aegis own test split for calibration F1. checked_by/check_method/classifier_version/translator standardize the "checked/by-who/how" provenance. See docs/SAFETY_CROSSCHECK_PIPELINE.md.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.safety_check_by_register AS |
| SELECT s.register, |
| sc.classifier, |
| sc.arm, |
| count(*) AS n, |
| count(*) FILTER (WHERE (sc.verdict = 'unsafe'::text)) AS n_unsafe, |
| COALESCE(avg( |
| CASE |
| WHEN (sc.verdict = 'unsafe'::text) THEN 1.0 |
| ELSE 0.0 |
| END), 0.0) AS unsafe_rate |
| FROM (public.safety_checks sc |
| JOIN public.samples s ON ((s.content_hash = sc.content_hash))) |
| WHERE (sc.arm = ANY (ARRAY['raw_ms'::text, 'translated_en'::text])) |
| GROUP BY s.register, sc.classifier, sc.arm |
| ORDER BY s.register, sc.classifier, sc.arm; |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.safety_check_composition AS |
| SELECT classifier, |
| arm, |
| verdict, |
| count(*) AS n |
| FROM public.safety_checks |
| GROUP BY classifier, arm, verdict |
| ORDER BY classifier, arm, verdict; |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.safety_check_disagreement AS |
| SELECT a.content_hash, |
| a.arm, |
| a.run_id, |
| a.classifier AS clf_a, |
| a.verdict AS verdict_a, |
| b.classifier AS clf_b, |
| b.verdict AS verdict_b, |
| s.register, |
| s.source, |
| s.lang |
| FROM ((public.safety_checks a |
| JOIN public.safety_checks b ON (((a.content_hash = b.content_hash) AND (a.arm = b.arm) AND (a.run_id = b.run_id) AND (a.classifier < b.classifier)))) |
| JOIN public.samples s ON ((s.content_hash = a.content_hash))) |
| WHERE ((a.verdict = 'unsafe'::text) <> (b.verdict = 'unsafe'::text)) |
| ORDER BY a.content_hash; |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.safety_check_raw_vs_translated AS |
| SELECT sc.classifier, |
| sc.run_id, |
| count(*) AS n, |
| count(*) FILTER (WHERE ((raw.verdict = 'unsafe'::text) AND (tr.verdict = 'unsafe'::text))) AS both_unsafe, |
| count(*) FILTER (WHERE ((raw.verdict <> 'unsafe'::text) AND (tr.verdict <> 'unsafe'::text))) AS both_other, |
| count(*) FILTER (WHERE ((raw.verdict = 'unsafe'::text) AND (tr.verdict <> 'unsafe'::text))) AS raw_only_unsafe, |
| count(*) FILTER (WHERE ((raw.verdict <> 'unsafe'::text) AND (tr.verdict = 'unsafe'::text))) AS trans_only_unsafe |
| FROM ((public.safety_checks sc |
| JOIN public.safety_checks raw ON (((raw.content_hash = sc.content_hash) AND (raw.classifier = sc.classifier) AND (raw.run_id = sc.run_id) AND (raw.arm = 'raw_ms'::text)))) |
| JOIN public.safety_checks tr ON (((tr.content_hash = sc.content_hash) AND (tr.classifier = sc.classifier) AND (tr.run_id = sc.run_id) AND (tr.arm = 'translated_en'::text)))) |
| GROUP BY sc.classifier, sc.run_id |
| ORDER BY sc.classifier, sc.run_id; |
|
|
|
|
| |
| |
| |
|
|
| CREATE SEQUENCE public.safety_checks_check_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1; |
|
|
|
|
| |
| |
| |
|
|
| ALTER SEQUENCE public.safety_checks_check_id_seq OWNED BY public.safety_checks.check_id; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.sample_edits_staging ( |
| id bigint NOT NULL, |
| content_hash text NOT NULL, |
| field_name text NOT NULL, |
| old_value text, |
| new_value text NOT NULL, |
| edited_by text NOT NULL, |
| status text DEFAULT 'pending'::text NOT NULL, |
| created_at timestamp with time zone DEFAULT now() NOT NULL, |
| reviewed_at timestamp with time zone, |
| reviewed_by text, |
| CONSTRAINT sample_edits_staging_status_check CHECK ((status = ANY (ARRAY['pending'::text, 'approved'::text, 'rejected'::text, 'applied'::text]))) |
| ); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON TABLE public.sample_edits_staging IS 'Google-Sign-In-gated manual field-edit staging queue. pending -> approved|rejected -> applied (applied performs the actual `UPDATE samples`). Distinct from the older username/password review_edits table (pipeline/review_edits_schema.sql) — see this file''s header for why they are kept separate.'; |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.sample_edits_staging ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.sample_edits_staging_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.sample_feedback ( |
| id bigint NOT NULL, |
| content_hash text NOT NULL, |
| reporter text, |
| issue text NOT NULL, |
| detail text, |
| created_at timestamp with time zone DEFAULT now() NOT NULL, |
| resolved boolean DEFAULT false NOT NULL, |
| CONSTRAINT sample_feedback_issue_check CHECK ((issue = ANY (ARRAY['garbage'::text, 'wrong_lang'::text, 'license_concern'::text, 'factual_error'::text, 'quality'::text, 'other'::text]))) |
| ); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON TABLE public.sample_feedback IS 'Consumer-reported issues against a content_hash. Fed by serving API POST /feedback (open) and drained via GET /feedback?unresolved=1 (auth). Wiring TODO: unresolved rows should feed pipeline/active_learning_sample.pyas a review-priority queue — not yet wired, see CURATION_DOCTRINE.md "Trust layer" section.'; |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.sample_feedback ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.sample_feedback_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.search_pool AS |
| SELECT content_hash, |
| kind, |
| lang, |
| source, |
| minhash, |
| embedding, |
| sprapp_filter_score, |
| sprapp_filter_flagged, |
| quarantined, |
| verify_status, |
| register, |
| promoted, |
| blob_path, |
| row_len_chars, |
| created_at, |
| near_dup_of, |
| textbook_quality, |
| cultural_nuance, |
| cultural_markers, |
| minhash_algo, |
| license, |
| review_score, |
| generated_by_model, |
| reviewed_by_model, |
| generation_score, |
| structural_quality, |
| structural_signals, |
| split, |
| perplexity, |
| quality_tier, |
| composite_score, |
| composite_profile, |
| contaminated, |
| translated_from, |
| text_inline, |
| model_quality_score, |
| langid_pred, |
| langid_conf, |
| source_id, |
| usage_tags, |
| fts |
| FROM public.samples |
| WHERE (embedding IS NOT NULL); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON VIEW public.search_pool IS 'Offline semantic search index pool: embedding NOT NULL, ANY license — internal search/browse use only, must never be exported as a training or redistribution artifact regardless of license.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.selection_algorithms ( |
| name text NOT NULL, |
| description text NOT NULL, |
| target_use_case text NOT NULL, |
| script_reference text, |
| params_schema jsonb DEFAULT '{}'::jsonb NOT NULL, |
| created_at timestamp with time zone DEFAULT now() NOT NULL, |
| CONSTRAINT selection_algorithms_target_use_case_check CHECK ((target_use_case = ANY (ARRAY['CPT'::text, 'SFT'::text, 'quant-calibration'::text, 'eval-heldout'::text, 'RAG'::text, 'other'::text]))) |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.sft_pool AS |
| SELECT content_hash, |
| kind, |
| lang, |
| source, |
| minhash, |
| embedding, |
| sprapp_filter_score, |
| sprapp_filter_flagged, |
| quarantined, |
| verify_status, |
| register, |
| promoted, |
| blob_path, |
| row_len_chars, |
| created_at, |
| near_dup_of, |
| textbook_quality, |
| cultural_nuance, |
| cultural_markers, |
| minhash_algo, |
| license, |
| review_score, |
| generated_by_model, |
| reviewed_by_model, |
| generation_score, |
| structural_quality, |
| structural_signals, |
| split, |
| perplexity, |
| quality_tier, |
| composite_score, |
| composite_profile, |
| contaminated, |
| translated_from, |
| text_inline, |
| model_quality_score, |
| langid_pred, |
| langid_conf, |
| source_id, |
| usage_tags, |
| fts |
| FROM public.samples |
| WHERE ((kind = ANY (ARRAY['d1-logic'::text, 'd1-plan'::text, 'd1-math'::text, 'd1-estimate'::text, 'd2-openbook'::text, 'd3-tool'::text, 'd5-code'::text, 'long-form'::text])) AND ((verify_status = 'pass'::text) OR (verify_status IS NULL)) AND (COALESCE(review_score, model_quality_score, (0)::double precision) >= (0.6)::double precision) AND (license = ANY (ARRAY['Apache-2.0'::text, 'MIT'::text, 'CC0-1.0'::text])) AND (COALESCE(quarantined, false) = false) AND (COALESCE(contaminated, false) = false)); |
|
|
|
|
| |
| |
| |
|
|
| COMMENT ON VIEW public.sft_pool IS 'SFT pool: reasoning/code/tool/plan/estimate/long-form kinds, verify pass-or-null (verify_filter has not run on every kind), review_score (human) else model_quality_score >= 0.6, not quarantined/contaminated. License whitelist per 2026-07-04 policy ruling is STRICT (narrower than cpt_pool): Apache-2.0, MIT, CC0-1.0 only — no attribution/ShareAlike-encumbered licenses (ODC-By/CC-BY*) in SFT data, since instruction-tuned responses ship closer to end users and are harder to trace attribution obligations through.'; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.shards ( |
| id integer NOT NULL, |
| path text NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.shards ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.shards_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.sources ( |
| id smallint NOT NULL, |
| name text NOT NULL, |
| origin_url text, |
| hf_repo text, |
| upstream_version text, |
| license text, |
| license_url text, |
| retrieval_date date, |
| method text, |
| notes text |
| ); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.sources ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.sources_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.splits ( |
| id smallint NOT NULL, |
| name text NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE public.splits ALTER COLUMN id ADD GENERATED ALWAYS AS IDENTITY ( |
| SEQUENCE NAME public.splits_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1 |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.sprapp_filter_categories ( |
| idx smallint NOT NULL, |
| name text NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.sprapp_filter_corpus ( |
| content_hash text NOT NULL, |
| text text NOT NULL, |
| expected_decision text, |
| expected_categories smallint[], |
| lineage text, |
| source text NOT NULL, |
| split text, |
| label_provenance text, |
| minhash bigint[], |
| embedding public.vector(768), |
| created_at timestamp with time zone DEFAULT now(), |
| id bigint NOT NULL, |
| near_dup_of bigint, |
| minhash_algo text DEFAULT 'datasketch_v1'::text, |
| license text DEFAULT 'proprietary-internal'::text, |
| lang text, |
| review_score double precision, |
| generated_by_model smallint, |
| reviewed_by_model smallint, |
| generation_score double precision, |
| ingest_origin text |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.sprapp_filter_composition AS |
| SELECT source, |
| split, |
| expected_decision, |
| count(*) AS n, |
| count(*) FILTER (WHERE (near_dup_of IS NOT NULL)) AS n_near_dup |
| FROM public.sprapp_filter_corpus |
| GROUP BY source, split, expected_decision |
| ORDER BY (count(*)) DESC; |
|
|
|
|
| |
| |
| |
|
|
| CREATE SEQUENCE public.sprapp_filter_corpus_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1; |
|
|
|
|
| |
| |
| |
|
|
| ALTER SEQUENCE public.sprapp_filter_corpus_id_seq OWNED BY public.sprapp_filter_corpus.id; |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.sprapp_filter_corpus_named AS |
| SELECT content_hash, |
| text, |
| expected_decision, |
| expected_categories, |
| lineage, |
| source, |
| split, |
| label_provenance, |
| minhash, |
| embedding, |
| created_at, |
| id, |
| near_dup_of, |
| ARRAY( SELECT c.name |
| FROM (unnest(f.expected_categories) cat_idx(cat_idx) |
| JOIN public.sprapp_filter_categories c ON ((c.idx = cat_idx.cat_idx)))) AS category_names |
| FROM public.sprapp_filter_corpus f; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.tb_st_backfill_checkpoint ( |
| shard text NOT NULL, |
| rows_seen integer NOT NULL, |
| rows_updated integer NOT NULL, |
| elapsed_s real NOT NULL, |
| done_at timestamp with time zone DEFAULT now() NOT NULL |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.training_run_datasets ( |
| id bigint NOT NULL, |
| run_id uuid NOT NULL, |
| snapshot_name text NOT NULL, |
| row_count_used bigint, |
| percent_of_total_mix numeric(6,3), |
| role text |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE SEQUENCE public.training_run_datasets_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1; |
|
|
|
|
| |
| |
| |
|
|
| ALTER SEQUENCE public.training_run_datasets_id_seq OWNED BY public.training_run_datasets.id; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.training_run_results ( |
| id bigint NOT NULL, |
| run_id uuid NOT NULL, |
| benchmark_name text NOT NULL, |
| metric_name text NOT NULL, |
| metric_value double precision NOT NULL, |
| eval_date date, |
| eval_methodology_notes text |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE SEQUENCE public.training_run_results_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1; |
|
|
|
|
| |
| |
| |
|
|
| ALTER SEQUENCE public.training_run_results_id_seq OWNED BY public.training_run_results.id; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.training_run_unverified_datasets ( |
| id bigint NOT NULL, |
| run_id uuid NOT NULL, |
| claimed_snapshot_name text NOT NULL, |
| row_count_used bigint, |
| percent_of_total_mix numeric(6,3), |
| role text |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE SEQUENCE public.training_run_unverified_datasets_id_seq |
| START WITH 1 |
| INCREMENT BY 1 |
| NO MINVALUE |
| NO MAXVALUE |
| CACHE 1; |
|
|
|
|
| |
| |
| |
|
|
| ALTER SEQUENCE public.training_run_unverified_datasets_id_seq OWNED BY public.training_run_unverified_datasets.id; |
|
|
|
|
| |
| |
| |
|
|
| CREATE TABLE public.training_runs ( |
| run_id uuid DEFAULT gen_random_uuid() NOT NULL, |
| submitted_at timestamp with time zone DEFAULT now() NOT NULL, |
| submitter_org text, |
| submitter_contact text, |
| model_name text NOT NULL, |
| architecture text, |
| base_model text, |
| training_type text NOT NULL, |
| framework text, |
| hardware text, |
| seeds jsonb DEFAULT '{}'::jsonb NOT NULL, |
| hyperparameters jsonb DEFAULT '{}'::jsonb NOT NULL, |
| status text DEFAULT 'pending_verification'::text NOT NULL, |
| verification_notes text, |
| notes text, |
| CONSTRAINT training_runs_status_check CHECK ((status = ANY (ARRAY['pending_verification'::text, 'verified'::text, 'rejected'::text]))), |
| CONSTRAINT training_runs_training_type_check CHECK ((training_type = ANY (ARRAY['CPT'::text, 'SFT'::text, 'RLHF'::text, 'DPO'::text, 'continued-pretrain'::text, 'other'::text]))) |
| ); |
|
|
|
|
| |
| |
| |
|
|
| CREATE VIEW public.zero_attrib_clean AS |
| SELECT content_hash, |
| kind, |
| lang, |
| source, |
| minhash, |
| embedding, |
| sprapp_filter_score, |
| sprapp_filter_flagged, |
| quarantined, |
| verify_status, |
| register, |
| promoted, |
| blob_path, |
| row_len_chars, |
| created_at, |
| near_dup_of, |
| textbook_quality, |
| cultural_nuance, |
| cultural_markers, |
| minhash_algo, |
| license, |
| review_score, |
| generated_by_model, |
| reviewed_by_model, |
| generation_score, |
| structural_quality, |
| structural_signals, |
| split, |
| perplexity, |
| quality_tier, |
| composite_score, |
| composite_profile, |
| contaminated, |
| translated_from, |
| text_inline, |
| model_quality_score, |
| langid_pred, |
| langid_conf, |
| source_id, |
| usage_tags, |
| fts, |
| minhash_packed, |
| embedding_h, |
| shard_id, |
| kind_id, |
| lang_id, |
| license_id, |
| register_id, |
| quality_tier_id, |
| split_id, |
| gen_temperature, |
| gen_max_tokens, |
| gen_repeat_penalty, |
| gen_seed, |
| gen_provider, |
| gen_quantization, |
| gen_prompt_variant, |
| pipeline_status, |
| pipeline_status_updated_at, |
| pipeline_status_reason, |
| restricted_overlap, |
| restricted_overlap_source, |
| capability_tags, |
| pii_detected, |
| pii_types, |
| input_tokens, |
| output_tokens, |
| token_count, |
| token_count_tokenizer, |
| best_of_n_score, |
| cpt_eligible, |
| sft_eligible, |
| ingest_origin |
| FROM public.samples |
| WHERE ((license = ANY (ARRAY['Apache-2.0'::text, 'MIT'::text, 'CC0'::text, 'BSD-3-Clause'::text])) AND (source !~~* '%minimax%'::text)); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.model_format_spec ALTER COLUMN id SET DEFAULT nextval('public.model_format_spec_id_seq'::regclass); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.near_dup_scan_progress ALTER COLUMN id SET DEFAULT nextval('public.near_dup_scan_progress_id_seq'::regclass); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.safety_checks ALTER COLUMN check_id SET DEFAULT nextval('public.safety_checks_check_id_seq'::regclass); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.sprapp_filter_corpus ALTER COLUMN id SET DEFAULT nextval('public.sprapp_filter_corpus_id_seq'::regclass); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.training_run_datasets ALTER COLUMN id SET DEFAULT nextval('public.training_run_datasets_id_seq'::regclass); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.training_run_results ALTER COLUMN id SET DEFAULT nextval('public.training_run_results_id_seq'::regclass); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.training_run_unverified_datasets ALTER COLUMN id SET DEFAULT nextval('public.training_run_unverified_datasets_id_seq'::regclass); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.backfill_progress |
| ADD CONSTRAINT backfill_progress_pkey PRIMARY KEY (pass_name, blob_path); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.chunks |
| ADD CONSTRAINT chunks_pkey PRIMARY KEY (chunk_hash); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.coldstart_coding_rollouts |
| ADD CONSTRAINT coldstart_coding_rollouts_content_hash_key UNIQUE (content_hash); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.coldstart_coding_rollouts |
| ADD CONSTRAINT coldstart_coding_rollouts_pkey PRIMARY KEY (rollout_id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.coldstart_coding_rollouts |
| ADD CONSTRAINT coldstart_coding_rollouts_trajectory_id_key UNIQUE (trajectory_id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.contamination_hashes |
| ADD CONSTRAINT contamination_hashes_pkey PRIMARY KEY (content_hash); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.corpus_snapshot_members |
| ADD CONSTRAINT corpus_snapshot_members_pkey PRIMARY KEY (snapshot, content_hash); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.corpus_snapshots |
| ADD CONSTRAINT corpus_snapshots_pkey PRIMARY KEY (name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.corpus_version |
| ADD CONSTRAINT corpus_version_pkey PRIMARY KEY (version); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.kb_documents |
| ADD CONSTRAINT kb_documents_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.kinds |
| ADD CONSTRAINT kinds_name_key UNIQUE (name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.kinds |
| ADD CONSTRAINT kinds_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.label_audit |
| ADD CONSTRAINT label_audit_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.lang_quality_config |
| ADD CONSTRAINT lang_quality_config_pkey PRIMARY KEY (lang); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.langs |
| ADD CONSTRAINT langs_name_key UNIQUE (name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.langs |
| ADD CONSTRAINT langs_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.licenses |
| ADD CONSTRAINT licenses_name_key UNIQUE (name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.licenses |
| ADD CONSTRAINT licenses_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.model_format_spec |
| ADD CONSTRAINT model_format_spec_model_id_task_type_key UNIQUE (model_id, task_type); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.model_format_spec |
| ADD CONSTRAINT model_format_spec_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.models |
| ADD CONSTRAINT models_name_key UNIQUE (name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.models |
| ADD CONSTRAINT models_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.near_dup_scan_progress |
| ADD CONSTRAINT near_dup_scan_progress_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.near_dup_scan_progress |
| ADD CONSTRAINT near_dup_scan_progress_table_name_kind_lang_source_label_pr_key UNIQUE (table_name, kind, lang, source, label_provenance, minhash_algo, threshold); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.parked_datasets |
| ADD CONSTRAINT parked_datasets_hf_repo_key UNIQUE (hf_repo); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.parked_datasets |
| ADD CONSTRAINT parked_datasets_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.processing_state |
| ADD CONSTRAINT processing_state_pkey PRIMARY KEY (content_hash, tbl, pass_name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.quality_profiles |
| ADD CONSTRAINT quality_profiles_pkey PRIMARY KEY (name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.quality_tiers |
| ADD CONSTRAINT quality_tiers_name_key UNIQUE (name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.quality_tiers |
| ADD CONSTRAINT quality_tiers_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.reg_backfill_staging |
| ADD CONSTRAINT reg_backfill_staging_pkey PRIMARY KEY (content_hash); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.registers |
| ADD CONSTRAINT registers_name_key UNIQUE (name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.registers |
| ADD CONSTRAINT registers_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.restricted_corpus_hashes |
| ADD CONSTRAINT restricted_corpus_hashes_pkey PRIMARY KEY (shingle_hash, source_name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.review_batch_rows |
| ADD CONSTRAINT review_batch_rows_pkey PRIMARY KEY (batch_id, content_hash); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.review_batches |
| ADD CONSTRAINT review_batches_pkey PRIMARY KEY (batch_id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.reviews |
| ADD CONSTRAINT reviews_content_hash_judge_dimension_rubric_version_key UNIQUE (content_hash, judge, dimension, rubric_version); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.reviews |
| ADD CONSTRAINT reviews_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.rl_coding_rollouts |
| ADD CONSTRAINT rl_coding_rollouts_pkey PRIMARY KEY (rollout_id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.rl_coding_rollouts |
| ADD CONSTRAINT rl_coding_rollouts_trajectory_id_key UNIQUE (trajectory_id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.rl_coding_tasks |
| ADD CONSTRAINT rl_coding_tasks_pkey PRIMARY KEY (task_id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.safety_checks |
| ADD CONSTRAINT safety_checks_pkey PRIMARY KEY (check_id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.sample_edits_staging |
| ADD CONSTRAINT sample_edits_staging_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.sample_feedback |
| ADD CONSTRAINT sample_feedback_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.samples |
| ADD CONSTRAINT samples_pkey PRIMARY KEY (content_hash); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.selection_algorithms |
| ADD CONSTRAINT selection_algorithms_pkey PRIMARY KEY (name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.shards |
| ADD CONSTRAINT shards_path_key UNIQUE (path); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.shards |
| ADD CONSTRAINT shards_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.sources |
| ADD CONSTRAINT sources_name_key UNIQUE (name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.sources |
| ADD CONSTRAINT sources_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.splits |
| ADD CONSTRAINT splits_name_key UNIQUE (name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.splits |
| ADD CONSTRAINT splits_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.sprapp_filter_categories |
| ADD CONSTRAINT sprapp_filter_categories_name_key UNIQUE (name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.sprapp_filter_categories |
| ADD CONSTRAINT sprapp_filter_categories_pkey PRIMARY KEY (idx); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.sprapp_filter_corpus |
| ADD CONSTRAINT sprapp_filter_corpus_hash_provenance_uniq UNIQUE (content_hash, label_provenance); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.sprapp_filter_corpus |
| ADD CONSTRAINT sprapp_filter_corpus_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.tb_st_backfill_checkpoint |
| ADD CONSTRAINT tb_st_backfill_checkpoint_pkey PRIMARY KEY (shard); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.training_run_datasets |
| ADD CONSTRAINT training_run_datasets_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.training_run_results |
| ADD CONSTRAINT training_run_results_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.training_run_unverified_datasets |
| ADD CONSTRAINT training_run_unverified_datasets_pkey PRIMARY KEY (id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.training_runs |
| ADD CONSTRAINT training_runs_pkey PRIMARY KEY (run_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_ccr_domain ON public.coldstart_coding_rollouts USING btree (domain, test_passed); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_ccr_gated ON public.coldstart_coding_rollouts USING btree (test_gated) WHERE test_gated; |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_ccr_source ON public.coldstart_coding_rollouts USING btree (source); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_ccr_teacher ON public.coldstart_coding_rollouts USING btree (teacher_model); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_chunks_kb_doc_id ON public.chunks USING btree (kb_doc_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_chunks_lang ON public.chunks USING btree (lang); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_chunks_parent_hash ON public.chunks USING btree (parent_hash); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_contam_evalset ON public.contamination_hashes USING btree (eval_set); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_corpus_snapshots_selection_algorithm ON public.corpus_snapshots USING btree (selection_algorithm); |
|
|
|
|
| |
| |
| |
|
|
| CREATE UNIQUE INDEX idx_kb_documents_content_hash ON public.kb_documents USING btree (content_hash) WHERE (content_hash IS NOT NULL); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_kb_documents_org ON public.kb_documents USING btree (source_org); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_kb_documents_type ON public.kb_documents USING btree (doc_type); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_label_audit_hash_time ON public.label_audit USING btree (content_hash, changed_at); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_parked_datasets_category ON public.parked_datasets USING btree (decline_category); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_parked_datasets_cleanroom_viable ON public.parked_datasets USING btree (cleanroom_viable); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_procstate_pass ON public.processing_state USING btree (tbl, pass_name, pass_version); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_restricted_hashes_kind ON public.restricted_corpus_hashes USING btree (source_kind); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_restricted_hashes_source ON public.restricted_corpus_hashes USING btree (source_name); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_review_batch_rows_unreviewed ON public.review_batch_rows USING btree (batch_id) WHERE (NOT reviewed); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_review_batches_created_by ON public.review_batches USING btree (created_by); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_reviews_content_hash ON public.reviews USING btree (content_hash); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_reviews_judge_created ON public.reviews USING btree (judge, created_at); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_rl_coding_rollouts_clean ON public.rl_coding_rollouts USING btree (grpo_group_id) WHERE (NOT excluded_from_advantage); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_rl_coding_rollouts_group ON public.rl_coding_rollouts USING btree (grpo_group_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_rl_coding_rollouts_milestone ON public.rl_coding_rollouts USING btree (milestone_reached); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_rl_coding_rollouts_step ON public.rl_coding_rollouts USING btree (training_step); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_rl_coding_rollouts_task ON public.rl_coding_rollouts USING btree (task_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_rl_coding_tasks_category ON public.rl_coding_tasks USING btree (category, difficulty); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_rl_coding_tasks_env_verified ON public.rl_coding_tasks USING btree (env_verified) WHERE env_verified; |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_rl_coding_tasks_license_ok ON public.rl_coding_tasks USING btree (license_ok) WHERE license_ok; |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_rl_coding_tasks_rl_ready ON public.rl_coding_tasks USING btree (env_verified, license_ok) WHERE (env_verified AND license_ok); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_rl_coding_tasks_source ON public.rl_coding_tasks USING btree (source_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_safety_checks_arm ON public.safety_checks USING btree (arm); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_safety_checks_cats ON public.safety_checks USING gin (categories); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_safety_checks_checked_by ON public.safety_checks USING btree (checked_by); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_safety_checks_classifier ON public.safety_checks USING btree (classifier); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_safety_checks_run ON public.safety_checks USING btree (run_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_safety_checks_translator ON public.safety_checks USING btree (translator); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_safety_checks_verdict ON public.safety_checks USING btree (verdict); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sample_edits_staging_content_hash ON public.sample_edits_staging USING btree (content_hash); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sample_edits_staging_status ON public.sample_edits_staging USING btree (status); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sample_feedback_hash ON public.sample_feedback USING btree (content_hash); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sample_feedback_unresolved ON public.sample_feedback USING btree (resolved, created_at) WHERE (NOT resolved); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_analytics_source_cover ON public.samples USING btree (source) INCLUDE (composite_score, textbook_quality, structural_quality, cultural_nuance); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_capability_tags ON public.samples USING gin (capability_tags); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_capability_tags_notnull ON public.samples USING btree (content_hash) WHERE (capability_tags IS NOT NULL); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_composite ON public.samples USING btree (composite_score); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_composition_cover ON public.samples USING btree (kind, lang, source) INCLUDE (promoted, quarantined); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_contaminated ON public.samples USING btree (contaminated) WHERE contaminated; |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_cpt_eligible ON public.samples USING btree (cpt_eligible) WHERE cpt_eligible; |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_cultural_nuance ON public.samples USING btree (cultural_nuance) WHERE cultural_nuance; |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_fts ON public.samples USING gin (fts); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_gen_prompt_variant ON public.samples USING btree (gen_prompt_variant); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_gen_provider ON public.samples USING btree (gen_provider); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_gen_quantization ON public.samples USING btree (gen_quantization); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_generated_by ON public.samples USING btree (generated_by_model); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_input_tokens ON public.samples USING btree (input_tokens) WHERE (input_tokens IS NOT NULL); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_kind_id ON public.samples USING btree (kind_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_kind_lang ON public.samples USING btree (kind, lang); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_lang_id ON public.samples USING btree (lang_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_license ON public.samples USING btree (license); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_license_id ON public.samples USING btree (license_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_model_quality_score ON public.samples USING btree (model_quality_score); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_near_dup ON public.samples USING btree (near_dup_of) WHERE (near_dup_of IS NOT NULL); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_output_tokens ON public.samples USING btree (output_tokens) WHERE (output_tokens IS NOT NULL); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_pii_detected ON public.samples USING btree (pii_detected) WHERE (pii_detected = true); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_pii_detected_full ON public.samples USING btree (pii_detected); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_pii_types ON public.samples USING gin (pii_types); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_pipeline_status ON public.samples USING btree (pipeline_status); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_promoted ON public.samples USING btree (promoted); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_quality_tier ON public.samples USING btree (quality_tier); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_quality_tier_id ON public.samples USING btree (quality_tier_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_quarantined ON public.samples USING btree (quarantined) WHERE quarantined; |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_register ON public.samples USING btree (register); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_register_id ON public.samples USING btree (register_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_restricted_overlap ON public.samples USING btree (restricted_overlap) WHERE restricted_overlap; |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_review_score ON public.samples USING btree (review_score); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_reviewed_by ON public.samples USING btree (reviewed_by_model); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_sft_eligible ON public.samples USING btree (sft_eligible) WHERE sft_eligible; |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_shard_id ON public.samples USING btree (shard_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_source ON public.samples USING btree (source); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_split ON public.samples USING btree (split); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_split_id ON public.samples USING btree (split_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_sprapp_filter_flagged ON public.samples USING gin (sprapp_filter_flagged); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_structural_quality ON public.samples USING btree (structural_quality); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_textbook_quality ON public.samples USING btree (textbook_quality); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_token_count ON public.samples USING btree (token_count) WHERE (token_count IS NOT NULL); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_translated_from ON public.samples USING btree (translated_from) WHERE (translated_from IS NOT NULL); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_samples_usage_tags ON public.samples USING gin (usage_tags); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sfc_categories ON public.sprapp_filter_corpus USING gin (expected_categories); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sfc_content_hash ON public.sprapp_filter_corpus USING btree (content_hash); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sfc_generated_by ON public.sprapp_filter_corpus USING btree (generated_by_model); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sfc_lang ON public.sprapp_filter_corpus USING btree (lang); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sfc_license ON public.sprapp_filter_corpus USING btree (license); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sfc_lineage ON public.sprapp_filter_corpus USING btree (lineage); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sfc_near_dup ON public.sprapp_filter_corpus USING btree (near_dup_of) WHERE (near_dup_of IS NOT NULL); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sfc_review_score ON public.sprapp_filter_corpus USING btree (review_score); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sfc_reviewed_by ON public.sprapp_filter_corpus USING btree (reviewed_by_model); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX idx_sfc_source_split ON public.sprapp_filter_corpus USING btree (source, split); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX rl_coding_rollouts_ingest_origin_idx ON public.rl_coding_rollouts USING btree (ingest_origin); |
|
|
|
|
| |
| |
| |
|
|
| CREATE UNIQUE INDEX safety_checks_uniq ON public.safety_checks USING btree (content_hash, arm, classifier, run_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX samples_ingest_origin_idx ON public.samples USING btree (ingest_origin); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX samples_source_id_idx ON public.samples USING btree (source_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX sprapp_filter_corpus_ingest_origin_idx ON public.sprapp_filter_corpus USING btree (ingest_origin); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX training_runs_model_idx ON public.training_runs USING btree (model_name); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX training_runs_status_idx ON public.training_runs USING btree (status); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX training_runs_submitted_idx ON public.training_runs USING btree (submitted_at DESC); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX trd_run_idx ON public.training_run_datasets USING btree (run_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX trd_snapshot_idx ON public.training_run_datasets USING btree (snapshot_name); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX trr_benchmark_idx ON public.training_run_results USING btree (benchmark_name); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX trr_run_idx ON public.training_run_results USING btree (run_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE INDEX trud_run_idx ON public.training_run_unverified_datasets USING btree (run_id); |
|
|
|
|
| |
| |
| |
|
|
| CREATE TRIGGER trg_model_format_spec_touch BEFORE UPDATE ON public.model_format_spec FOR EACH ROW EXECUTE FUNCTION public.model_format_spec_touch_updated_at(); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.chunks |
| ADD CONSTRAINT chunks_kb_doc_id_fkey FOREIGN KEY (kb_doc_id) REFERENCES public.kb_documents(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.chunks |
| ADD CONSTRAINT chunks_parent_hash_fkey FOREIGN KEY (parent_hash) REFERENCES public.samples(content_hash); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.coldstart_coding_rollouts |
| ADD CONSTRAINT coldstart_coding_rollouts_source_id_fkey FOREIGN KEY (source_id) REFERENCES public.sources(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.coldstart_coding_rollouts |
| ADD CONSTRAINT coldstart_coding_rollouts_teacher_model_id_fkey FOREIGN KEY (teacher_model_id) REFERENCES public.models(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.corpus_snapshot_members |
| ADD CONSTRAINT corpus_snapshot_members_snapshot_fkey FOREIGN KEY (snapshot) REFERENCES public.corpus_snapshots(name) ON DELETE CASCADE; |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.corpus_snapshots |
| ADD CONSTRAINT corpus_snapshots_parent_snapshot_fkey FOREIGN KEY (parent_snapshot) REFERENCES public.corpus_snapshots(name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.corpus_snapshots |
| ADD CONSTRAINT corpus_snapshots_profile_fkey FOREIGN KEY (profile) REFERENCES public.quality_profiles(name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.corpus_snapshots |
| ADD CONSTRAINT corpus_snapshots_selection_algorithm_fkey FOREIGN KEY (selection_algorithm) REFERENCES public.selection_algorithms(name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.review_batch_rows |
| ADD CONSTRAINT review_batch_rows_batch_id_fkey FOREIGN KEY (batch_id) REFERENCES public.review_batches(batch_id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.review_batch_rows |
| ADD CONSTRAINT review_batch_rows_content_hash_fkey FOREIGN KEY (content_hash) REFERENCES public.samples(content_hash); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.reviews |
| ADD CONSTRAINT reviews_content_hash_fkey FOREIGN KEY (content_hash) REFERENCES public.samples(content_hash); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.reviews |
| ADD CONSTRAINT reviews_judge_fkey FOREIGN KEY (judge) REFERENCES public.models(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.rl_coding_rollouts |
| ADD CONSTRAINT rl_coding_rollouts_task_id_fkey FOREIGN KEY (task_id) REFERENCES public.rl_coding_tasks(task_id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.rl_coding_tasks |
| ADD CONSTRAINT rl_coding_tasks_gold_patch_source_model_fkey FOREIGN KEY (gold_patch_source_model) REFERENCES public.models(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.rl_coding_tasks |
| ADD CONSTRAINT rl_coding_tasks_source_id_fkey FOREIGN KEY (source_id) REFERENCES public.sources(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.sample_edits_staging |
| ADD CONSTRAINT sample_edits_staging_content_hash_fkey FOREIGN KEY (content_hash) REFERENCES public.samples(content_hash); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.samples |
| ADD CONSTRAINT samples_generated_by_model_fkey FOREIGN KEY (generated_by_model) REFERENCES public.models(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.samples |
| ADD CONSTRAINT samples_kind_id_fkey FOREIGN KEY (kind_id) REFERENCES public.kinds(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.samples |
| ADD CONSTRAINT samples_lang_id_fkey FOREIGN KEY (lang_id) REFERENCES public.langs(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.samples |
| ADD CONSTRAINT samples_license_id_fkey FOREIGN KEY (license_id) REFERENCES public.licenses(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.samples |
| ADD CONSTRAINT samples_near_dup_of_fkey FOREIGN KEY (near_dup_of) REFERENCES public.samples(content_hash); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.samples |
| ADD CONSTRAINT samples_quality_tier_id_fkey FOREIGN KEY (quality_tier_id) REFERENCES public.quality_tiers(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.samples |
| ADD CONSTRAINT samples_register_id_fkey FOREIGN KEY (register_id) REFERENCES public.registers(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.samples |
| ADD CONSTRAINT samples_reviewed_by_model_fkey FOREIGN KEY (reviewed_by_model) REFERENCES public.models(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.samples |
| ADD CONSTRAINT samples_shard_id_fkey FOREIGN KEY (shard_id) REFERENCES public.shards(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.samples |
| ADD CONSTRAINT samples_source_id_fkey FOREIGN KEY (source_id) REFERENCES public.sources(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.samples |
| ADD CONSTRAINT samples_split_id_fkey FOREIGN KEY (split_id) REFERENCES public.splits(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.sprapp_filter_corpus |
| ADD CONSTRAINT sprapp_filter_corpus_generated_by_model_fkey FOREIGN KEY (generated_by_model) REFERENCES public.models(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.sprapp_filter_corpus |
| ADD CONSTRAINT sprapp_filter_corpus_near_dup_of_fkey FOREIGN KEY (near_dup_of) REFERENCES public.sprapp_filter_corpus(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.sprapp_filter_corpus |
| ADD CONSTRAINT sprapp_filter_corpus_reviewed_by_model_fkey FOREIGN KEY (reviewed_by_model) REFERENCES public.models(id); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.training_run_datasets |
| ADD CONSTRAINT training_run_datasets_run_id_fkey FOREIGN KEY (run_id) REFERENCES public.training_runs(run_id) ON DELETE CASCADE; |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.training_run_datasets |
| ADD CONSTRAINT training_run_datasets_snapshot_name_fkey FOREIGN KEY (snapshot_name) REFERENCES public.corpus_snapshots(name); |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.training_run_results |
| ADD CONSTRAINT training_run_results_run_id_fkey FOREIGN KEY (run_id) REFERENCES public.training_runs(run_id) ON DELETE CASCADE; |
|
|
|
|
| |
| |
| |
|
|
| ALTER TABLE ONLY public.training_run_unverified_datasets |
| ADD CONSTRAINT training_run_unverified_datasets_run_id_fkey FOREIGN KEY (run_id) REFERENCES public.training_runs(run_id) ON DELETE CASCADE; |
|
|
|
|
| |
| |
| |
|
|
| \unrestrict THevuI5nL8va278qqO7jMSTP5LK8tqxqzRceXTedW4fR4pqR5ttaHEIfQb9Nuug |
|
|
|
|